vi /etc/postfix/main.cf
SSL/TLS证书,这个证书,最好是免费一年的!自己去申请就好,推荐用腾讯云的免费证书
SMTP SSL/TLS
code ### SSL/TLS Settings smtp_tls_security_level = may smtpd_tls_cert_file = /etc/letsencrypt/live/mail.testdom.com/fullchain.pem smtpd_tls_key_file = /etc/letsencrypt/live/mail.testdom.com/privkey.pem smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_scache smtpd_tls_session_cache_timeout = 3600s smtpd_tls_received_header = yes smtpd_tls_loglevel = 1
vi /etc/postfix/master.cf
smtps inet n - n - - smtpd 取消注解
-o smtpd_tls_wrappermode=yes 取消注解
-o smtpd_sasl_auth_enable=yes 取消注解
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject 取消注解
完了
postconf -n
postfix check
systemctl restart postfix
systemctl status postfix
. dovecot設定
vi /etc/dovecot/conf.d/10-ssl.conf
ssl = required
ssl_cert = </etc/你证书的位置
ssl_key = </etc/你证书的位置
10-master.conf 设置
vi /etc/dovecot/conf.d/10-master.conf
service imap-login { inet_listener imap { port = 0 用不到了 } inet_listener imaps { port = 993 取消注释
ssl = yes 取消注释
}
service pop3-login { inet_listener pop3 { port = 0 用不到了 } inet_listener pop3s { port = 995 取消注释 ssl = yes 取消注释 } } 完了
doveconf -n systemctl restart dovecot systemctl status dovecot