Postfix 3.5.6 업그레이드 후 여러 수신자에 대한 가상 별칭 매핑은 쉼표가 포함된 단일 이름으로 처리됩니다.

Postfix 3.5.6 업그레이드 후 여러 수신자에 대한 가상 별칭 매핑은 쉼표가 포함된 단일 이름으로 처리됩니다.

방금 debian wheezy postfix 2.9.6에서 debian Bullseye postfix 3.5.6으로 업그레이드했습니다.

우리는 다음과 같이 여러 수신자에게 가상 앨리어스 맵을 사용합니다.

[이메일 보호됨]@theidsp-network.inter-realm.net,[이메일 보호됨]

이로써 보낸 메일은[이메일 보호됨]둘 다에 전달됩니다 [이메일 보호됨]그리고[이메일 보호됨]. 수년간 올바르게 작동해 왔습니다.

우리는 이전에 배웠습니다.http://www.postfix.org/virtual.5.html여러 수신자의 순서가 중요합니다. "결과가 @otherdomain 형식인 경우 결과는 otherdomain의 동일한 사용자가 됩니다. 이는 다중 주소 조회 결과의 첫 번째 주소에 대해서만 작동합니다." 따라서 와일드카드 @수신자를 먼저 입력합니다.

postfix 업그레이드 후 smtpd가 단일 수신자에게 전달을 시도하는 것 같습니다."[이메일 보호됨],jim"@space-port-pros.com.

사용자가 존재하지 않기 때문에 이 메일은 포괄주소로 이동됩니다.

다음은 mail.log의 일부 출력입니다.

Apr 14 10:45:17 mail7-057 sslmx/smtpd[8640]: connect to subsystem private/proxymap
Apr 14 10:45:17 mail7-057 sslmx/smtpd[8640]: send attr request = lookup
Apr 14 10:45:17 mail7-057 sslmx/smtpd[8640]: send attr table = mysql:/etc/postfix/mysql-virtual_forwardings.cf
Apr 14 10:45:17 mail7-057 sslmx/smtpd[8640]: send attr flags = 540736
Apr 14 10:45:17 mail7-057 sslmx/smtpd[8640]: send attr key = [email protected]
Apr 14 10:45:17 mail7-057 sslmx/smtpd[8640]: private/proxymap socket: wanted attribute: status
Apr 14 10:45:17 mail7-057 sslmx/smtpd[8640]: input attribute name: status
Apr 14 10:45:17 mail7-057 sslmx/smtpd[8640]: input attribute value: 0
Apr 14 10:45:17 mail7-057 sslmx/smtpd[8640]: private/proxymap socket: wanted attribute: value
Apr 14 10:45:17 mail7-057 sslmx/smtpd[8640]: input attribute name: value
Apr 14 10:45:17 mail7-057 sslmx/smtpd[8640]: input attribute value: @theidsp-network.inter-realm.net,[email protected]
Apr 14 10:45:17 mail7-057 sslmx/smtpd[8640]: private/proxymap socket: wanted attribute: (list terminator)
Apr 14 10:45:17 mail7-057 sslmx/smtpd[8640]: input attribute name: (end)
Apr 14 10:45:17 mail7-057 sslmx/smtpd[8640]: dict_proxy_lookup: table=mysql:/etc/postfix/mysql-virtual_forwardings.cf flags=lock|fold_fix|utf8_request
 [email protected] -> status=0 [email protected],[email protected]
Apr 14 10:45:17 mail7-057 sslmx/smtpd[8640]: maps_find: virtual_alias_maps: proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf(0,lock|fold_fix|utf8
_request): [email protected] = @theidsp-network.inter-realm.net,[email protected]
Apr 14 10:45:17 mail7-057 sslmx/smtpd[8640]: mail_addr_find: [email protected] -> @theidsp-network.inter-realm.net,[email protected]
...
Apr 14 10:45:17 mail7-057 postfix/smtp[8669]: 55E65C895: to=<"[email protected],jim"@space-port-pros.com>, orig_to=<jimays@theids
p.net>, relay=mail7-052.idsp56.net[192.168.56.52]:52025, delay=0.06, delays=0.01/0.02/0.01/0.02, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 5F628
A882)

다음은 전달로 인해 이전에 status=sent인 두 개의 개별 라인이 생성되었음을 보여주는 6월의 로그 조각입니다. 하나는 smtp 전송을 통해 다음으로 전송되었습니다.[이메일 보호됨]하나는 lmtp-g 전송을 통해[이메일 보호됨].

