Autoreply suppressing header for Administrator E-Mail

4920441

Member
Dec 7, 2021
24
1
8
54
Hi,

After migrating to Proxmox Mail Gateway I have got a little problem about the handling of auto replies for the administrator email address.

If a User is not availailbel and has an autoreply configures in (e.g.) exchange, what happens when he gets a spam report, the auto reply matches and replies to the adminstrator E-Mail Address.

With postfix/procmail etc. you simply could add a header to suppress this effectively:


Code:
formail -A "X-sysadm: yes" -A "Precedence: bulk" -A "X-Auto-Response-Suppress: All"


After that, exchange behaves and the Administrator E-mail is free from autorplies.


But: how do I implement that in the Proxmox Mail Gateway so it survives the next update and works as well?


Does anyone have some advice about where to put that?


Cheers


4920441
 
hm - adding those headers in general might make sense - would you mind creating an enhancement request over at:
https://bugzilla.proxmox.com so it does not get forgotten?

But: how do I implement that in the Proxmox Mail Gateway so it survives the next update and works as well?
if you want to modify the postfix config in PMG, in a update/reboot-safe manner -you need to use the templateing system:
https://pmg.proxmox.com/pmg-docs/pmg-admin-guide.html#pmgconfig_template_engine

I hope this helps!
 
Hi,

thanks for that hint, I added that as an enhancement suggestion.

But for the meantime I added some mailfilter stuff, when the postmaster user is sending something, pmg should add the appropriate headers with the filtering funktion.
But that does not work as expected..
When I deliver the email THROUGH pmg (via SMTP / port 25/26) everything works fine and the headers are correctly addes as intended:


Code:
Subject: test Tue, 02 Apr 2024 10:57:34 +0200

Message-Id: <20240402105734.029360@foobar>

X-Mailer: swaks v20170101.0 jetmore.org/john/code/swaks/

X-sysadm: yes

Precedence: bulk

X-Auto-Response-Suppress: All

X-SPAM-LEVEL: Spam detection results:  0

        ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP

        KAM_DMARC_STATUS         0.01 Test Rule for DKIM or SPF Failure with Strict Alignment

        KAM_NUMSUBJECT            0.5 Subject ends in numbers excluding current years

 

This is a test mailing


BUT, if I generate a spam report directly to check if the headers are also added by

Code:
root@mx0:~# pmgqm send --receiver 492@somedomain.whatever


the result is absolutely additional header free:

Code:
Content-Type: multipart/related; boundary="----------=_1712229910-29499-0"
Content-Transfer-Encoding: binary
MIME-Version: 1.0
X-Mailer: MIME-tools 5.510 (Entity 5.510)
To: whatever@whatever.com
From: Proxmox Mail Gateway <postmaster@mailserver>
Subject: Daily Spam Report for 'watever@whatever.com' - 2024-04-04
Message-Id: <20240404112510.D105F8001A5@>
Date: Thu,  4 Apr 2024 13:25:10 +0200 (CEST)

This is a multi-part message in MIME format...

------------=_1712229910-29499-0
Content-Type: text/html
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

**NOTHING MORE**


It seems "pmgqm send" generates the spamreport directly into some spool directory, absolutely bypassing the pmg mail filter instance, am I right?


Where could I add in this case the appropriate headers in the meantime until it is implemented?


Thanks a lot for the great help!


Cheers

4920441
 
It seems "pmgqm send" generates the spamreport directly into some spool directory, absolutely bypassing the pmg mail filter instance, am I right?
more or less - it generates the mail and sends it to the postfix/smtpd listener on 127.0.0.1:10025

Where could I add in this case the appropriate headers in the meantime until it is implemented?
for this listener you can adapt the config in the master.cf.in template.

I hope this helps!
 
Hi,

in master.cf it isn't as simple as it seems on the first sight.

It seems smtpd doesn't care about header_checks option

Code:
pcre:/etc/postfix/add_headers

/^/ PREPEND Precedence: bulk
/^/ PREPEND X-Auto-Response-Suppress: All


