OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: Problem using Postfix to pipe to a script

From: Rolf E. Sonneveld (R.E.Sonneveldsonnection.nl)
Date: Wed Jan 02 2008 - 16:17:12 CST


Loïc Foucault wrote:
> I there,
>
>
> I know this was covered many times but I searched and not found why I got
> this problem.
>
> I'm trying to pipe email to a bash script and the pipe command doesn't send
> me the email.
>
> I tried 2 way ( with aliases and with the master.cf file)
>
> Here my configurations:
> My script /test
> #!/bin/bash
>
> echo "-------------------------------------------------" >> /tmp.log
> echo `date` >> /tmp.log
> echo "$1" >> /tmp.log
>
> My /etc/postfix/transport:
> envoieinfofortin.com test:localhost
>
> My /etc/postfix/master.cf:
> test unix - n n - 1 pipe -vvvvvvvD
> flags= user=envoie argv=/test
>
> My /etc/aliases :
> envoi: "|/test"
>
>
> My Postfix configs:
> linux-gkm2:~ # postconf -n
> alias_maps = hash:/etc/aliases
> command_directory = /usr/sbin
> config_directory = /etc/postfix
> daemon_directory = /usr/lib/postfix
> debug_peer_level = 2
> html_directory = /usr/share/doc/packages/postfix/html
> inet_interfaces = all
> inet_protocols = all
> mail_owner = postfix
> mail_spool_directory = /var/mail
> manpage_directory = /usr/share/man
> mydestination = infofortin.com
> mydomain = infofortin.com
> myhostname = h1.infofortin.com
> myorigin = $mydomain
> newaliases_path = /usr/bin/newaliases
> queue_directory = /var/spool/postfix
> readme_directory = /usr/share/doc/packages/postfix/README_FILES
> sample_directory = /usr/share/doc/packages/postfix/samples
> sendmail_path = /usr/sbin/sendmail
> setgid_group = maildrop
> smtp_sasl_auth_enable = no
> smtp_use_tls = no
> smtpd_recipient_restrictions = permit_mynetworks,reject_unauth_destination
> smtpd_sasl_auth_enable = no
> smtpd_use_tls = no
> transport_maps = hash:/etc/postfix/transport
> unknown_local_recipient_reject_code = 550
>
>
> The problem is that email is not stored in the tmp.log file.
>
> Somebody know what it depend?
>

What does your mail log say?
Is your script executable (x bit?).
Is the file you want to write to (/tmp.log) writeable by that user
(envoie)? Maybe you want to test with /tmp/tmp.log, as /tmp is ususally
writeable by all users?

/rolf