Hello,

I am testing a simple header_check that uses PREPEND to add a custom header to 
messages.

1) I *always* want to add the header, so the detected header in the rule 
doesn't 
matter so much.  Does anyone have advice for the best header to detect so I 
won't miss any messages?  Is /^From:/ the best?  Or maybe /^Date:/ ....?

Anyhow, my PREPEND is working fine as a header_check in main.cf, but when I put 
it in master.cf in a smtpd listener that picks up mail from my content filter, 
it seems to be ignored completely.  


I read that header_checks won't get certain headers such as From: in a smtpd 
process (um, I think?).  So I found a few examples that recommended to move it 
to smtpd_data_restrictions as a check_client_access table.  That didn't work 
either.  I also tried it as a smtpd_sender_restrictions check_sender_access 
table, but still no luck.

What am I missing?

127.0.0.1:10024 inet  n       -       n       -       -      smtpd
            -o content_filter=
            -o smtpd_delay_reject=no
            -o 
receive_override_options=no_unknown_recipient_checks,no_header_body_checks
# Doesn't work (yes, even when removing the line above):    -o 
header_checks=pcre:/etc/posfix/add_header.pcre
            -o smtpd_helo_restrictions=
            -o smtpd_client_restrictions=
            -o smtpd_sender_restrictions=
# Doesn't work            -o 
smtpd_sender_restrictions=check_sender_access,pcre:/etc/postfix/add_header.pcre
            -o smtpd_recipient_restrictions=permit_mynetworks,reject
            -o smtpd_data_restrictions=reject_unauth_pipelining
# Doesn't work            -o 
smtpd_data_restrictions=reject_unauth_pipelining,check_client_access,pcre:/etc/postfix/add_header.pcre

            -o smtpd_end_of_data_restrictions=
            -o smtpd_restriction_classes=
            -o local_header_rewrite_clients=
            -o mynetworks=127.0.0.0/8
            -o smtpd_client_connection_count_limit=0
            -o smtpd_client_connection_rate_limit=0
            -o smtpd_authorized_xforward_hosts=127.0.0.0/8
            -o smtpd_error_sleep_time=0
            -o smtpd_soft_error_limit=1001
            -o smtpd_hard_error_limit=1000

/etc/postfix/add_header.pcre is as follows

/^From: /     PREPEND X-Custom-Header Hello_world

It works if I put this into main.cf:

header_checks = pcre:/etc/postfix/add_header.pcre

Thanks in advance

Reply via email to