Postfix before-queue Milter support

Milter == Mail Filter,一種郵件過濾協議,用於在mta以外的程序對smtp的每個事件進行注入,在郵件進入隊列以前判斷郵件是否容許發送,檢查郵件簽名等。要使用milter,能夠在main.cf中作以下配置:html

1 /etc/postfix/main.cf:
2     smtpd_milters = { inet:host:port,
3         connect_timeout=10s, default_action=accept }

postfix模擬了一些與Sendmail相似的宏,這些宏能夠在郵件發送的不一樣階段使用:session

Sendmail macro Milter protocol stage Description
i DATA, EOH, EOM Queue ID, also Postfix queue file name
j Always Value of myhostname
_ Always The validated client name and address
{auth_authen} MAIL, DATA, EOH, EOM SASL login name
{auth_author} MAIL, DATA, EOH, EOM SASL sender
{auth_type} MAIL, DATA, EOH, EOM SASL login method
{client_addr} Always Remote client IP address
{client_connections} CONNECT Connection concurrency for this client (zero if the client is excluded from all smtpd_client_* limits).
{client_name} Always Remote client hostname 
When address → name lookup or name → address verification fails: "unknown"
{client_port} Always (Postfix ≥2.5) Remote client TCP port
{client_ptr} CONNECT, HELO, MAIL, DATA Client name from address → name lookup 
When address → name lookup fails: "unknown"
{cert_issuer} HELO, MAIL, DATA, EOH, EOM TLS client certificate issuer
{cert_subject} HELO, MAIL, DATA, EOH, EOM TLS client certificate subject
{cipher_bits} HELO, MAIL, DATA, EOH, EOM TLS session key size
{cipher} HELO, MAIL, DATA, EOH, EOM TLS cipher
{daemon_addr} Always (Postfix ≥3.2) Local server IP address
{daemon_name} Always value of milter_macro_daemon_name
{daemon_port} Always (Postfix ≥3.2) Local server TCP port
{mail_addr} MAIL Sender address
{mail_host} MAIL (Postfix ≥ 2.6, only withsmtpd_milters) Sender next-hop destination
{mail_mailer} MAIL (Postfix ≥ 2.6, only withsmtpd_milters) Sender mail delivery transport
{rcpt_addr} RCPT Recipient address 
With rejected recipient: descriptive text
{rcpt_host} RCPT (Postfix ≥ 2.6, only withsmtpd_milters) Recipient next-hop destination 
With rejected recipient: enhanced status code
{rcpt_mailer} RCPT (Postfix ≥ 2.6, only withsmtpd_milters) Recipient mail delivery transport 
With rejected recipient: "error"
{tls_version} HELO, MAIL, DATA, EOH, EOM TLS protocol version
v Always value of milter_macro_v

postfix會在milter的不一樣階段發送指定的宏集合,這些宏集合與下表中的參數一塊兒配置:post

Postfix parameter Milter protocol version Milter protocol stage
milter_connect_macros 2 or higher CONNECT
milter_helo_macros 2 or higher HELO/EHLO
milter_mail_macros 2 or higher MAIL FROM
milter_rcpt_macros 2 or higher RCPT TO
milter_data_macros 4 or higher DATA
milter_end_of_header_macros 6 or higher EOH
milter_end_of_data_macros 2 or higher EOM
milter_unknown_command_macros 3 or higher unknown command

默認狀況下,只有宏的值與main.cf,master.cf,smtp會話中或郵個投遞事務中有不一樣時纔會被髮送,若是須要強制發送宏,須要經過 milter_macro_defaults配置宏參數的默認值。能夠設置成0,或更多的name=value對,甚至能夠設置postfix所不識別的宏名稱。this

相關文章
相關標籤/搜索