Jun 20 06:30:58 mail7-057 sslmx/smtpd[28956]: connect from mail7-055.idsp56.net[192.168.56.55]
Jun 20 06:30:58 mail7-057 sslmx/smtpd[28956]: Anonymous TLS connection established from mail7-055.idsp56.net[192.168.56.55]: TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)
Jun 20 06:30:58 mail7-057 sslmx/smtpd[28956]: B91A42BE4: client=mail7-055.idsp56.net[192.168.56.55]
Jun 20 06:30:58 mail7-057 cleanup-srs/cleanup[28963]: B91A42BE4: message-id=<[email protected]>
Jun 20 06:30:58 mail7-057 postfix/qmgr[19327]: B91A42BE4: from=<SRS0=Z5tX=LO=connect.match.com=bounces-MA-1-858-ea0868c4-498f-401a-b6f1-c3ce593994a7@trumail7.inter-dimensional-space-port.net>, size=47942, nrcpt=2 (queue active)
Jun 20 06:30:58 mail7-057 sslmx/smtpd[28956]: disconnect from mail7-055.idsp56.net[192.168.56.55]
Jun 20 06:30:58 mail7-057 postfix/smtp[28966]: Anonymous TLS connection established to mail7-052.idsp56.net[192.168.56.52]:52025: TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)
Jun 20 06:30:58 mail7-057 lmtp-g/lmtp[28965]: Trusted TLS connection established to lmtp7-g.inter-dimensional-space-port.net[216.184.19.228]:64007: TLSv1 with cipher AES256-SHA (256/256 bits)
Jun 20 06:30:58 mail7-057 postfix/smtp[28966]: B91A42BE4: to=<[email protected]>, relay=mail7-052.idsp56.net[192.168.56.52]:52025, delay=0.16, delays=0.04/0.02/0.02/0.08, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as C66855B94)
Jun 20 06:30:59 mail7-057 sslmx/smtpd[28956]: connect from mail7-055.idsp56.net[192.168.56.55]
Jun 20 06:30:59 mail7-057 sslmx/smtpd[28956]: Anonymous TLS connection established from mail7-055.idsp56.net[192.168.56.55]: TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)
Jun 20 06:30:59 mail7-057 sslmx/smtpd[28956]: 9D1D12CA5: client=mail7-055.idsp56.net[192.168.56.55]
Jun 20 06:30:59 mail7-057 cleanup-srs/cleanup[28963]: 9D1D12CA5: message-id=<[email protected]>
Jun 20 06:30:59 mail7-057 postfix/qmgr[19327]: 9D1D12CA5: from=<SRS0=Z5tX=LO=connect.match.com=bounces-MA-1-858-ea0868c4-498f-401a-b6f1-c3ce593994a7@trumail7.inter-dimensional-space-port.net>, size=50423, nrcpt=1 (queue active)
Jun 20 06:30:59 mail7-057 sslmx/smtpd[28956]: disconnect from mail7-055.idsp56.net[192.168.56.55]
Jun 20 06:31:07 mail7-057 lmtp-g/lmtp[28965]: B91A42BE4: to=<[email protected]>, relay=lmtp7-g.inter-dimensional-space-port.net[216.184.19.228]:64007, delay=8.9, delays=0.04/0.02/0.12/8.7, dsn=2.0.0, status=sent (250 Ok)
Jun 20 06:31:07 mail7-057 postfix/qmgr[19327]: B91A42BE4: removed

그만큼http://www.postfix.org/COMPATIBILITY_README.html가상 앨리어스 맵의 동작 변경에 대해 구체적인 내용은 언급하지 않았습니다.

mysql-virtual_forwardings.cf는 ISPConfig에서 생성한 표준 형식입니다.

user = ispconfig
password = redacted
dbname = idsp_mail7_062
table = mail_forwarding
select_field = destination
where_field = source
additional_conditions = and active = 'y' and server_id = 81
hosts = 192.168.56.121

파일을 호출하는 main.cf의 관련 부분은 다음과 같습니다.

virtual_alias_maps = regexp:/etc/postfix/regexp-virtual_forwardings__admin.cf, proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, proxy:mysql:/etc
/postfix/mysql-virtual_email2email.cf

virtual_forwardings 테이블은 다음과 같습니다.

MariaDB [idsp_mail7_057]> select * from mail_forwarding where source='[email protected]';
+---------------+------------+-------------+---------------+----------------+----------------+-----------+--------------------+----------------------------------------------------------+---------+--------+
| forwarding_id | sys_userid | sys_groupid | sys_perm_user | sys_perm_group | sys_perm_other | server_id | source             | destination                                              | type    | active |
+---------------+------------+-------------+---------------+----------------+----------------+-----------+--------------------+----------------------------------------------------------+---------+--------+
|           201 |          2 |           2 | riud          | riud           |                |        69 | [email protected] | @theidsp-network.inter-realm.net,[email protected] | forward | y      |
+---------------+------------+-------------+---------------+----------------+----------------+-----------+--------------------+----------------------------------------------------------+---------+--------+
1 row in set (0.001 sec)