I cannot configure -o header_checks:pcre:/etc/postfix/add_headers or something like that, it seems when it is configured in main.cf instead of master.cf it does not trigger smtpd but something else.

Do you have any tips how to 'simply' add those headers for all mails going through port 10025 - assuming that are all system generated mails in the first place.

Thanks a lot for your help!

Cheers,
4920441
 
assuming that are all system generated mails in the first place.
It's actually all mail (also mail that is coming from extern and processed by the filter-system) - so you don't want to add them there unconditionally!

I cannot configure -o header_checks:pcre:/etc/postfix/add_headers or something like that, it seems when it is configured in main.cf instead of master.cf it does not trigger smtpd but something else.

I think it should be -o header_checks=pcre:... (= instead of :)

what does it trigger when in main.cf?!
 
I think when it is configured in main.cf it triggers cleanup and not smtpd as seen on a plain postfix installation on another system.

When I add the -o header_checks=etc.pp the spam reports are not generated any more, something hangs - i did not investigate yet which part hangs, though... ( I had it right the first try , but I wrote this post out of my memory, so that's where the syntax error was generated :)

Cheers

4920441
 
Last edited:
Hi,
does not seem to work, but I don't know exactly why.
Since the header_checks belong to cleanup I tried it this way:

master.cf.in

Code:
127.0.0.1:10025 inet  n       -       n       -       -      smtpd
  -o content_filter=
  -o local_recipient_maps=
  -o relay_recipient_maps=
  -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
  -o smtpd_helo_restrictions=
  -o smtpd_client_restrictions=
  -o smtpd_restriction_classes=
  -o smtpd_sender_restrictions=
  -o smtpd_recipient_restrictions=permit_mynetworks,reject
  -o mynetworks=127.0.0.0/8
  -o smtpd_error_sleep_time=0
  -o smtpd_client_connection_count_limit=0
  -o smtpd_client_connection_rate_limit=0
  -o smtpd_tls_security_level=none
  -o smtpd_authorized_xforward_hosts=127.0.0.0/8
  -o message_size_limit=[% (pmg.mail.maxsize*2) %]

pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
  -o message_size_limit=[% (pmg.mail.maxsize*2) %]
  -o header_checks=pcre:/etc/postfix/add_headers

Which 'works' but does not add any additional headers configured in add_headers

Code:
/^/ PREPEND Precedence: bulk
/^/ PREPEND X-Auto-Response-Suppress: All

I clearly do something wrong here:

Code:
2024-04-05T15:12:33.611668+02:00 mx0 postfix/cleanup[895]: error: unsupported dictionary type: pcre


Its clear to me, that the cleanup process will at least run two times in this config and it is not filtered for postmaster or any other sender address at all - but as I test it only on my testing system, it does not matter too much at this point.

Thanks a lot for further help!

Cheers


4920441
 
Hi,

at last, I sorted it out.

First of all, for using pcre you have to install the postfix-pcre.
Second, the "no_header_body_checks" hast to be commented out and in the cleanup part you have to omit the header_checks Option in the
/var/lib/pmg/templates/master.cf.in :

Code:
127.0.0.1:10025 inet  n       -       n       -       -      smtpd
  -o content_filter=
  -o local_recipient_maps=
  -o relay_recipient_maps=
  -o receive_override_options=no_unknown_recipient_checks
#,no_header_body_checks   // else  the pcre plugin does not get called
  -o smtpd_helo_restrictions=
  -o smtpd_client_restrictions=

[....]
cleanup   unix  n       -       -       -       0       cleanup
  -o message_size_limit=409771520
  -o header_checks=pcre:/etc/postfix/add_headers


in the /etc/postfix/add_headers

Code:
/^Subject: *Weekly Spam Report* / PREPEND X-Auto-Response-Suppress: All
/^Subject: *Daily Spam Report* / PREPEND X-Auto-Response-Suppress: All


Followed by a "pmgconfig sync --restart 1" and a test "pmgqm send --timespan week --receiver what@ever.com" the appropriate header was correctly set.


Is there anything I comprimise by not using the "no_header_body_checks" in the body any more?

Cheers

4920441
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!