Postfix 服务部署手札

一、域名配置

例如,我们的域名:aiunit.com

主机记录 记录类型 记录值 MX优先级
@ MX

一、安装 postfix 服务

# 假如安装了 sendmail 先卸载
apt-get purge sendmail

# 安装 postfix
apt-get install postfix

# 安装客户端工具
apt-get install mailutils

二、配置 /etc/postfix/main.cf

myhostname = www.aiunit.com
mydomain = aiunit.com
mydestination = $myhostname, localhost.$mydomain, localhost, mail.$mydomain, $mydomain
myorigin = /etc/mailname  # mailname 内容为 aiunit.com

smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
# 然後找到跟 relay 有關的設定項目,增加一段允許 SMTP 認證的字樣:
smtpd_recipient_restrictions =
     permit_mynetworks,
     permit_sasl_authenticated,  # 重點在這裡!注意順序!
     reject_unknown_sender_domain,
     reject_unknown_recipient_domain,
     reject_unauth_destination,
     reject_rbl_client cbl.abuseat.org,
     reject_rbl_client bl.spamcop.net,
     reject_rbl_client cblless.anti-spam.org.cn,
     reject_rbl_client sbl-xbl.spamhaus.org,
     check_policy_service unix:/var/spool/postfix/postgrey/socket

# 信件大小限制(附件限制由此开启)
message_size_limit = 2048000000

三、安装配置 dovecot

apt-get install dovecot-pop3d
apt-get install dovecot-imapd

检查 IP 是否被邮件反垃圾组织封禁

http://help.www.net.cn/KnowledgeDetail.html?knowledgeId=5867683&categoryId=8311146

http://www.kloth.net/services/dnsbl.php

查找发送垃圾邮件的木马:

http://cbl.abuseat.org/lookup.cgi?ip=108.61.126.57

检查是否存在发邮件木马

while true
do
    sudo lsof -i | grep smtp
    sleep 10
done

【转载请附】愿以此功德,回向 >>

原文链接:https://www.huangwenchao.com.cn/2015/06/postfix-deploy.html【Postfix 服务部署手札】

发表评论

电子邮件地址不会被公开。 必填项已用*标注