
我正在使用簡單的內容過濾器將郵件傳遞給 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
我正在使用 Mike Cardwell 編寫的簡單 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 用戶列表上的一些人交談之後,這種方式的管道輸入和輸出實際上並不受支援。 Postfix 正在尋找 perl 腳本,或使用 sendmail 命令將其傳回。
我改用 gpg-mailgate 並且有效。