Postfix header_checks 不是 FROM 重写,不起作用

Postfix header_checks 不是 FROM 重写,不起作用

我有一个仅用于内部到出站的中继。我正在尝试选择性地将发件人:重写为无重放。我也尝试过规范映射,但没有成功。我唯一取得的成功是更新了回复地址。我快要被这个问题搞疯了。欢迎任何帮助,提前谢谢大家!

主配置文件

# 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_tls_key_file=/etc/postfix/postfix.pem
smtpd_tls_cert_file=$smtpd_tls_key_file
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 = relayhost.mydomain.com
#alias_maps = hash:/etc/aliases
#alias_database = hash:/etc/aliases
#myorigin = /etc/mailname
#mydestination = 
relayhost = [mydomain-com.mail.protection.outlook.com]
mailbox_size_limit = 419430400
#recipient_delimiter = 
inet_interfaces = all
inet_protocols = ipv4


#added edit by some tech 7/12/2018 to rewrite from field on all outbound
sender_canonical_classes = envelope_sender, header_sender
sender_canonical_maps = regexp:/etc/postfix/sender_regex
header_checks = regexp:/etc/postfix/header_check

header_checks

/^From:\s[a-z0-9-]{1,30}@[a-z0-9-]{1,65}.[a-z]{1,}$/ REPLACE From: <[email protected]>
/^Received:.*/ IGNORE

发件人正则表达式

/^[a-z0-9-]{1,30}@[a-z0-9-]{1,65}.[a-z]{1,}$/ [email protected]

队列头

*** ENVELOPE RECORDS deferred/1/1EFFE220817 ***
message_size:          731767             807               1               0          731767               0
message_arrival_time: Wed Aug  1 18:07:38 2018
create_time: Wed Aug  1 18:07:38 2018
named_attribute: log_ident=1EFFE220817
named_attribute: rewrite_context=remote
sender: [email protected]
named_attribute: log_client_name=printer.mydomain.com
named_attribute: log_client_address=XXX.XXX.XXX.XXX
named_attribute: log_client_port=49434
named_attribute: log_message_origin=printer.mydomain.com[XXX.XXX.XXX.XXX]
named_attribute: log_helo_name=SECXXXXXXXXXXXX
named_attribute: log_protocol_name=ESMTP
named_attribute: client_name=printer.mydomain.com
named_attribute: reverse_client_name=printer.mydomain.com
named_attribute: client_address=XXX.XXX.XXX.XXX
named_attribute: client_port=49434
named_attribute: server_address=XXX.XXX.XXX.XXX
named_attribute: server_port=25
named_attribute: helo_name=SECXXXXXXXXXXXX
named_attribute: protocol_name=ESMTP
named_attribute: client_address_type=2
named_attribute: dsn_orig_rcpt=rfc822;[email protected]
original_recipient: [email protected]
recipient: [email protected]
*** MESSAGE CONTENTS deferred/1/1EFFE220817 ***
Received: from SECXXXXXXXXXXXX (printer.mydomain.com [XXX.XXX.XXX.XXX])
        by relayhost.mydomain.com (Postfix) with ESMTP id 1EFFE220817
        for <[email protected]>; Wed,  1 Aug 2018 18:07:38 -0700 (PDT)
Date:Wed, 01 Aug 2018 17:49 -0600
From:<[email protected]>
Message-Id: <16337552832588.0037@t37>
To: ""<[email protected]>
Subject:=?utf-8?B?U2NhbiBmcm9tIEZEMlBDMTA=?=
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="----=_NextPart_54c_5332_2439.4173"
Content-features:
        (& (& (dpi=300) (dpi-xyratio=[300/300]))
        (image-coding=MH))

来自 mail.log 的已完成交易

Aug  1 18:06:51 relayhost postfix/postfix-script[53569]: refreshing the Postfix mail system
Aug  1 18:06:51 relayhost postfix/master[53433]: reload -- version 3.3.0, configuration /etc/postfix
Aug  1 18:07:37 relayhost postfix/smtpd[53575]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Aug  1 18:07:37 relayhost postfix/smtpd[53575]: initializing the server-side TLS engine
Aug  1 18:07:37 relayhost postfix/tlsmgr[53577]: open smtpd TLS cache btree:/var/lib/postfix/smtpd_scache
Aug  1 18:07:37 relayhost postfix/tlsmgr[53577]: tlsmgr_cache_run_event: start TLS smtpd session cache cleanup
Aug  1 18:07:37 relayhost postfix/smtpd[53575]: connect from printer.mydomain.com[XXX.XXX.XXX.XXX]
Aug  1 18:07:38 relayhost postfix/smtpd[53575]: 1EFFE220817: client=printer.mydomain.com[XXX.XXX.XXX.XXX]
Aug  1 18:07:38 relayhost postfix/cleanup[53579]: 1EFFE220817: message-id=<16337552832588.0037@t37>
Aug  1 18:07:38 relayhost postfix/qmgr[53574]: 1EFFE220817: from=<[email protected]>, size=731767, nrcpt=1 (queue active)
Aug  1 18:07:38 relayhost postfix/smtpd[53575]: disconnect from printer.mydomain.com[XXX.XXX.XXX.XXX] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Aug  1 18:07:38 relayhost postfix/error[53580]: 1EFFE220817: to=<[email protected]>, relay=none, delay=0.74, delays=0.71/0.02/0/0.01, dsn=4.3.2, status=deferred (deferred transport)

相关内容