How to undo or reverse a Postfix postmap command

It's come to my attention that I might need to adjust my Postfix config in the following way to fix a mail delivery problem from one sender in particular:

# vim /etc/postfix/main.cf

+ header_checks = regexp:/etc/postfix/header_checks

# vim /etc/postfix/header_checks // NEW FILE

+ /^Delivered-To: .*/ IGNORE

# postmap /etc/postfix/header_checks
# service postfix restart

The part I'm uncomfortable with reversing is the postmap command.

The current plan to reverse this if it doesn't fix my problem is to just remove the header_checks line from main.cf and restart Postfix. Does that sound right?

My server has been running like a champ for 4+ years and I hate to mess with it when it's not necessary. Unfortunately it's necessary now.


Solution 1:

postmap creates a database file from the plain text input file. The exact name depends on the database type in use by your installation, but it will be something like /etc/postfix/header_checks.lmdb.

To stop using header_checks removing it from the config should be sufficient; to completely clean things up you can then delete both the source file and the generated database.