Thanks for all the great info.

mouss wrote:
[reposting to list, even if you posted other messages after this]

Vadtec a écrit :
you have an error in your perl script.
Maybe.


debug the script. run it manually.

I had already ran the script manually to verify it worked.
[snipped to save space]

<[EMAIL PROTECTED]>: cannot append message to file
   /path/to/my/perl/script/parse.pl: cannot open file:
   Permission denied

why would you append a message to a perl script?
Because Perl has the nifty ability to receive from stdin so that I can
parse the e-mail to extract data from it. I don't so much care about the
e-mail it self.

That's not how I understand it. I understand it like this: the message
is being appended to (added to the end of) the file /path/.../parse.pl,
not being passed to stding after executing the script. To be clear, this
is like:

# cat message.eml >> /path/.../parse.pl

after a message is appended, the script is invalid (syntax errors). and
after more and more messages are appended, the script becomes larger and
larger. do you understand what I mean?


parse: |perl /path/to/my/script/parse.pl

As Wietse said, quote the command:

parse: "|perl /path/to/..../parse.pl"

and instead of running perl like this, add "#!/usr/bin/perl" (adjust the
path if perl is somewhere else) at the beginning of the script, and make
the script executable. This way you can simply do

parse: "|/path/.../parse.pl"

it is a good security practice to always use absolute paths
(/usr/bin/perl instead of perl).

I rarely use relative paths. Once to often I've seen known binaries get messed with.

As for the fix, the only thing I didn't do was quote the command, which I have since done.
Finally, since the aliases file belongs to root, the script is executed
as "nobody", which explains the permission problems.

to run the script as a user "foo", put it in a separate file, say
foo_aliases and use

alias_maps =
        hash:/etc/.../aliases
        hash:/etc/postfix/foo_aliases

then chown foo_aliases to "foo".
To cure this, I set default_privs to "mail" and chowned the script and dir accordingly. I'm glad to say it worked. I'll also look into using the alias_maps method.

An alternative is to use a transport in master.cf instead of using
alias_maps.
This is above me at this point, but I will look into this as well.


Vadtec
[EMAIL PROTECTED]

Reply via email to