一 安装
1安装postfix
sudo apt-get install postfix
#如果没有弹出配置界面,运行
dpkg-reconfigure postfix
#sudo vim /etc/postfix/main.cf
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 3.6
# TLS parameters
#smtp服务端的TLS配置
smtpd_use_tls = yes
smtpd_tls_cert_file=/etc/ssl/zld/fullchain.pem
smtpd_tls_key_file=/etc/ssl/zld/privkey.pem
smtpd_tls_security_level=encrypt
smtpd_tls_loglevel = 1
#smtp客户端的TLS配置
smtp_use_tls = yes
#smtp_tls_CApath=/etc/ssl/certs
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_security_level=encrypt
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_tls_loglevel = 1
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mail.test.com
mydomain = test.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = $mydomain
mydestination = iZbp1g7fmjea77vsqc5hmmZ, test.com, iZbp1g7fmjea77vsqc5hmmZ, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
home_mailbox = Maildir/
#dovecot smtp认证
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain =$myhostname
smtpd_sasl_authenticated_header = yes
#检测用户认证是否通过
smtpd_client_restrictions = permit_sasl_authenticated
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination,reject
#sudo vim /etc/postfix/master.cf
smtps inet n - n - - smtpd
# -o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
2 安装dovecot
#安装dovecot
sudo apt-get install dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd
sudo vim /etc/dovecot/dovecot.conf
#listen = *, :: --> listen = *
sudo vim /etc/dovecot/conf.d/10-auth.conf
#disable_plaintext_auth = yes --> disable_plaintext_auth = no
auth_mechanisms = plain --> auth_mechanisms = plain login
#邮箱数据目录
sudo vim /etc/dovecot/conf.d/10-mail.conf
mail_location = mbox:~/mail:INBOX=/var/mail/%u --> mail_location = maildir:~/Maildir
#配置stmp 校验
sudo vim /etc/dovecot/conf.d/10-master.conf
# Postfix smtp-auth 下面修改
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
#配置证书
sudo vim /etc/dovecot/conf.d/10-ssl.conf
ssl = yes --> ssl = required
ssl_cert = </etc/dovecot/private/dovecot.pem --> 改成实际ssl证书
ssl_key = </etc/dovecot/private/dovecot.key --> 改成实际ssl证书
3 客户端测试
#foxmail收取邮件报错
Jun 13 11:13:38 iZbp1g7fmjea77vsqc5hmmZ dovecot: pop3-login: Disconnected: Connection closed: SSL_accept() failed: error:0A000076:SSL routines::no suitable signature algorithm (no auth atte
mpts in 0 secs): user=<>, rip=61.174.145.130, lip=172.16.195.13, TLS handshaking: SSL_accept() failed: error:0A000076:SSL routines::no suitable signature algorithm, session=<A8ab4rwaofI9rpGC>(END)
#解决,foxmail升级最新版本 即可
标签:LTS,tls,ssl,postfix,auth,etc,22.04,smtpd,dovecot From: https://blog.csdn.net/tonyhi6/article/details/139632001