OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
smtpd_data_restrictions vs header_checks (sequence of execution)

From: Eddy Beliveau (eddy.beliveauhec.ca)
Date: Thu May 01 2008 - 16:05:44 CDT


Hi! Networkers,

I'm using with success Postfix 2.5.1 (+amavisd-new) on my academic server.

This server is reserved to authenticated sender only.

I need to add some custom header to every emails received.
This custom header will be read later by some smtpproxy process.

So, on main.cf, I added:

smtpd_data_restrictions =
        check_sender_access ldap:ldap_add_header

ldap_add_header_query_filter = (mail=%s)
...cut...
ldap_add_header_result_attribute = privileges
ldap_add_header_result_format = PREPEND X-Sender-Privileges: %s

But, I also want to be sure to remove any forged similar header

so, I added this rule to my header_checks file:
/^X-Sender-Privileges:/ IGNORE

This works too well
It also remove the custom header that I just added.

It seems that "smtpd_data_restrictions" is execute before header_checks step.

Any advise will be appreciated

Thanks and have a nice day
Eddy