首页 > 其他分享 >Postfix + Dovecot IMAP 服务器的终极指南,完整支持 SPF、DKIM 和 DMARC,以及多域名设置的额外说明

Postfix + Dovecot IMAP 服务器的终极指南,完整支持 SPF、DKIM 和 DMARC,以及多域名设置的额外说明

时间:2024-03-31 23:04:14浏览次数:12  
标签:domain get Postfix apt etc mail Dovecot com DKIM

邮件服务器配置指南

本指南将带您完成Postfix + Dovecot IMAP服务器的设置,支持SPF、DKIM和DMARC,还将提供多域名配置的额外指导。在本指南中,domain.com 将作为您的根域名,mail.domain.com 将作为您邮件服务器的主机名。

0x01 添加DNS记录

在您的域名下添加如下DNS记录:

mail  IN  A   您的邮件服务器IP
@     IN  MX  mail.domain.com

SPF、DKIM和DMARC等额外记录的设置如下:

@               IN  TXT "v=spf1 mx a -all"
//SPF记录,无需额外设置
default._domainkey IN  TXT "v=DKIM1; h=sha256; k=rsa; p=*"
//DKIM记录,需要使用opendkim进行额外设置
_dmarc          IN  TXT "v=DMARC1;p=quarantine;rua=mailto:您的邮箱"
//DMARC记录,无需额外设置

完成SPF和DMARC的设置后,我们将继续进行完整支持DKIM的Postfix + Dovecot IMAP服务器的实际配置。

0x02 设置主机名

使用您喜欢的编辑器修改 /etc/hostname 文件,添加您的主机名。

/etc/hostname

mail.domain.com

0x03 验证DNS解析

更新系统并安装dnsutils工具,然后验证DNS解析:

apt-get update
apt-get upgrade
apt-get install dnsutils
dig mx domain.com +short
dig a mail.domain.com +short

确保上述第二条命令的输出与您当前邮件服务器的IP匹配。

0x04 获取SSL证书

安装certbot工具,获取仅包含证书文件的证书:

apt-get update
apt-get upgrade
apt-get install certbot
certbot --agree-tos --standalone -d mail.domain.com certonly

按照提示操作,选择独立模式进行认证,输入您的域名 mail.domain.com。最后,证书(cert.pem)和私钥(privkey.pem)将保存在 /etc/letsencrypt/live/mail.domain.com/。

将证书文件和私钥复制到易于访问的位置:

cp /etc/letsencrypt/live/mail.domain.com/*.pem /path/to/cert/

0x05 安装并配置Postfix

安装Postfix和mailutils工具,选择“Internet Site”,并输入 domain.com。

apt-get update
apt-get upgrade
apt-get install postfix mailutils

0x05.1 main.cf

使用您喜爱的编辑器编辑 /etc/postfix/main.cf 文件,并确认以下设置:

vim /etc/postfix/main.cf

myhostname = mail.domain.com
mydomain = domain.com
myorigin = $mydomain
mydestination = $myhostname, $mydomain, localhost.$mydomain, localhost

在这里,您可以添加SSL证书和私钥的路径,并添加一些额外的安全设置:

smtpd_tls_cert_file = /path/to/cert/fu

标签:domain,get,Postfix,apt,etc,mail,Dovecot,com,DKIM
From: https://blog.csdn.net/song19891121/article/details/137189928

相关文章

  • 生成DKIM的公钥和私钥
    生成一个公钥和私钥可以使用下述网站生成公钥和私钥(当然,使用外部网站来生成公钥和私钥是不安全的,建议仅作为测试时使用)https://easydmarc.com/tools/dkim-record-generator 通过证书生成一个公钥和私钥     使用OpenSSL创建证书          1.......
  • Infix to postfix conversion using stack【1月21日学习笔记】
    点击查看代码//Infixtopostfixconversionusingstack#include<iostream>#include<stack>//stackfromstandardtemplatelibrary(STL)#include<string>usingnamespacestd;stringInfixToPostfix(stringexp);boolHasHigherPrecedence(charopr1,......
  • Evaluation Of postfix Expression using stack【1月21日学习笔记】
    点击查看代码//EvaluationOfpostfixExpressionusingstack#include<iostream>#include<stack>//stackfromstandardtemplatelibrary(STL)#include<string>usingnamespacestd;intEvaluatePostfix(stringexp);boolIsOperator(charc);intPe......
  • 您可以尝试添加 --skip-broken 选项来解决该问题 ** 发现 2 个已存在的 RPM 数据库问
    ##提示如下**Found2pre-existingrpmdbproblem(s),‘yumcheck’outputfollows:2:postfix-2.10.1-7.el7.x86_64hasmissingrequiresoflibmysqlclient.so.18()(64bit)2:postfix-2.10.1-7.el7.x86_64hasmissingrequiresoflibmysqlclient.so.18(libmysqlclient_18)......
  • 企业微信——给国外的邮箱发邮件报错Authentication results: DKIM = did not pass
    前言发件人([email protected])域名的DNS记录未设置或设置错误导致对方拒收此邮件。hostgmail-smtp-in.l.google.com[172.253.118.27]said:550-5.7.26Thismailhasbeenblockedbecausethesenderisunauthenticated.Gmailrequiresallsenderstoauthenticatewitheither......
  • CentOS6.4邮件配置一: postfix + dovecot + mysql + postfixadmin + Roundcubemail
    参考文章:----------------------------[size=large][color=red]可以考虑:[/color][/size]Posty——Postfix和Dovecot的管理工具[url][/url]Posty是一款基于Web的Postfix&Dovecot管理工具,功能模块包括:API、CLI和WebUI。基于Centos6.2X64系......
  • 【验】Postfix+Dovecot+MySQL搭建邮件服务器
    网上有很多使用Postfix搭建邮件服务器的文章,但目前貌似没有看到较为完整的一篇。本例将尝试在Ubuntu系统中使用Postfix+Dovecot+MySQL搭建邮件服务器。说到邮件服务器,网上有许多不同解决方案。Window操作系统下常见的邮件服务器有hMailServer、MailEnable、EVOMailServer、ApacheJ......
  • Linux中Postfix反病毒和垃圾邮件(十)
    摘自:http://www.ywnds.com/?p=1817 amavisd-newamavisd-new呼叫器是一个连接MTA和内容检测工具(诸如病毒扫描工具和SpamAssassin)的高性能接口程序,使用perl语言写成。它一般通过SMTP、ESMTP或者LMTP和MTA进行通讯,可以将位于队列的邮件取出来,调用ClamAV对邮件进行病毒扫描,调用Sp......
  • Linux中Postfix邮件认证配置(五)
    摘自:http://www.ywnds.com/?p=1784Postfix+Dovecot+Sasl工作原理1.A用户使用MUA客户端借助smtp协议登陆smtpd服务器,需要先进行用户和密码认证,而SMTPD服务器端支持sasl认证,例如有一个sasl客户端,就会去连接SASL。当SASL接受到验证请求时就会根据验证方式去进行验证,常用的有PAM,pass......
  • Linux中Postfix虚拟用户及虚拟域(六)
    摘自:http://www.ywnds.com/?p=1797 Postfix基于虚拟用户虚拟域的邮件架构 上图是一个几乎完整的邮件系统架构图,这里基于Mysql数据库进行用户认证,不管是Postfix、Dovecot、webmail都需要去Mysql数据库中进行用户认证。1、用户可以基于outlook连接postfix然后通过Courier-au......