Viktor Dukhovni via Postfix-users:
> On Tue, Apr 15, 2025 at 08:05:20AM -0400, Wietse Venema via Postfix-users 
> wrote:
> 
> > berg...@panix.com:
> > > Perhaps $HOME could be set in the environment for the pipe service 
> > > command.
> > 
> > This is a subtle difference between local(8) and pipe(8). 
> > 
> > local(8) delivers mail for real users that are required to have a
> > home directory. It exportes HOME and changes directory to $HOME
> > before delivering mail to a command in their .forward file.
> > 
> > pipe(8) delivers mail for service accounts that are not required
> > to have their own home directory, for example:
> > 
> > postfix:*:1002:1002:postfix:/no/home:/no/shell
> > milter:*:999:999:milter:/no/home:/no/shell
> > 
> > pipe(8) already has an explicit 'directory=pathname' argument to
> > specify the execution directory, but it doees not (yet) have an
> > option to specify '{ environment = HOME=/path ...}'.
> 
> Wouldn't the below do the trick:
> 
>     foo unix ... pipe
>         -o { export_environment = HOME=/some/where }
>         ...
> 
> As it should for any Postfix service that forks subprocesses?

Unfortunately, that will destroy the default export_environment
setting with MAIL_CONFIG and perhaps more that is needed to make
pipe-to-command-to-sendmail content filters work.

Other approaches:

-o { export_environment ,= HOME=/some/where ...}

    I haven't figured out how to make += etc. syntax work consistenly
    in all cases. Minor: does not derive the HOME setting from the
    user= attribute.

directory=/some/where
home=/some/where

    Makes fully explicit when HOME is exported and when the chdir()
    is done. Minor: does not derive the HOME setting from the user=
    attribute. On the upside, that gives maximal control over what
    happens (element of least surprise).

directory=HOME

    Make the value 'HOME' special (take the user= attibute value,
    look up their home in the passwd database, then chdir() and
    export as HOME).

    Ugly, but avoids introducing surprises into EXISTING behavior.

Looks like adding a home= attribute has the least element of surprise.

        Wietse
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to