Understanding main.cf
How Postfix parameters are declared, queried, overridden, and validated.
Production note: Back up configuration, run
postfix check, and stage changes before reloading.Configuration model
main.cf contains service-wide parameters. Use postconf to query effective values instead of reading only the file.
Essential commands
postconf -n
postconf -d relayhost
postconf -h myhostname
postconf -e "smtp_tls_security_level = may"
postfix checkPrecedence and expansion
Parameters may reference other parameters with $name. Avoid circular references and quote shell input correctly when using postconf -e.
Safe change workflow
- Back up files.
- Change one logical unit.
- Run
postfix check. - Reload, not restart, when possible.
- Verify logs and queue behavior.