On Sat, Sep 18, 2021 at 08:39:41AM +0300, Vladimir Mishonov <m...@player701.ru> wrote:
> What's most problematic is that while both issues #1 and #2 can be worked > around for SOME templates, there appear to be a number of hard-coded > templates that cannot be changed without recompiling Postfix. I understand > that I can make changes to the source code and recompile the program, but > even if I am able to accomplish this, it would only be half of the job done, > if not even less than that. I'd also have to arrange a process to create > packages in the appropriate format for my OS distribution and keep them > updated. I'm afraid this would be very difficult and extremely > time-consuming for me, since like I said before, I have only basic > experience in Linux administration. This is really just a bad joke, but instead of compiling Postfix from source, and possibly trying to include any patches that your operating system developers might have applied to every new version, you could patch the relevant binaries to change MAILER-DAEMON to mailer-daemon. Here's an example for Debian. :-) #!/bin/sh # Change MAILER-DAEMON to mailer-daemon for Postfix on Debian. # There is no warranty; not even for merchantability or fitness # for a particular purpose. for bin in `dpkg-query -L postfix | grep bin` do [ -f "$bin" -a -x "$bin" ] || continue strings "$bin" | grep -q MAILER-DAEMON || continue echo $bin perl -pi -e 's/MAILER-DAEMON/mailer-daemon/smg' "$bin" done If run, it would modify the following files: /usr/lib/postfix/sbin/bounce /usr/lib/postfix/sbin/cleanup /usr/lib/postfix/sbin/local /usr/lib/postfix/sbin/pipe /usr/lib/postfix/sbin/showq /usr/lib/postfix/sbin/smtpd /usr/lib/postfix/sbin/trivial-rewrite /usr/sbin/postconf /usr/sbin/qshape So any file system integrity checking would need to be informed. And it wouldn't work on systems with cryptographically signed binaries, but it seems fine on Debian (dpkg --audit is silent). And bear in mind that there are other programs that hard-code MAILER-DAEMON (e.g. dovecot, fetchmail, popclient, procmail, amavisd-new), and as Viktor said, the case might be significant somewhere (but hopefully not). On a more serious note... Have you tried using canonical_maps? I don't know if they are applied to outgoing bounce messages, but they might be: /etc/postfix/main.cf: canonical_maps = hash:/etc/postfix/canonical_map /etc/postfix/canonical_map: mailer-dae...@mydomain.com mailer-dae...@mydomain.com The "@mydomain.com" might not be needed. Actually, http://www.postfix.org/ADDRESS_REWRITING_README.html says that canonical address mapping applies to "all mail", and it's performed by cleanup(8) which bounces pass through, so it looks promising. The smtp_generic_maps setting might also work, but it's only for outgoing mail. With canonical_maps, you might even be able to use regexp/pcre to map incoming bounce messages from other people's mail servers to stop them shouting at you as well: /etc/postfix/main.cf: canonical_maps = pcre:/etc/postfix/canonical_map /etc/postfix/canonical_map: /^MAILER-DAEMON(@.+)?$/i mailer-daemon${1} Note that the "i" is to make the regexp/pcre pattern case-sensitive (because it's case-insensitive by default and the "i" toggles that). Using hash: for canonical_maps is always case-insensitive, so it might be better to use regexp/pcre because it enables you to make the lookup case-sensitive. Maybe it wouldn't matter. cheers, raf