
私はシンプルなコンテンツ フィルターを使用してメールを Perl スクリプトに渡し、PGP キーを使用して暗号化しています。
Master.Cf
SMTPの下
-o content_filter=mail_encrypt:dummy
それから
mail_encrypt unix - n n - - pipe
flags= user=gpgmap argv=/usr/sbin/gpgit.pl ${recipient}
Main.cf
content_filter = mail_encrypt
私はマイク・カードウェルが書いたシンプルなPerlスクリプトを使用しています。https://github.com/mikecardwell/gpgit
動作しているように見えます。メールを送信すると、postfix が mail_encrypt に渡され、正常に配信されたメッセージが返されます。
mail postfix/pipe[3149]: 3E87341017: to=<[email protected]>,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)
しかし、メッセージはどこにも届きません。PF に返送されて配信されることはないと思いますが、この時点でどこを見ればよいのかわかりません。
更新: content_filter rfc を再度読み、高度なコンテンツ フィルターを選択しました。
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
メールは受信できるようになりました。ただし、Perl スクリプトがスキップされるようになったようです。
Aug 31 15:53:54 mail postfix/qmgr[3781]: 044944242D: from=<[email protected]>, size=1947, nrcpt=1 (queue active)
Aug 31 15:53:54 mail postfix/smtp[3799]: 84D3D42428: to=<[email protected]>, 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=<[email protected]>, relay=virtual, delay=0.49, delays=0.4/0.05/0/0.04, dsn=2.0.0, status=sent (delivered to maildir)
答え1
postfix-users リストでいくつか読んだり話したりした結果、この方法でのパイプ入力とパイプ出力は実際にはサポートされていないことがわかりました。Postfix は、sendmail コマンドでそれを返す perl スクリプトを探しています。
gpg-mailgate を使用するように切り替えましたが、動作しています。