첫째, 포트 25는 열려 있지만 외부 연결을 허용하지 않습니다.

첫째, 포트 25는 열려 있지만 외부 연결을 허용하지 않습니다.

나는 이것이 두 가지 전형적인 문제라고 생각합니다. 적어도 첫 번째 문제는 그렇습니다. CentOS 7에서 postfix dovecot을 구성하려고 합니다.

첫째, 포트 25는 열려 있지만 외부 연결을 허용하지 않습니다.

포트 25의 내부 연결이 작동 중입니다. 나는 그랬다:

[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.

그런 다음 다음에서 Dovecot 서버를 확인했습니다 /var/mail/vhosts/xxxx.com/user1.

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

따라서 일반적인 SMTP(포트 25)의 경우 내 구성이 완전히 정확합니다. 그런데 문제는 보내거나 텔넷으로 보내려고 해도 아무 반응이 없다는 것입니다. 로그 문서가 비어 있습니다. 그래서 시도했는데 tcpdump -i any port smtp포트 25가 전혀 열리지 않는다는 메시지가 나타납니다.

그래서 이것은 포트 25가 수신을 차단하는 전형적인 Linux 오류인 것 같습니다. 혹시 뭔지 아시는 분 알려주세요.

둘째, 포트 465가 작동하지 않습니다.

postfix가 잘못된 구성으로 인해 이를 수신하지 않거나 내 Linux 내부의 무언가에 의해 포트 465에서 차단된 것 같습니다. (또는 SSL이 올바르지 않을 수도 있습니다)

나는 내 자신의 PC에서 시도 tcpdump -i any port smtps하고 해냈습니다 .telnet mail.xxxx.com smtps

서버는 포트 465가 패킷을 수신했다고 표시합니다. 그러나 postfix는 아무 반응도 하지 않습니다.

그래서 의 메일로그를 살펴보니 /var/log/maillogpostfix가 내 텔넷 연결을 전혀 인식하지 못하고 응답하지 않았음을 알 수 있습니다. 로그는 다음과 같습니다.

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

그냥 아무것도 아닙니다. 그래서 나는 '실제로' smtp 포트를 듣는 서비스를 차단하는 Linux의 일부 설정이나 방화벽이 있다고 생각합니다. 누구든지 이것을 아는가?

그런 다음 포트 465의 localhost에서 텔넷을 시도했지만 포트 465의 내부 연결도 작동하지 않는 것 같습니다.

내 서버에서는 다음을 수행했습니다.

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

'안녕하세요' 이후에 막 닫혔어요. 그런 다음 다시 갔는데 /var/log/maillog다음과 같이 표시됩니다.

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]

내 구성 파일은 다음과 같습니다.

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

부분의/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

부분의/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

답변1

위 @HBruijn의 의견 덕분에 이 문제를 해결했습니다. 문제는 내가 두 개의 inet_interfaces.

한 가지 중요한 점은 현재 postfix 구성 파일에서 이 inet_interfaces = localhost값이 기본값이고 기본값으로 주석 처리되지 않은 것처럼 보인다는 것입니다. 그러나 inet_interfaces = all댓글이 달렸습니다. 따라서 inet_interfaces = localhost의 주석을 해제할 때 에 주석을 달아야 합니다 inet_interfaces = all.

파일은 다음과 같습니다: /etc/postfix/master.cf.

관련 정보