代码之家  ›  专栏  ›  技术社区  ›  Duncan Connolly

如何在postfix中加密发送的电子邮件

  •  0
  • Duncan Connolly  · 技术社区  · 7 年前

    我已经建立了postfix和dovecot以下几个在线指南和一贯的问题,我发送的电子邮件将不会加密。 我一直在通过向我的@gmail发送电子邮件来测试设置。com帐户,因为我确信谷歌服务器将支持TLS加密,而gmail网络邮件中的电子邮件清楚地显示了红色划掉的挂锁,以表明它们没有加密。

    如果我设置

    smtpd_tls_security_level = encrypt
    smtp_tls_security_level = encrypt 
    

    我得到这个错误

    TLS is required, but was not offered by host gmail-smtp-in.l.google.com[64.233.167.27]
    

    如果我将其设置为may,它会发送电子邮件,而不加密。

    这是postconf-n的输出

    alias_database = hash:/etc/aliases
    alias_maps = hash:/etc/aliases
    append_dot_mydomain = no
    biff = no
    home_mailbox = Maildir/
    inet_interfaces = all
    inet_protocols = all
    mailbox_command =
    mailbox_size_limit = 0
    mydestination = $myhostname, localdomain, localhost, localhost.localdomain, localhost, mail.example.com, example.com
    myhostname = mail.example.com
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    mynetworks_style = subnet
    myorigin = /etc/mailname
    readme_directory = no
    recipient_delimiter = +
    smtp_tls_CAfile = /routeto/my.ca-bundle
    smtp_tls_cert_file = /routeto/my.crt
    smtp_tls_key_file = /routeto/my.key
    smtp_tls_loglevel = 1
    smtp_tls_note_starttls_offer = yes
    smtp_tls_security_level = may
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
    smtp_use_tls = yes
    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unknown_client_hostname
    smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
    smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_local_domain = example.com
    smtpd_sasl_path = private/auth
    smtpd_sasl_type = dovecot
    smtpd_tls_CAfile = /routeto/my.ca-bundle
    smtpd_tls_cert_file = /routeto/my.crt
    smtpd_tls_key_file = /routeto/my.key
    smtpd_tls_loglevel = 1
    smtpd_tls_received_header = yes
    smtpd_tls_security_level = may
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtpd_use_tls = yes
    

    这是端口25上telnet的输出,然后是ehlo测试

    250-mail.example.com
    250-PIPELINING
    250-SIZE 10240000
    250-VRFY
    250-ETRN
    250-STARTTLS
    250-AUTH PLAIN LOGIN
    250-ENHANCEDSTATUSCODES
    250-8BITMIME
    250 DSN
    

    587端口也是一样

    250-mail.example.com
    250-PIPELINING
    250-SIZE 10240000
    250-VRFY
    250-ETRN
    250-STARTTLS
    250-ENHANCEDSTATUSCODES
    250-8BITMIME
    250 DSN
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   Steffen Ullrich    7 年前

    TLS是必需的,但主机gmail smtp在中未提供。l、 谷歌。com[64.233.167.27]

    这清楚地表明,主机不向您的服务器提供STARTTLS。但是,众所周知,gmail提供STARTTLS,你在telnet上的测试证实了这一点。我的猜测是,您是从另一个系统执行telnet的,并且您的邮件服务器位于某个(透明)防火墙后面,该防火墙会拦截流量以进行分析。为了不处理加密的SMTP通信,通常只需从服务器对EHLO的响应中剥离STARTTLS命令,以便邮件服务器假设TLS不受支持。

    What happens if STARTTLS dropped in SMTP? .