dovecot이 죽으면 postfix가 메일을 못 받아요.

시지프스의 이미지

제목 그대로 dovecot이 죽으면 postfix가 메일을 거부하네요.
다른 서버에서 postfix가 작동하는 서버로 보내는 메일을 못 받습니다.

특징은 hostname이 없고, 외부에서는 ip를 직접 쳐서 전송합니다.

postfix 설정을

myhostname = gajja.domain # 가짜 주소입니다. (진짜가 없습니다.)
# gajja.domain의 IP는 정상인데, 보안상 555.555.555.555로 적겠습니다.
mydomain = domain # 이건 진짜 도메인입니다.
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks_style = host
relay_domains = $mydestination, hash:/etc/postfix/relay
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination, permit_sasl_authenticated, reject_unauth_destination

이렇게 해두었습니다. 그러면 permit_auth_destination 때문에
destination이 555.555.555.555인 경우에는
sasl과는 관계 없이 받아야 하지 않나요?

물론,

smtpd_sasl_auth_enable = no
smtpd_recipient_restrictions = permit_mynetworks,reject_unauth_destination

로 설정해두면, 메일을 제대로 받습니다.

디버그 모드를 켜고 로그를 보면

Apr 17 14:33:16 ssl postfix/smtpd[10452]: mynetworks: 127.0.0.1/32 127.0.0.2/32 <555.555.555.555> [::1]/128 [서버ip6]/128

이렇게 mynetworks는 잘 나오는 것 같습니다.

그리고 다른 서버가 접속하는 부분입니다.

Apr 17 14:33:16 ssl postfix/smtpd[10452]: connect from mail.domain[777.777.777.777] # 같은 도메인의 다른 메일 서버
Apr 17 14:33:16 ssl postfix/smtpd[10452]: match_list_match mail.domain: no match
Apr 17 14:33:16 ssl postfix/smtpd[10452]: match_list_match 777.777.777.777: no match
Apr 17 14:33:16 ssl postfix/smtpd[10452]: match_list_match mail.domain: no match
Apr 17 14:33:16 ssl postfix/smtpd[10452]: match_list_match 777.777.777.777: no match
Apr 17 14:33:16 ssl postfix/smtpd[10452]: match_hostname mai.domain ~? domain
Apr 17 14:33:16 ssl postfix/smtpd[10452]: match_hostname mai.domain ~? 127.0.0.1/32
Apr 17 14:33:16 ssl postfix/smtpd[10452]: match_hostaddr 777.777.777.777 ~? 127.0.0.1/32
Apr 17 14:33:16 ssl postfix/smtpd[10452]: match_hostname mai.domain ~? 127.0.0.2/32
Apr 17 14:33:16 ssl postfix/smtpd[10452]: match_hostaddr 777.777.777.777 ~? 127.0.0.2/32
Apr 17 14:33:16 ssl postfix/smtpd[10452]: match_hostname mai.domain ~? 555.555.555.555/32
Apr 17 14:33:16 ssl postfix/smtpd[10452]: match_hostaddr 777.777.777.777 ~? 555.555.555.555/32
Apr 17 14:33:16 ssl postfix/smtpd[10452]: match_list_match: mail.domain: no match
Apr 17 14:33:16 ssl postfix/smtpd[10452]: match_list_match: 777.777.777.777: no match
# 여기서 mathch는 sender만 처리합니다. destinaiton은 match 안 해봅니다.
Apr 17 14:33:16 ssl postfix/smtpd[10452]: auto_clnt_open: connected to private/anvil
Apr 17 14:33:16 ssl postfix/smtpd[10452]: event_enable_read: fd 22
Apr 17 14:33:16 ssl postfix/smtpd[10452]: event_extend: fd 22
Apr 17 14:33:16 ssl postfix/smtpd[10452]: send attr request = connect
Apr 17 14:33:16 ssl postfix/smtpd[10452]: send attr ident = smtp:***
Apr 17 14:33:16 ssl postfix/smtpd[10452]: vstream_fflush_some: fd 22 flush 41
Apr 17 14:33:16 ssl postfix/smtpd[10452]: vstream_buf_get_ready: fd 22 got 25
Apr 17 14:33:16 ssl postfix/smtpd[10452]: private/anvil: wanted attribute: status
Apr 17 14:33:16 ssl postfix/smtpd[10452]: input attribute name: status
Apr 17 14:33:16 ssl postfix/smtpd[10452]: input attribute value: 0
Apr 17 14:33:16 ssl postfix/smtpd[10452]: private/anvil: wanted attribute: count
Apr 17 14:33:16 ssl postfix/smtpd[10452]: input attribute name: count
Apr 17 14:33:16 ssl postfix/smtpd[10452]: input attribute value: 1
Apr 17 14:33:16 ssl postfix/smtpd[10452]: private/anvil: wanted attribute: rate
Apr 17 14:33:16 ssl postfix/smtpd[10452]: input attribute name: rate
Apr 17 14:33:16 ssl postfix/smtpd[10452]: input attribute value: 1
Apr 17 14:33:16 ssl postfix/smtpd[10452]: private/anvil: wanted attribute: (list terminator)
Apr 17 14:33:16 ssl postfix/smtpd[10452]: input attribute name: (end)
Apr 17 14:33:16 ssl postfix/smtpd[10452]: > mail.domain[***]: 220 ***.domain ESMTP Postfix
Apr 17 14:33:16 ssl postfix/smtpd[10452]: xsasl_dovecot_server_create: SASL service=smtp, realm=(null)
Apr 17 14:33:16 ssl postfix/smtpd[10452]: name_mask: noanonymous
Apr 17 14:33:16 ssl postfix/smtpd[10452]: xsasl_dovecot_server_connect: Connecting
Apr 17 14:33:16 ssl postfix/smtpd[10452]: warning: SASL: Connect to private/auth failed: No such file or directory
Apr 17 14:33:16 ssl postfix/smtpd[10452]: fatal: no SASL authentication mechanisms
Apr 17 14:33:17 ssl postfix/master[10429]: warning: process /usr/lib/postfix/smtpd pid 10452 exit status 1
Apr 17 14:33:17 ssl postfix/master[10429]: warning: /usr/lib/postfix/smtpd: bad command startup -- throttling

이런 식으로 나오는데, permit_auth_destination에서 먼저 처리되는 부분은 안 보이고, 바로 sasl을 시도하다가 실패합니다.

궁금한 것은
smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination, permit_sasl_authenticated, reject_unauth_destination
라고 적었으면, permit_auth_destination이 먼저 처리되어야 하는거 아니냐는 것입니다.