새 Postfix 서버가 메일을 Office 365로 릴레이하지 않음, 상태=지연됨

새 Postfix 서버가 메일을 Office 365로 릴레이하지 않음, 상태=지연됨

장치에 문제가 있을 때 알림 이메일과 같은 메일을 보내기 위해 내부 호스트에 대한 메일 릴레이 역할을 하도록 새 Ubuntu 서버(18.04 LTS)를 구성하고 있습니다. 우리는 Office 365를 사용하므로 이를 통해 사내 장비 및 소프트웨어에서 이러한 종류의 메시지를 사서함으로 전달할 수 있습니다. 우리 조직에서는 수년 동안 Postfix를 사용하여 매우 간단하게 이 설정을 해왔습니다. 불행하게도 이를 설정한 직원은 오래전에 떠났고 구체적인 내용에 대한 문서를 찾을 수 없습니다. 그러나 내가 찾은 일부 정보에 따르면 구성이 그렇게 복잡할 필요는 없는 것 같습니다. 새 시스템에 Postfix를 설치하고, 기존 구성과 최대한 일치하도록 구성하려고 했습니다. /etc/postfix/main.cf익명화를 변경한 내 파일은 다음과 같습니다 .

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated     defer_unauth_destination
myhostname = myservername.domain.edu
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = myservername.domain.edu, localhost.domain.edu, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
message_size_limit = 10240000
permit_mynetworks = yes
mynetworks = 172.16.4.0/24, 172.16.5.0/24, 172.16.246.0/24, 192.168.90.0/24, 192.168.1.0/24, ###.###.103.0/24, ###.###.104.0/24, ###.###.106.0/24, ###.###.250.0/24, 10.19.64.0/27, 10.19.66.0/27, 10.19.68.0/27

이 새 서버에서 인터넷에 접속할 수 있고, 인터넷의 리소스를 ping할 수도 있지만 메일이 전송되지 않습니다. 메시지가 지연되고 연결 시간이 초과된다는 로그 항목이 계속 표시됩니다. 다음은 내 파일의 마지막 30줄입니다 /var/log/mail.log. 내가 보고 있는 메시지의 종류를 확인할 수 있습니다. 다시 한 번 내용을 익명으로 처리했습니다.