smtpd -v -v에 대한 로깅이 증가했으며 이는 로그에 표시됩니다.

dict_proxy_lookup: table=mysql:/etc/postfix/mysql-virtual_forwardings.cf flags=lock|fold_fix|utf8_request
 [email protected] -> status=0 [email protected],[email protected]
Apr 20 16:44:37 mail7-057 sslmx/smtpd[9561]: maps_find: virtual_alias_maps: proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf(0,lock|fold_fix|utf8
_request): [email protected] = @theidsp-network.inter-realm.net,[email protected]
Apr 20 16:44:37 mail7-057 sslmx/smtpd[9561]: mail_addr_find: [email protected] -> @theidsp-network.inter-realm.net,[email protected]

따라서 조회가 올바르게 수행되고 있는 것으로 보이지만 여전히 두 개가 아닌 한 개의 디스패치만 발생합니다.

답변1

"@otherdomain" 형식을 사용할 때만 발생하므로해결될 수 있다:

  1. 더 이상 사용되지 않는 형식을 파일 에 table/select_field/..지정하고 postfix가 더 이상 수행하지 않는 것을 SQL에서 모방하는 방식으로 마이그레이션하거나querymysql-*.cf
  2. 테이블을 영구적으로 변경하여 해당 별칭을 전체 user@domain형식으로 확장합니다.

CASE WHEN destination LIKE "@%" THEN SUBSTR(source,1,INSTR(source,"@"))||destination ELSE destination END두 해결 방법 모두 조회가 @로 시작하는 경우 SQL이 원본 사서함을 연결하도록 하는 것과 같은 내용을 포함하는 쿼리를 포함합니다 .user+extensions@onedomain와 같은 확장 프로그램을 사용하는 경우 해당 확장 프로그램을 처리하려면 어떻게 해야 하는지 신중하게 고려하세요 !

변경된 동작에 대한 가능한 이유를 검색할 때 일부 rfc822 인용/인용 해제 재작업을 발견했습니다.5월관련성이 있으면 CHANGELOG에서는 다음과 같이 언급합니다.

주소 확장을 올바르게 전파

"aa bb+ext"@example.com에서 "cc dd+ext"@other.example로

전체라고 똑같이 주장할 수도 있지만주소 목록의 첫 번째 항목에서만 실행되는 기능문제는 애초에 버그입니다. 이러한 사후 처리 단계는 사서함/확장자/구분 기호 간의 모호함 없이 결과 집합의 모든 요소에 적용되어야 합니다.


queryPostfix 3.4.13(Ubuntu에서 배포)에서 및 를 사용 table/select_field/..하거나 사용하지 않고 해당 목록/사서함 유형 혼란을 복제할 수 있었습니다.프록시맵, 다중 행 결과 또는 단일 쉼표로 구분된 결과를 사용합니다. 업스트림을 보고하기 위해 다음과 같은 거의 작동하는 단계를 작동 중인 재현기로 작업할 수 있습니다. 확실히테스트 상자에서만 이 단계를 실행하세요..

exit 1  # DATA LOSS! ONLY RUN ON VIRTUAL MACHINE FOR TESTING!
postconf virtual_transport=error
postconf virtual_alias_maps=proxy:sqlite:/etc/postfix/repro.cf
postconf virtual_alias_domains=e.invalid
postconf debug_peer_list=[::1]
sqlite3 /etc/postfix/repro.sqlite3 <<'EOF'
CREATE TABLE repro(s text, d text);
INSERT INTO repro(s,d) VALUES ("[email protected]", "@e.invalid,[email protected]");
INSERT INTO repro(s,d) VALUES ("[email protected]", "[email protected],[email protected]");
EOF
cat >/etc/postfix/repro.cf <<'EOF'
dbpath=/etc/postfix/repro.sqlite3
query=SELECT d FROM repro WHERE s='%s'
EOF
# send test mail (smtp not setuid, because smtp produces nicer logs)
printf %b 'import smtplib;\nsmtplib.SMTP("::1").sendmail("","[email protected]", "")' | python3
printf %b 'import smtplib;\nsmtplib.SMTP("::1").sendmail("","[email protected]", "")' | python3
# check logs

관련 정보