大网数据广告活动
服务器运维问答

Postfix STARTTLS encryption before authentication

· 52CE 我爱测

I'm trying my best to configure Postfix with STARTTLS using port 25. Now the problem is STARTTLS is not working on port 25. 250-VRFY 250-ETRN 250-XXXXXXXA 250-AUTH PLAIN LOGIN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN AUTH LOG…

问题原文

原帖链接 · David A · CC BY-SA 3.0

I'm trying my best to configure Postfix with STARTTLS using port 25. Now the problem is STARTTLS is not working on port 25.

250-VRFY
250-ETRN
250-XXXXXXXA
250-AUTH PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
AUTH LOGIN
334 xxxxxxxxxx
334 xxxxxxxxxxxxx
235 2.7.0 Authentication successful
RSET
250 2.0.0 Ok
MAIL FROM: <[email omitted]>
250 2.1.0 Ok
RCPT TO: <[email omitted]>

When using port 587, there is a STARTTLS feature, but I don't see "220 2.0.0 Ready to start TLS".

STARTTLS should start before authention. If the device/client doesn't support STARTTLS, auth should be rejected automatically.

It should be like this with port 25.

250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
220 2.0.0 Ready to start TLS
250-AUTH PLAIN LOGIN
AUTH PLAIN am9obkBleGFtcGxlLm9yZwBqb2huQGV4YW1wbGUub3JnAHN1bW1lcnN1bg==

Please advice where the mistake is? Did I miss out something?

Possible to use STARTTLS with port 25?

main.cf

smtp_tls_security_level = may
smtpd_use_tls = yes
smtpd_tls_key_file = /etc/postfix/certs/key.key
smtpd_tls_cert_file = /etc/postfix/certs/crt.crt
smtpd_tls_CAfile = /etc/postfix/certs/mcabundle.ca-bundle
smtp_tls_key_file = /etc/postfix/certs/key.key
smtp_tls_cert_file = /etc/postfix/certs/crt.crt
smtp_tls_CAfile = /etc/postfix/certs/ca-bundle
tls_random_source = dev:/dev/urandom
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = smtpd
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = cyrus
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
smtpd_delay_reject = yes
smtpd_client_restrictions = permit_sasl_authenticated, reject

master.cf

smtp      inet  n       -       n     -       -       smtpd
#smtp      inet  n       -       n       -       1       postscreen
#smtpd     pass  -       -       n       -       -       smtpd
#dnsblog   unix  -       -       n       -       0       dnsblog
#tlsproxy  unix  -       -       n       -       0       tlsproxy
#submission inet n       -       n       -       -       smtpd
#  -o syslog_name=postfix/submission
#  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes

已采纳解答

原帖链接 · 84104 · CC BY-SA 3.0

To get TLS on port 25, place smtpd_tls_security_level = may in main.cf.
You should also place smtpd_tls_auth_only = yes in main.cf, so that it is not possible to authenticate without first encrypting connections.


Additionally, I recommend adjusting your master.cf to:

smtp      inet  n       -       n     -       -       smtpd
#smtp      inet  n       -       n       -       1       postscreen
#smtpd     pass  -       -       n       -       -       smtpd
#dnsblog   unix  -       -       n       -       0       dnsblog
#tlsproxy  unix  -       -       n       -       0       tlsproxy
submission inet n       -       n       -       -       smtpd
  -o syslog_name=postfix/submission
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes

After this change the submission port (587/tcp) will be active and require encryption. It will also be easier to distinguish in the logs.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-04-29)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。