
Flurdy의 지침을 사용하여 AWS EC2에 메일 서버를 설정했습니다.http://flurdy.com/docs/postfix/대부분 잘 됐어요.
내 문제는 SSL에서 465 대신 TLS에서 SMTP 포트 587을 사용하는 것을 선호한다는 것입니다. 포트 465는 미래 보장이 아닌 것으로 간주되므로 이것이 관련 요구 사항이라고 생각합니다.
Flurdy 사이트의 지침은 두 가지를 모두 허용하도록 설계되었지만 587을 작동시킬 수는 없습니다! SSL을 사용하는 465는 매력적입니다.
또한 이 빌드는 MySQL과 함께 sasl을 사용한다는 점을 언급해야 하며 이것이 오류를 Google에서 찾을 때 많은 도움을 찾지 못한 이유라고 생각합니다. 나는 오류가 SASL/PAM 분야 어딘가에 있다고 생각하지만 운이 없었습니다.
다음은 일부 로그 출력입니다.
메일.로그
postfix/smtpd[11328]: connect from MY.ISP.PROVIDER[MY.IP.0.0]
postfix/smtpd[11328]: Anonymous TLS connection established from MY.ISP.PROVIDER[MY.IP.0.0]: TLSv1.2 with cipher AES128-SHA256 (128/128 bits)
postfix/smtpd[11328]: warning: SASL authentication failure: client response doesn't match what we generated (tried bogus)
postfix/smtpd[11328]: warning: MY.ISP.PROVIDER[MY.IP.0.0]: SASL DIGEST-MD5 authentication failed: authentication failure
postfix/smtpd[11328]: warning: SASL authentication failure: cannot connect to saslauthd server: No such file or directory
postfix/smtpd[11328]: warning: MY.ISP.PROVIDER[MY.IP.0.0]: SASL LOGIN authentication failed: generic failure
postfix/smtpd[11328]: lost connection after AUTH from MY.ISP.PROVIDER[MY.IP.0.0]
postfix/smtpd[11328]: disconnect from MY.ISP.PROVIDER[MY.IP.0.0]*
나의 주인님.cf
submission inet n - n - - smtpd
-o smtpd_sasl_auth_enable=yes
-o smtpd_tls_auth_only=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject_unauth_destination,reject
-o smtpd_sasl_security_options=noanonymous,noplaintext
-o smtpd_sasl_tls_security_options=noanonymous
smtps inet n - - - - smtpd
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_tls_auth_only=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o smtpd_sasl_security_options=noanonymous,noplaintext
-o smtpd_sasl_tls_security_options=noanonymous
AMAVIS와 같은 다른 conf도 있지만 이것이 모두 괜찮은 것 같습니다.
SQL 로그에는 올바르게 작동하는 모든 연결과 쿼리가 표시됩니다.
테스트를 위해 TELNET을 사용했으며 포트 587로 인증을 시도하면 연결이 닫힙니다. 서버에서 포트 25를 열면 성공적인 인증 로그인을 완료할 수 있습니다.
25(열려 있는 경우)와 587의 EHLO 응답 차이는 다음과 같습니다. 587에는 AUTH가 포함되지 않은 것으로 나타났습니다. 이게 문제인가요??
$ telnet my.mailserver.com 587
Trying MY.IP.0.0...
Connected to my.mailserver.com.
Escape character is '^]'.
220 MY-EC2-SERVER-NAME.localdomain ESMTP Postfix
EHLO my.mailserver.com
250-MY-EC2-SERVER-NAME.localdomain
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
$ telnet my.mailserver.com 25
Trying MY.IP.0.0...
Connected to my.mailserver.com.
Escape character is '^]'.
220 MY-EC2-SERVER-NAME.localdomain ESMTP Postfix
EHLO my.mailserver.com
250-MY-EC2-SERVER-NAME.localdomain
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN CRAM-MD5 DIGEST-MD5
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
나는 서비스 postfix와 saslauthd를 여러 번 다시 시작했습니다. 또한 DB의 비밀번호와 사용자 이름을 두 번 확인했습니다. 지침을 검토하고 구성 오류와 철자 오류가 있는지 확인했습니다. 결국에는 이렇게 될 것 같습니다. :-)
서버는 UBUNTU 13.10입니다.
디버깅에 도움이 되는 추가 정보를 제공할 수 있으면 알려주시기 바랍니다.
모든 생각을 환영합니다!
답변1
나도 팔로우했다Flurdy의 튜토리얼비슷한 문제가 있었습니다. 포트 25(smtpd)를 통해서만 메일을 보낼 수 있었고 587(제출)을 통해서는 보낼 수 없었습니다. 나는 그의 지시에 따라 포트 25가 chroot에서 실행되도록 구성되었지만 587은 그렇지 않다는 것이 정확히 문제라는 것을 발견했습니다. 튜토리얼의 오류인 것 같습니다. flurdy의 지침 중 다음 부분을 확인하세요.
기본적으로 일반 smtp 서비스만 활성화되어 있으므로 괜찮습니다. 하지만 저는 클라이언트가 이를 사용할 수 있도록 제출(포트 587)을 활성화하고 TLS로만 제한할 수 있도록 하는 것을 선호합니다. 일부 이전 클라이언트(Outlook Express 등)와의 일부 호환성을 위해 smtps 서비스(포트 465)도 활성화되었습니다.
이 텍스트 바로 아래에서 제출 포트에 대한 데몬이 chroot를 사용하지 않는다는 내용의 줄을 찾을 수 있습니다.
submission inet n - n - - smtpd
/etc/postfix/master.cf
내 원본 파일에 다음 범례를 보여주는 주석이 있었기 때문에 이 사실을 알고 있습니다 .
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
제출 포트에 대한 옵션 목록 바로 아래에는 smtps(포트 465)를 구성하는 다음 줄이 있습니다.
smtps inet n - - - - smtpd
여기에서 기본값을 사용하고 있음을 알 수 있습니다(기호는 -
chroot를 사용하는 기본값을 사용한다는 의미인 것 같습니다).
좋습니다. SASL 인증 섹션을 보면 다음과 같이 나와 있습니다.
SASLAUTHD 실행 방법을 변경합니다.
OPTIONS
변수에 다음 경로가 포함되어 있는 것을 볼 수 있습니다 .
# Switch this to be under postfix's spool
# And add -r so that the realm(domain) is part of the username
OPTIONS="-r -c -m /var/spool/postfix/var/run/saslauthd"
다시 한 번, 원래 주석을 달았던 /etc/default/saslauthd
파일의 도움을 받아 다음과 같은 명확한 설명을 기록했습니다.
# Other options (default: -c -m /var/run/saslauthd)
# Note: You MUST specify the -m option or saslauthd won't run!
#
# WARNING: DO NOT SPECIFY THE -d OPTION.
# The -d option will cause saslauthd to run in the foreground instead of as
# a daemon. This will PREVENT YOUR SYSTEM FROM BOOTING PROPERLY. If you wish
# to run saslauthd in debug mode, please run it by hand to be safe.
#
# See /usr/share/doc/sasl2-bin/README.Debian for Debian-specific information.
# See the saslauthd man page and the output of 'saslauthd -h' for general
# information about these options.
#
# Example for chroot Postfix users: "-c -m /var/spool/postfix/var/run/saslauthd"
# Example for non-chroot Postfix users: "-c -m /var/run/saslauthd"
#
# To know if your Postfix is running chroot, check /etc/postfix/master.cf.
# If it has the line "smtp inet n - y - - smtpd" or "smtp inet n - - - - smtpd"
# then your Postfix is running in a chroot.
# If it has the line "smtp inet n - n - - smtpd" then your Postfix is NOT
# running in a chroot.
OPTIONS="-r -c -m /var/spool/postfix/var/run/saslauthd"
내 변수가 chroot 사례를 명확하게 지정했기 때문에 chroot도 사용하도록 OPTIONS
제출 구성을 변경했습니다 . /etc/postfix/master.cf
서버를 다시 시작한 후 - 모든 서비스가 제대로 다시 시작되었는지 확인하기 위해 - 결과가 아주 좋아졌습니다. 이제 포트 25 또는 587을 통해 이메일을 보낼 수 있습니다.
그것이 당신에게도 도움이 되기를 바랍니다! 저도 이거 보느라 꽤 시간을 허비했어요...