Postfix content filter not passing back message

email-serverperlpostfix

I'm using a simple content filter to pass off mail to a perl script to encrypt using a pgp key.

Master.Cf
Under smtp

-o content_filter=mail_encrypt:dummy

Then

mail_encrypt   unix    -       n       n       -       -       pipe
    flags= user=gpgmap argv=/usr/sbin/gpgit.pl ${recipient}

Main.cf

content_filter = mail_encrypt

I'm using a simple perl script written by Mike Cardwell, https://github.com/mikecardwell/gpgit

It "looks" like its working. I send mail, postfix hands off to mail_encrypt and gives me a successfully delivered message.

mail postfix/pipe[3149]: 3E87341017: to=<email@domain.com>,relay=mail_encrypt,delay=1.6, delays=0.52/0.01/0/1.1, dsn=2.0.0, status=sent (delivered via mail_encrypt service)

But the message just goes nowhere. I think it's not being handed back to PF for it to deliver but I'm not sure where to look at this point.

UPDATE:
I read through the content_filter rfc again and went with an advanced content filter.

scan      unix  -       -       n       -       10      smtp
        -o smtp_send_xforward_command=yes
        -o disable_mime_output_conversion=yes
        -o smtp_generic_maps=


localhost:10026 inet  n       n       n       -       10      spawn
        user=gpgmap argv=/usr/sbin/gpgit.pl ${recipient} localhost 10027



localhost:10026 inet  n       -       n       -       10      smtpd
        -o content_filter=
        -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks,no_milters
        -o smtpd_helo_restrictions=
#       -o smtpd_client_restrictions=
#       -o smtpd_sender_restrictions=
        # Postfix 2.10 and later: specify empty smtpd_relay_restrictions.
#       -o smtpd_relay_restrictions=
        -o smtpd_recipient_restrictions=permit_mynetworks,reject
        -o mynetworks=127.0.0.0/8
        -o smtpd_authorized_xforward_hosts=127.0.0.0/8

Now I get mail. But It looks almost like now it skips the perl script.

Aug 31 15:53:54 mail postfix/qmgr[3781]: 044944242D: from=<yyyy@yyyy.com>, size=1947, nrcpt=1 (queue active)
Aug 31 15:53:54 mail postfix/smtp[3799]: 84D3D42428: to=<xxxx@xxxx.com>, relay=localhost[127.0.0.1]:10026, delay=1, delays=0.55/0.01/0.04/0.4, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 044944242D)
Aug 31 15:53:54 mail postfix/smtpd[3800]: disconnect from localhost[127.0.0.1]
Aug 31 15:53:54 mail postfix/qmgr[3781]: 84D3D42428: removed
Aug 31 15:53:54 mail postfix/virtual[3802]: 044944242D: to=<xxxx@pxxxx.com>, relay=virtual, delay=0.49, delays=0.4/0.05/0/0.04, dsn=2.0.0, status=sent (delivered to maildir)

Best Answer

After doing some reading and talking to some people on the postfix-users list piping in and out this way isn't really supported. Postfix is looking for the perl script o hand it back with a sendmail command.

I switched over to using gpg-mailgate and that's working.