Smarthost 不用 Login 的設定
Source: 在 main.cf 加上
# Default: empty relayhost = [relay.server]:port # or # relayhost = relay.server:Port
This information is overruled with
- relay_transport,
- sender_dependent_default_transport_maps,
- default_transport,
- sender_dependent_relayhost_maps
- transport
Smarthost 要 Login 的設定
安裝 login
yum install cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain
沒有安會 log
.. : SASL authentication failed; cannot authenticate to server smtp.office365.com[R.R.R.R]: no mechanism available
Source: main.cf
relayhost = [relay.server]:1025 # Enable SASL authentication in the Postfix SMTP client. smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/relay_passwords # Postfix SMTP client can filter the names of the authentication mechanisms from the remote SMTP server. # "留空"即可用 server 提供的任何 SASL 方法 # If the remote server does not offer any of the mechanisms on the filter list, authentication will fail. smtp_sasl_mechanism_filter = # Postfix SMTP client SASL security option; Default: noplaintext, noanonymous # noanonymous => Disallow methods that allow anonymous authentication # noplaintext => Disallow methods that use plaintext passwords smtp_sasl_security_options = noanonymous # 是否用 TLS 加密 smtp_use_tls = no # When the remote SMTP servername is a DNS CNAME, # replace the servername with the result from CNAME expansion for the purpose of logging, SASL password lookup smtp_cname_overrides_servername = no
/etc/postfix/relay_passwords 內容:
# username:password entry per remote hostname # 必須要與 relayhost 對應 (一樣) # 因為 "smtp_cname_overrides_servername = no", 所以直接用 "relay.server" 去 lookup password [relay.server]:1025 yourusername:yourpassword
P.S.
chmod 640 relay_passwords
chown root.postfix relay_passwords
建立 relay_passwords:
postmap hash:/etc/postfix/relay_passwords
[root@mail log]# ll /etc/postfix/relay_passwords.db -rw-r----- 1 root root 12288 Apr 30 12:27 /etc/postfix/relay_passwords.db
套用設定:
postfix reload
測試
成功的 log
Apr 30 14:55:58 mail postfix/smtp[4509]: 9AD8F3F5D4: to=<[email protected]>, relay=relay.server[?.?.?.?]:1025, delay=8440, delays=8437/0.07/2.1/0.45, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 1EC0270215) Apr 30 14:55:58 mail postfix/qmgr[4499]: 9AD8F3F5D4: removed
smtp_sasl_type
smtp_sasl_type (default: cyrus)
查看:
postconf -A
cyrus-sasl-plain
Per Sender Routing
# A lookup result of DUNNO terminates the search without overriding the global relayhost parameter setting
sender_dependent_relayhost_maps = hash:/etc/postfix/bysender
Remark
This information is overruled with
- relay_transport
- sender_dependent_default_transport_maps
- default_transport
- transport
Toubleshoot
[1]
Centos6:
cannot authenticate to server relay.server[?.?.?.?]: no mechanism available
原因:
系統未有安裝: cyrus-sasl-plain
Description: The cyrus-sasl-plain package contains the Cyrus SASL plugins
which support PLAIN and LOGIN authentication schemes.