具有多个域和SSL的Postfix / Dovecot邮件服务器

在我的邮件设置上,我正在使用为服务器主机名生成的自签名证书。

我很好奇,是否有共享托pipe服务提供商用于多个域名邮件的SSL证书,他们如何设置?

如果您希望每个域都使用有效的SSL证书,则您有两种解决scheme:使用多域证书,或者将每个域设置为唯一的IP。 第一个解决scheme是非常糟糕的:那些证书通常是相当昂贵的(虽然你可以find便宜的证书),他们会列出你想在同一个证书上certificate的所有域名,最重要的是,它们只发布一次,只有一个新的域名意味着获得一个全新的证书。

更好的解决scheme是将每个域放置在自己的IP上,然后将每个证书与其相应的IP进行匹配。

这是你如何在后缀中做到这一点。

您将首先将每个域的证书放在/ etc / postfix /目录中(您也可以创build一个/ etc / postfix / ssl /目录)注意:我使用Plesk,它使用.pem证书文件,但是您也可以使用.key和.cer文件(.pem文件只是.key和.cer文件的一个连续,依次)

那么你需要修改/ etc / postfix /

最初,我看起来像这样(可能是因为我添加了最后3个IP后,我build立了服务器:

1.1.1.1- unix - nn - - smtp -o smtp_bind_address=1.1.1.1 -o smtp_bind_address6= -o smtp_address_preference=ipv4 2.2.2.2- unix - nn - - smtp -o smtp_bind_address=2.2.2.2 -o smtp_bind_address6= -o smtp_address_preference=ipv4 smtp inet n - n - - smtpd smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes submission inet n - n - - smtpd -o smtpd_enforce_tls=yes -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticate d,reject -o smtpd_sender_restrictions= 3.3.3.3- unix - nn - - smtp -o smtp_bind_address=3.3.3.3 -o smtp_bind_address6= -o smtp_address_preference=ipv4 4.4.4.4- unix - nn - - smtp -o smtp_bind_address=4.4.4.4 -o smtp_bind_address6= -o smtp_address_preference=ipv4 5.5.5.5- unix - nn - - smtp -o smtp_bind_address=5.5.5.5 -o smtp_bind_address6= -o smtp_address_preference=ipv4 

现在,要将每个证书绑定到其对应的IP,您可以执行以下操作:

 1.1.1.1- unix - nn - - smtp -o smtp_bind_address=1.1.1.1 -o smtp_bind_address6= -o smtp_address_preference=ipv4 2.2.2.2- unix - nn - - smtp -o smtp_bind_address=2.2.2.2 -o smtp_bind_address6= -o smtp_address_preference=ipv4 3.3.3.3- unix - nn - - smtp -o smtp_bind_address=3.3.3.3 -o smtp_bind_address6= -o smtp_address_preference=ipv4 4.4.4.4- unix - nn - - smtp -o smtp_bind_address=4.4.4.4 -o smtp_bind_address6= -o smtp_address_preference=ipv4 5.5.5.5- unix - nn - - smtp -o smtp_bind_address=5.5.5.5 -o smtp_bind_address6= -o smtp_address_preference=ipv4 #smtp inet n - n - - smtpd #smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes #submission inet n - n - - smtpd -o smtpd_enforce_tls=yes -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions= 1.1.1.1:smtp inet n - n - - smtpd -o smtpd_tls_cert_file=/etc/postfix/cert1.pem -o smtpd_tls_key_file=/etc/postfix/cert1.pem 1.1.1.1:smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_tls_cert_file=/etc/postfix/cert1.pem -o smtpd_tls_key_file=/etc/postfix/cert1.pem 1.1.1.1:submission inet n - n - - smtpd -o smtpd_enforce_tls=yes -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions= -o smtpd_tls_cert_file=/etc/postfix/cert1.pem -o smtpd_tls_key_file=/etc/postfix/cert1.pem 2.2.2.2:smtp inet n - n - - smtpd -o smtpd_tls_cert_file=/etc/postfix/cert2.pem -o smtpd_tls_key_file=/etc/postfix/cert2.pem 2.2.2.2:smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_tls_cert_file=/etc/postfix/cert2.pem -o smtpd_tls_key_file=/etc/postfix/cert2.pem 2.2.2.2:submission inet n - n - - smtpd -o smtpd_enforce_tls=yes -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions= -o smtpd_tls_cert_file=/etc/postfix/cert2.pem -o smtpd_tls_key_file=/etc/postfix/cert2.pem 3.3.3.3:smtp inet n - n - - smtpd -o smtpd_tls_cert_file=/etc/postfix/cert3.pem -o smtpd_tls_key_file=/etc/postfix/cert3.pem 3.3.3.3:smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_tls_cert_file=/etc/postfix/cert3.pem -o smtpd_tls_key_file=/etc/postfix/cert3.pem 3.3.3.3:submission inet n - n - - smtpd -o smtpd_enforce_tls=yes -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions= -o smtpd_tls_cert_file=/etc/postfix/cert3.pem -o smtpd_tls_key_file=/etc/postfix/cert3.pem 4.4.4.4:smtp inet n - n - - smtpd -o smtpd_tls_cert_file=/etc/postfix/cert4.pem -o smtpd_tls_key_file=/etc/postfix/cert4.pem 4.4.4.4:smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_tls_cert_file=/etc/postfix/cert4.pem -o smtpd_tls_key_file=/etc/postfix/cert4.pem 4.4.4.4:submission inet n - n - - smtpd -o smtpd_enforce_tls=yes -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions= -o smtpd_tls_cert_file=/etc/postfix/cert4.pem -o smtpd_tls_key_file=/etc/postfix/cert4.pem 5.5.5.5:smtp inet n - n - - smtpd -o smtpd_tls_cert_file=/etc/postfix/cert5.pem -o smtpd_tls_key_file=/etc/postfix/cert5.pem 5.5.5.5:smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_tls_cert_file=/etc/postfix/cert5.pem -o smtpd_tls_key_file=/etc/postfix/cert5.pem 5.5.5.5:submission inet n - n - - smtpd -o smtpd_enforce_tls=yes -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_restrictions= -o smtpd_tls_cert_file=/etc/postfix/cert5.pem -o smtpd_tls_key_file=/etc/postfix/cert5.pem 

而已!! (不要忘记注释掉上面的原始行)

PS:如果您使用courier-imap,则对POP / IMAP执行相同操作,只需将这些.pem文件的副本放在/ usr / share / courier-imap /中 (或者在Plesk的情况下,将它们放在/ usr / share / ),并按如下所示命名:imapd.pem.xx.xx.xx.xx pop3d.pem.xx.xx.xx.xx

其中xx.xx.xx.xx是相应的IP地址(2个证书是同一文件的副本)

希望这可以帮助!