Can postfix/pipe run external programs under a random UID?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Can postfix/pipe run external programs under a random UID?

Leonid Isaev
Hello,

        One of arguments of pipe(8) is "user=" that instructs it to run an
external programunder specified user. For example, the following snippet will
run faxmail(1) under the user faxmail:
-----8<-----
fax       unix   -      n        n      -       1       pipe
  flags= user=faxmail argv=/usr/bin/faxmail -d -n ${user}
----->8-----

Is it possible to have postfix select user at random from some list of
preallocated UIDs/usernames? (I'm looking for ways to isolate different
instances of the same command)

Thanks,
--
Leonid Isaev
Reply | Threaded
Open this post in threaded view
|

Re: Can postfix/pipe run external programs under a random UID?

Wietse Venema
Leonid Isaev:

> Hello,
>
> One of arguments of pipe(8) is "user=" that instructs it to run an
> external programunder specified user. For example, the following snippet will
> run faxmail(1) under the user faxmail:
> -----8<-----
> fax       unix   -      n        n      -       1       pipe
>   flags= user=faxmail argv=/usr/bin/faxmail -d -n ${user}
> ----->8-----
>
> Is it possible to have postfix select user at random from some list of
> preallocated UIDs/usernames? (I'm looking for ways to isolate different
> instances of the same command)

The user attribute takes a fixed username, not a lookup table.

You can use

/etc/postfix/main.cf:
    transport_maps = randmap:{fax1:, fax2:, ...}

to randomly invoke different fax transports, each with their own
fixed username.

Of course random selection is subject to collisions.

        Wietse