I read http://www.postfix.org/SMTPD_POLICY_README.html and to start develop a simple demo.
At first, i want get all key=value (http://www.postfix.org/SMTPD_POLICY_README.html#protocol) from postfix to my script (i use perl).
I write simple code user_ex.pl
#!/usr/bin/perl
use strict;
my $filename = '/tmp/log.log';
open my $file_,'>',$filename;
while (<STDIN>) {
chomp;
print $file_ , $_;
}
close $file_;
copy user_ex.pl to /usr/libexec/postfix/user_ex.pl
add to end of master.cf two lines
user_ex unix - n n - 0 spawn
user=nobody argv=/usr/bin/perl /usr/libexec/postfix/user_ex.pl
add to main.cf
smtpd_sender_restrictions = check_policy_service unix:private/user_ex
postfix restart, send email, and nothing..
File /tmp/log.log have 0 bytes
- What i can do wrong?
- unix:private/user_ex - what does mean private ?