Erstens ist der Port 25 geöffnet, akzeptiert aber keine externen Verbindungen.

Erstens ist der Port 25 geöffnet, akzeptiert aber keine externen Verbindungen.

Ich vermute, das sind zwei typische Probleme, zumindest das erste. Ich versuche, Postfix Dovecot auf CentOS 7 zu konfigurieren.

Erstens ist der Port 25 geöffnet, akzeptiert aber keine externen Verbindungen.

Die interne Verbindung an Port 25 funktioniert. Ich habe Folgendes gemacht:

[root@myhost ~]# telnet localhost smtp
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 xxxx.com ESMTP Postfix (CentOS)
helo xxxx
250 xxxx.com
mail from:<[email protected]>
250 2.1.0 Ok
rcpt to:<[email protected]>
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
from:[email protected]
to:[email protected]
subject:Testing email
test test
.
250 2.0.0 Ok: queued as CBE5F6039
quit
221 2.0.0 Bye
Connection closed by foreign host.

Dann habe ich meinen Dovecot-Server unter folgender Adresse überprüft /var/mail/vhosts/xxxx.com/user1:

./new
./new/1693231789.M572537P2155.xxxx,S=495,W=510

Für typisches SMTP (Port 25) ist meine Konfiguration also völlig korrekt. Das Problem ist jedoch, dass keine Reaktion erfolgt, wenn ich versuche, es zu versenden oder per Telnet zu verwenden. Das Protokolldokument ist leer. Also habe ich es versucht tcpdump -i any port smtpund es zeigt mir an, dass Port 25 überhaupt nicht geöffnet wird.

Ich vermute, dass es sich hier nur um einen typischen Linux-Fehler handelt, der den Port 25 daran hindert, zuzuhören. Bitte sagen Sie mir, wenn jemand weiß, was es ist.

Zweitens funktioniert Port 465 nicht.

scheint, als würde Postfix entweder aufgrund einer Fehlkonfiguration nicht darauf hören oder durch etwas in meinem Linux von Port 465 blockiert. (Oder vielleicht ist SSL falsch)

Ich habe es auf meinem eigenen PC versucht tcpdump -i any port smtpsund es funktioniert .telnet mail.xxxx.com smtps

Der Server zeigt mir an, dass Port 465 das Paket empfangen hat. Das Postfix antwortet jedoch nicht.

Ich habe mir also das Maillog unter angesehen /var/log/maillogund es zeigt, dass Postfix meine Telnet-Verbindung überhaupt nicht erkannt und nicht darauf reagiert hat. Hier ist das Log:

Aug 28 13:42:37 xxxx postfix/postfix-script[1692]: starting the Postfix mail system
Aug 28 13:42:37 xxxx postfix/master[1694]: daemon started -- version 2.10.1, configuration /etc/postfix

Einfach nichts. Ich vermute also, dass es unter Linux einige Einstellungen oder Firewalls gibt, die verhindern, dass Dienste „tatsächlich“ auf den SMTP-Port hören. Kennt das jemand?

Dann habe ich versucht, vom lokalen Host über Port 465 eine Telnet-Verbindung herzustellen, aber anscheinend funktioniert auch die interne Verbindung über Port 465 nicht.

Auf meinem Server habe ich Folgendes getan:

[root@myhost ~]# telnet localhost smtps
Trying ::1...
Connected to localhost.
Escape character is '^]'.
helo xxxx
Connection closed by foreign host.

Es wurde einfach nach „Hallo“ geschlossen. Dann bin ich noch einmal hingegangen /var/log/maillogund es zeigt Folgendes:

Aug 28 13:45:57 xxxx postfix/smtps/smtpd[1974]: connect from unknown[::1]
Aug 28 13:46:01 xxxx postfix/smtps/smtpd[1974]: SSL_accept error from unknown[::1]: -1
Aug 28 13:46:01 xxxx postfix/smtps/smtpd[1974]: warning: TLS library problem: 1974:error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol:s23_srvr.c:640:
Aug 28 13:46:01 xxxx postfix/smtps/smtpd[1974]: lost connection after CONNECT from unknown[::1]
Aug 28 13:46:01 xxxx postfix/smtps/smtpd[1974]: disconnect from unknown[::1]

Hier sind meine Konfigurationsdateien.

sudo postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = no
inet_interfaces = localhost
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = localhost, localhost.$mydomain
mydomain = xxxx.com
myhostname = xxxx.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
recipient_delimiter = +
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_tls_security_level = may
smtpd_banner = $myhostname ESMTP $mail_name (CentOS)
smtpd_sasl_security_options = noanonymous, noplaintext
smtpd_sasl_tls_security_options = noanonymous
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/letsencrypt/live/xxxx.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/xxxx.com/privkey.pem
smtpd_tls_security_level = may
smtpd_use_tls = yes
unknown_local_recipient_reject_code = 550
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp

Teil von/etc/postfix/main.cf

mail_owner = postfix
myhostname = xxxx.com
mydomain = xxxx.com

# TLS parameters
smtpd_tls_cert_file=/etc/letsencrypt/live/xxxx,com/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/xxxx.com/privkey.pem
smtpd_use_tls=yes
smtpd_tls_auth_only = yes
smtp_tls_security_level = may
smtpd_tls_security_level = may
smtpd_sasl_security_options = noanonymous, noplaintext
smtpd_sasl_tls_security_options = noanonymous

inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
inet_interfaces = localhost
# Enable IPv4, and IPv6 if supported
inet_protocols = all

mydestination = localhost, localhost.$mydomain

virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
recipient_delimiter = +
virtual_transport = lmtp:unix:private/dovecot-lmtp

Teil von/etc/postfix/master.cf

smtp      inet  n       -       n       -       1       postscreen
#smtpd     pass  -       -       n       -       -       smtpd
#dnsblog   unix  -       -       n       -       0       dnsblog
#tlsproxy  unix  -       -       n       -       0       tlsproxy
submission inet n       -       -       -       -       smtpd
  -o syslog_name=postfix/submission
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_sasl_type=dovecot
  -o smtpd_sasl_path=private/auth
  -o smtpd_reject_unlisted_recipient=no
  #-o smtpd_client_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING
465     inet  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_sasl_type=dovecot
  -o smtpd_sasl_path=private/auth
  #-o smtpd_client_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING

Antwort1

Dank der Kommentare von @HBruijn oben konnte ich dieses Problem lösen. Das Problem ist, dass ich zwei konfiguriert habe inet_interfaces.

Eine wertvolle Sache ist, dass es in der aktuellen Postfix-Konfigurationsdatei so aussieht, als inet_interfaces = localhostwäre dies ein Standardwert und unkommentiert als Standard. Allerdings inet_interfaces = allist kommentiert. Daher müssen Sie dies kommentieren, inet_interfaces = localhostwenn Sie dies auskommentieren inet_interfaces = all.

Die Datei ist: /etc/postfix/master.cf.

verwandte Informationen