Discussion:
[Mimedefang] [MIMEDefang] Postfix add headers to outgoing mails
M***@t-systems.com
2017-02-02 17:21:37 UTC
Permalink
Hi folks,

sorry for my very basic questions about this milter and the necessary configuration to bind to the MTA.
I'm very new in this field, but i searched the whole week for a solution and look at so much howtos, threads and other stuff. Please help me with this.

My situation at the moment:

My main goal is to add two headers on outbound mails which are send over postfix.
First i try this with the postfix feature header_checks and the PREPEND action to add the 2 headers which we need.
It seems that fir this only one rule with PREPEND is allowed in the header_check file, cause of the mechanism postfix go through them.

Now my new approach is using a milter on postfix, who i've read should such a tool should be able to add more then one header in a mail.
I decided for MIMEDefang. I read some HowTo's to bind this extra linux service on my postfix server, hopefully done this correct.
After that i rewrote the whole /etc/mail/mimedefang-filter, but the headers will never be added.
I dont find a log file from mimedefang for debugging purposes and also dont see anything in the maillog when i append "-vvv" in postfix master.cf after this line:
"smtp      inet  n       -       n       -       -       smtpd"

(System is CentOS7)

Configuration files:

########
#main.cf#
################################
smtpd_milters = inet:127.0.0.1:10025
################################


########################
#/etc/mail/mimedefang-filter#
########################################################################

sub filter_end {
        if ( $Sender =~ /^<?***@domain-part.tld>?$/i ) {
                action_add_header("X-Auto-Response-Suppress", "DR,RN,NRN,OOF,AutoReply");
                action_add_header("Precedence", "list");
        }
}
1;
########################################################################


Kind regards,

Max Rößler

T-Systems Multimedia Solutions GmbH
Application Management & Cloud Services
Business Unit Application Management & Cloud Services
Max Rößler
System Engineer
Address: Riesaer Straße 7, 01129 Dresden, Germany
Postal address: Postfach 10 02 24, 01072 Dresden, Germany
+49 351 2820-7012 (Tel)
+49 160 7186124 (Mobil)
E-Mail:    ***@t-systems.com
Internet:  http://www.t-systems-mms.com

You can find the compulsory statement on:
www.t-systems-mms.com/en/compulsory-statement


_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list ***@lists.roaringpenguin.com
http://l
Bill Cole
2017-02-03 20:30:17 UTC
Permalink
Post by M***@t-systems.com
Hi folks,
sorry for my very basic questions about this milter and the necessary
configuration to bind to the MTA.
I'm very new in this field, but i searched the whole week for a
solution and look at so much howtos, threads and other stuff. Please
help me with this.
My main goal is to add two headers on outbound mails which are send over postfix.
The best place to find Postfix expertise is the Postfix Users list. See
http://www.postfix.org/lists.html for how to subscribe.
Post by M***@t-systems.com
First i try this with the postfix feature header_checks and the
PREPEND action to add the 2 headers which we need.
It seems that fir this only one rule with PREPEND is allowed in the
header_check file, cause of the mechanism postfix go through them.
Yes, header_checks would be the wrong place to do this, if you want this
to be conditional on the SMTP envelope sender rather than the value of
the "From" header. To add headers based on the SMTP envelope sender, you
should use check_sender_access in smtpd_sender_restrictions or
smtpd_recipient_restrictions. Since you can apply multiple
check_sender_access maps in restriction lists, you can match the sender
in 2 distinct access maps and add a header in each one.

However, if you're actually looking to match a header address, I believe
you can work around the shortcomings of header_checks by also setting
smtp_header_checks with a pattern file that adds the second header.

These approaches are both a bit clumsy, but they are lighter weight than
MD. You might get a better Postfix-only answer from the Postfix Users
list.
Post by M***@t-systems.com
Now my new approach is using a milter on postfix, who i've read should
such a tool should be able to add more then one header in a mail.
I decided for MIMEDefang. I read some HowTo's to bind this extra linux
service on my postfix server, hopefully done this correct.
After that i rewrote the whole /etc/mail/mimedefang-filter, but the
headers will never be added.
I dont find a log file from mimedefang for debugging purposes and also
dont see anything in the maillog when i append "-vvv" in postfix
master.cf
Don't do that. Postfix verbose logging is overkill. If you're not seeing
anything in maillog, there's a logging config problem. Both mimedefang
and postfix use traditional syslog calls with the LOG_MAIL facility, so
if your logging is set up correctly you should be getting messages from
both of them in the same file.
Post by M***@t-systems.com
"smtp      inet  n       -       n      
-       -       smtpd"
(System is CentOS7)
The fact that this is a systemd-based system complicates matters a bit,
because it is possible to set up CentOS7 (or RHEL7) in a way that fails
to put anything in any files in /var/log/. Can you see any messages
using journalctl?
Post by M***@t-systems.com
########
#main.cf#
################################
smtpd_milters = inet:127.0.0.1:10025
################################
That setting is probably wrong. Usually mimedefang is configured to
listen on a UNIX-domain socket, so with a pure-defaults mimedefang you'd
want this:

smtpd_milters = unix:/var/spool/MIMEDefang/mimedefang.sock

Check the -z and -p options that your mimedefang daemon uses to confirm
to correct that path.

_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list ***@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

Loading...