无法从Postfix中的命令行发送电子邮件(警告:TLS库…)

我用ssl / tlsconfiguration了postfix。 并创build了一个smtp。 但是我无法发送testing电子邮件和/或login。

“下面的文本首先定义了错误日志(不同的尝试),然后是configuration文件。”

错误loginterminal。

[First Attempt] [root@domain postfix]# telnet mail.example.org 587 Trying 139.59.182.62... Connected to mail.example.org. Escape character is '^]'. 220 example.org ESMTP Postfix ehlo mail.example.org 250-example.org 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH PLAIN 250-AUTH=PLAIN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN starttls 220 2.0.0 Ready to start TLS ehlo mail.example.org Connection closed by foreign host. [Second Attempt] [root@domain postfix]# telnet mail.example.org 587 Trying 139.59.182.62... Connected to mail.example.org. Escape character is '^]'. 220 example.org ESMTP Postfix ehlo mail.example.org 250-example.org 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH PLAIN 250-AUTH=PLAIN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN auth plain 334 username 535 5.7.8 Error: authentication failed: another step is needed in authentication quit 221 2.0.0 Bye Connection closed by foreign host. [Third Attempt] [root@domain postfix]# telnet mail.example.org 587 Trying 139.59.182.62... Connected to mail.example.org. Escape character is '^]'. 220 example.org ESMTP Postfix ehlo mail.example.org 250-example.org 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH PLAIN 250-AUTH=PLAIN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN MAIL FROM:<[email protected]> 250 2.1.0 Ok RCPT TO:<******@gmail.com> 454 4.7.1 <*******@gmail.com>: Relay access denied quit 221 2.0.0 Bye Connection closed by foreign host. 

/ var / log / maillog文件

 Aug 26 19:55:11 example postfix/smtpd[22132]: connect from example.org[00.00.00.00] Aug 26 19:55:22 example postfix/smtpd[22132]: warning: example.org[00.00.00.00]: SASL plain authentication failed: another step is needed in authentication Aug 26 19:55:40 example postfix/smtpd[22132]: disconnect from example.org[00.00.00.00] Aug 26 19:55:42 example postfix/smtpd[22132]: connect from example.org[00.00.00.00] Aug 26 19:56:25 example postfix/smtpd[22132]: NOQUEUE: reject: RCPT from example.org[00.00.00.00]: 454 4.7.1 <*******@gmail.com>: Relay access denied; from=<******@example.org> to=<*******@gmail.com> proto=ESMTP helo=<mail.domain.org> Aug 26 19:56:30 example postfix/smtpd[22132]: disconnect from example.org[00.00.00.00] Aug 26 19:59:50 example postfix/anvil[22134]: statistics: max connection rate 2/60s for (submission:00.00.00.00) at Aug 26 19:55:11 Aug 26 19:59:50 example postfix/anvil[22134]: statistics: max connection count 1 for (submission:00.00.00.00) at Aug 26 19:54:29 Aug 26 19:59:50 example postfix/anvil[22134]: statistics: max cache size 1 at Aug 26 19:54:29 

configuration文件:

[main.cf]

  myorigin = domain1.org myhostname = domain2.org inet_protocols = all mydestination = mail.domain1.org, domain1 relay_domains = domain2 alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases virtual_alias_domains = domain1.org domain2.org virtual_alias_maps = hash:/etc/postfix/virtual smtpd_use_tls = yes smtpd_tls_auth_only = no smtpd_tls_key_file = /etc/postfix/ssl/ssl.key smtpd_tls_cert_file = /etc/postfix/ssl/ssl.crt smtpd_tls_CAfile = /etc/postfix/ssl/interm.crt smtpd_tls_loglevel = 1 smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtpd_tls_received_header = yes smtpd_tls_session_cache_timeout = 3600s tls_random_source = dev:/dev/urandom smtpd_sasl_auth_enable = yes smtp_sasl_auth_enable = yes smtpd_tls_protocols = !SSLv2, !SSLv3 smtpd_sasl_local_domain = smtpd_delay_reject = yes broken_sasl_auth_clients = yes smtpd_recipient_restrictions = reject_invalid_hostname,permit_sasl_authenticated, reject_unknown_recipient_domain, reject_unauth_destination, reject_rbl_client sbl.spamhaus.org, permit smtpd_helo_restrictions = reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname, reject_unknown_helo_hostname mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all smtp_tls_security_level = may smtp_tls_note_starttls_offer = yes 

[master.cf]

  smtp inet n - n - - smtpd #smtp inet n - n - 1 postscreen #smtpd pass - - n - - smtpd #dnsblog unix - - n - 0 dnsblog #tlsproxy unix - - n - 0 tlsproxy submission inet n - n - - smtpd # -o syslog_name=postfix/submission # -o smtpd_tls_security_level=encrypt # -o smtpd_sasl_auth_enable=yes # -o smtpd_reject_unlisted_recipient=no # -o smtpd_client_restrictions=$mua_client_restrictions # -o smtpd_helo_restrictions=$mua_helo_restrictions # -o smtpd_sender_restrictions=$mua_sender_restrictions -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject # -o milter_macro_daemon_name=ORIGINATING #smtps inet n - n - - smtpd # -o syslog_name=postfix/smtps # -o smtpd_tls_wrappermode=yes # -o smtpd_sasl_auth_enable=yes # -o smtpd_reject_unlisted_recipient=no # -o smtpd_client_restrictions=$mua_client_restrictions # -o smtpd_helo_restrictions=$mua_helo_restrictions # -o smtpd_sender_restrictions=$mua_sender_restrictions # -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject # -o milter_macro_daemon_name=ORIGINATING 

如果你需要任何细节,请让我知道。 我被卡住了。 尝试了不同的方法,从不同的教程,但没有太大的帮助。

哦,亲爱的神,不要试图用telnet与TLS谈判! 你必须手工完成密钥交换和所有其他TLSfunction。 那就是疯狂。 您目前失败,因为ehlo mail.example.orgehlo mail.example.org的适当部分。

如果你想testingsmtp starttls,请特别使用openssl
openssl s_client -connect <server>:587 -starttls smtp