故障排除:将 SSL 证书集成到 Postfix

故障排除:将 SSL 证书集成到 Postfix

为了在我的 Postfix 服务器上使用 TLS,我直接使用了来自其他服务器的 nginx ssl 文件,该服务器也使用了我想要与 postfix 一起使用的域。

我按照下面的方式将文件集成到main.cf中:

smtpd_tls_cert_file = /etc/ssl/subdomain.example.com.crt
smtpd_tls_key_file = /etc/ssl/subdomain.example.com.key
smtpd_tls_CAfile = /etc/ssl/subdomain.example.com.pem

我没有对 openssl 或类似的东西进行任何操作,我只是在 nginx 中使用了用于另一台服务器的文件。但我想这应该不是问题,因为邮件服务器也使用与 nginx 相同的域。

通过 shell () 使用 postfix 发送邮件mail完全没有问题,但是当我想使用我的 postfix 服务器作为中继服务器时,出现以下错误(场景:我想在 PHP-CMS 中使用我的 smtp 服务器):

cannot enable STARTTLS, though 'subdomain.example.com:25' advertised it:
4.7.0 TLS           not available due to local problem (454)

邮件日志:

Feb  5 15:40:09 koto postfix/smtpd[8911]: warning: TLS library problem: error:2006D080:BIO routines:BIO_new_file:no such file:bss_file.c:172:
Feb  5 15:40:09 koto postfix/smtpd[8911]: warning: TLS library problem: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib:by_file.c:274:

我的main.cf:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_tls_cert_file = /etc/ssl/subdomain.example.com.crt
smtpd_tls_key_file = /etc/ssl/subdomain.example.com.key
smtpd_tls_CAfile = /etc/ssl/subdomain.example.com.pem

smtpd_tls_auth_only = yes
smtpd_tls_session_cache_timeout = 3600s

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache


# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = debian-512mb-fra1-01
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = **domain**, debian-512mb-fra1-01, localhost.localdomain, localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

mime_header_checks = regexp:/etc/postfix/header_checks
header_checks = regexp:/etc/postfix/header_checks

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = *****
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:587

==> 这里有什么问题?

相关内容