1

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

  1. What i can do wrong?
  2. unix:private/user_ex - what does mean private ?
Anton Shevtsov
  • 1,279
  • 4
  • 16
  • 34
  • perl angle hints/fixes Try the script without `chomp` (to avoid I/O buffering) and use `$file_->print( $_);` (to print to $file_). – AnFi Feb 09 '15 at 07:36
  • @AndrzejA.Filip I am tried. Nothing. I think the problem is not in the perl. – Anton Shevtsov Feb 09 '15 at 09:06
  • 1
    This is a complete example in perl. https://github.com/vdukhovni/postfix/blob/master/postfix/examples/smtpd-policy/greylist.pl This should help. also how did u send the test mail? – clement Feb 09 '15 at 11:54

0 Answers0