У меня возникла проблема, когда я не могу отправлять почту через SMTP, используя, например, Thunderbird, но локально с машины отправка почты работает отлично. Почтовый сервер настроен, также dovecot - он работает нормально и spamassassin - также работает нормально. Я, наверное, упускаю что-то очевидное, но не могу этого найти.
В журналах я получил это при попытке отправить почту через Thunderbird на удаленном хосте:
May 22 14:06:16 d7205 postfix/smtpd[11560]: setting up TLS connection from unknown[x.y.z.c] May 22 14:06:16 d7205 postfix/smtpd[11560]: Anonymous TLS connection established from unknown[x.y.z.c]: TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits) May 22 14:06:17 d7205 postfix/smtpd[11560]: NOQUEUE: reject: RCPT from unknown[x.y.z.c]: 554 5.7.1 : Relay access denied; from= to= proto=ESMTP helo= May 22 14:06:18 d7205 postfix/smtpd[11560]: disconnect from unknown[x.y.z.c]
Текущая конфигурация постфикса (postfix -n):
alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases bounce_queue_lifetime = 2d broken_sasl_auth_clients = yes command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix debug_peer_level = 2 home_mailbox = Maildir/ html_directory = no inet_interfaces = all inet_protocols = ipv4 mail_owner = postfix mail_spool_directory = /var/spool/mail mailbox_size_limit = 256000000 mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man maximal_queue_lifetime = 3d mydestination = pcre:/etc/postfix/mydomains mydomain = domain.tld myhostname = domain.tld mynetworks = 192.168.1.0/24, 127.0.0.0/8 myorigin = $mydomain newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix queue_run_delay = 30s readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES recipient_delimiter = + relay_domains = $mydestination sample_directory = /usr/share/doc/postfix-2.6.6/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop smtp_sasl_security_options = noplaintext, noanonymous smtp_tls_cert_file = /etc/pki/tls/certs/postfix.crt smtp_tls_key_file = /etc/pki/tls/certs/postfix.key smtp_tls_note_starttls_offer = yes smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache smtp_use_tls = yes smtpd_banner = $myhostname ESMTP smtpd_recipient_restrictions = reject_unauth_destination, permit smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = $myhostname smtpd_sasl_path = private/auth smtpd_sasl_security_options = noanonymous smtpd_sasl_type = dovecot smtpd_sender_restrictions = permit_sasl_authenticated, reject_unknown_sender_domain, reject_non_fqdn_sender, reject_unknown_address, permit smtpd_tls_auth_only = no smtpd_tls_cert_file = /etc/pki/tls/certs/postfix.crt smtpd_tls_key_file = /etc/pki/tls/certs/postfix.key smtpd_tls_loglevel = 1 smtpd_tls_received_header = yes smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache smtpd_tls_session_cache_timeout = 3600s smtpd_use_tls = yes tls_random_source = dev:/dev/urandom unknown_local_recipient_reject_code = 550
и maste.cf выглядит так:
smtp inet n - - - - smtpd submission inet n - n - - smtpd # -o smtpd_tls_security_level=encrypt # -o smtpd_sasl_auth_enable=yes # -o smtpd_client_restrictions=permit_sasl_authenticated,reject # -o milter_macro_daemon_name=ORIGINATING -o content_filter=spamassassin smtps inet n - - - - smtpd # -o smtpd_tls_wrappermode=yes # -o smtpd_sasl_auth_enable=yes # -o smtpd_client_restrictions=permit_sasl_authenticated,reject # -o milter_macro_daemon_name=ORIGINATING #628 inet n - n - - qmqpd pickup fifo n - n 60 1 pickup cleanup unix n - n - 0 cleanup qmgr fifo n - n 300 1 qmgr #qmgr fifo n - n 300 1 oqmgr tlsmgr unix - - n 1000? 1 tlsmgr rewrite unix - - n - - trivial-rewrite bounce unix - - n - 0 bounce defer unix - - n - 0 bounce trace unix - - n - 0 bounce verify unix - - n - 1 verify flush unix n - n 1000? 0 flush proxymap unix - - n - - proxymap proxywrite unix - - n - 1 proxymap smtp unix - - n - - smtp # When relaying mail as backup MX, disable fallback_relay to avoid MX loops relay unix - - n - - smtp -o smtp_fallback_relay= # -o smtp_helo_timeout=5 -o smtp_connect_timeout=5 showq unix n - n - - showq error unix - - n - - error retry unix - - n - - error discard unix - - n - - discard local unix - n n - - local virtual unix - n n - - virtual lmtp unix - - n - - lmtp anvil unix - - n - 1 anvil scache unix - - n - 1 scache dovecot unix - n n - - pipe flags=DRhu argv=/usr/lib/dovecot/deliver -d ${recipient} spamassassin unix - n n - - pipe user=spamd argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}
Проблема заключалась в том, что у меня не было этих конкретных настроек в конфигурации постфикса:
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, check_relay_domains