michael orlitzky

Redundant Postfix main.cf parameters

What

Postfix's main configuration file is main.cf. All of its parameters have default values, and there are roughly one brazilian of them. Too many to keep track of.

And sometimes, you don't remember where a particular setting came from, or whether or not it's important. So you'd like to remove any entries in main.cf that are set to the defaults.

How

This is “obvious,” but not so obvious that it isn't faster to look up than recreate. This script will output any settings which you've defined to be equal to the default values. It uses postconf -d to determine the defaults, and postconf -n to determine which parameters you've set in main.cf.

1
2
3
4
5
6
7
8
9
#!/bin/sh
#
# Determine which defined main.cf parameters are redundant.
#

# Ignore warnings from postconf.
exec 2>/dev/null

(postconf -d; postconf -n) | sort -n | uniq -d