user@myservername:~$ tail -30 /var/log/mail.log
May 29 14:23:49 myservername postfix/smtp[3351]: warning: /etc/postfix/main.cf, line 49: overriding earlier entry: mynetworks=127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
May 29 14:24:19 myservername postfix/smtp[3349]: connect to subdomain.domain.edu[###.###.104.118]:25: Connection timed out
May 29 14:24:19 myservername postfix/smtp[3350]: connect to mxa-00246402.gslb.pphosted.com[148.163.147.197]:25: Connection timed out
May 29 14:24:19 myservername postfix/smtp[3351]: connect to subdomain.domain.edu[###.###.104.154]:25: Connection timed out
May 29 14:24:19 myservername postfix/smtp[3351]: connect to subdomain.domain.edu[###.###.104.57]:25: Connection refused
May 29 14:24:19 myservername postfix/smtp[3351]: connect to subdomain.domain.edu[###.###.103.6]:25: Connection refused
May 29 14:24:19 myservername postfix/smtp[3351]: connect to subdomain.domain.edu[###.###.250.72]:25: Connection refused
May 29 14:24:49 myservername postfix/smtp[3350]: connect to mxb-00246402.gslb.pphosted.com[148.163.143.147]:25: Connection timed out
May 29 14:24:49 myservername postfix/smtp[3349]: connect to subdomain.domain.edu[###.###.103.43]:25: Connection timed out
May 29 14:24:49 myservername postfix/bounce[3357]: warning: /etc/postfix/main.cf, line 49: overriding earlier entry: mynetworks=127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
May 29 14:24:49 myservername postfix/smtp[3351]: connect to subdomain.domain.edu[###.###.103.43]:25: Connection timed out
May 29 14:24:49 myservername postfix/bounce[3358]: warning: /etc/postfix/main.cf, line 49: overriding earlier entry: mynetworks=127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
May 29 14:24:49 myservername postfix/smtp[3350]: 35A96120180: to=<[email protected]>, relay=none, delay=631, delays=571/0.03/60/0, dsn=4.4.1, status=deferred (connect to mxb-00246402.gslb.pphosted.com[148.163.143.147]:25: Connection timed out)
May 29 14:24:49 myservername postfix/smtp[3351]: 4047E12083C: to=<[email protected]>, relay=none, delay=431116, delays=431056/0.04/60/0, dsn=4.4.1, status=deferred (connect to subdomain.domain.edu[###.###.103.43]:25: Connection timed out)
May 29 14:25:19 myservername postfix/smtp[3349]: connect to subdomain.domain.edu[###.###.104.154]:25: Connection timed out
May 29 14:25:19 myservername postfix/smtp[3349]: 68665120733: to=<[email protected]>, relay=none, delay=434852, delays=434761/0.06/90/0, dsn=4.4.1, status=deferred (connect to subdomain.domain.edu[###.###.104.154]:25: Connection timed out)
May 29 14:25:19 myservername postfix/qmgr[1688]: 68665120733: from=<[email protected]>, status=expired, returned to sender
May 29 14:25:19 myservername postfix/cleanup[3365]: warning: /etc/postfix/main.cf, line 49: overriding earlier entry: mynetworks=127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
May 29 14:25:19 myservername postfix/cleanup[3365]: CE1B8124492: message-id=<[email protected]>
May 29 14:25:19 myservername postfix/bounce[3357]: 68665120733: sender non-delivery notification: CE1B8124492
May 29 14:25:19 myservername postfix/qmgr[1688]: CE1B8124492: from=<>, size=2844, nrcpt=1 (queue active)
May 29 14:25:19 myservername postfix/qmgr[1688]: 68665120733: removed
May 29 14:25:49 myservername postfix/smtp[3350]: connect to mxa-00246402.gslb.pphosted.com[148.163.147.197]:25: Connection timed out
May 29 14:26:19 myservername postfix/smtp[3350]: connect to mxb-00246402.gslb.pphosted.com[148.163.147.197]:25: Connection timed out
May 29 14:26:19 myservername postfix/smtp[3350]: CE1B8124492: to=<[email protected]>, relay=none, delay=60, delays=0.03/0/60/0, dsn=4.4.1, status=deferred (connect to mxb-00246402.gslb.pphosted.com[148.163.147.197]:25: Connection timed out)
May 29 14:28:49 myservername postfix/qmgr[1688]: 8F7B51200D6: from=<>, size=2838, nrcpt=1 (queue active)
May 29 14:28:49 myservername postfix/trivial-rewrite[3378]: warning: /etc/postfix/main.cf, line 49: overriding earlier entry: mynetworks=127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
May 29 14:28:49 myservername postfix/qmgr[1688]: 92033120E39: from=<>, size=2836, nrcpt=1 (queue active)
May 29 14:28:49 myservername postfix/smtp[3379]: warning: /etc/postfix/main.cf, line 49: overriding earlier entry: mynetworks=127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
May 29 14:28:49 myservername postfix/smtp[3380]: warning: /etc/postfix/main.cf, line 49: overriding earlier entry: mynetworks=127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

호스트 자체에는 방화벽이 구성되거나 실행되고 있지 않으며, 네트워크 엔지니어와의 대화에 따르면 이 트래픽을 차단하는 것이 없어야 합니다. 하지만 기존 서버에서 내 조직의 MX 레코드에 나열된 Office 365 메일 서버 이름(포트 25)으로 텔넷을 통해 응답을 받고 'helo'를 보내는 등의 작업을 수행할 수 있습니다. 이 새로운 서버에서. 내 네트워크 엔지니어는 방화벽에 나가는 트래픽을 차단하는 것이 아무것도 없다고 확신하며 이 문제를 해결하는 데 도움을 주려고 노력했지만 문제의 원인을 나타내는 어떤 것도 보지 못했습니다. 내가 놓칠 수 있는 다른 것이 무엇인지 잘 모르겠습니다. 어떤 도움이라도 대단히 감사하겠습니다.

답변1

SMTP-릴레이를 구성하려면 일부 sasl 인증 항목과 함께 릴레이 호스트를 정의해야 합니다.

이러한 구성 항목을 main.cf 끝에 추가하시겠습니까?

smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
relayhost = your.office365.relayhost
smtp_tls_security_level = may

[smtp.office365.com]:587분명히 실제 호스트 이름으로 "your.office365.relayhost"를 변경해야 합니다( 다음 링크에 따라야 함 :https://secopsmonkey.com/mail-relaying-postfix-through-office-365.html

sasl_password 파일은 링크된 튜토리얼에도 설명되어 있습니다. 다음과 같아야 합니다.

[smtp.office365.com]:587 [email protected]:soopersekretPassvv0rd

그리고 로 포스트맵을 작성해야 합니다 postmap hash:/etc/postfix/sasl_passwd. 그 후에는 postfix를 다시 시작해야 합니다 systemctl restart postfix.service.

저는 Office 365에 익숙하지 않지만 MS Exchange Server를 통해 릴레이하려면 다른 포트를 시도해야 하는 것이 일반적입니다.

도움이 되었기를 바랍니다!

관련 정보