Mail server_Postfix configuration_Testing - SomethingWithHorizons/mailserver GitHub Wiki

Verify whether Postfix has been correctly configured for MySQL usage.

postmap can query Postfix via the CLI, using a specific Postfix configuration file. This allows - per configuration file defined in Postfix-MySQL configuration and assuming the test data imported earlier - verification whether the configuration files contain the correct information.

:information_source: The catch-all is verified by checking the literal @example.org entry in the alias table.

Procedure

  1. Execute the following tests (PASSED reflects correct operation)
# Verify whether Postfix correctly (in)validates domain names
test 1 -eq `postmap -q example.org mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf` && echo PASSED || echo FAILED
test -z `postmap -q example.com mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf` && echo PASSED || echo FAILED

# Verify whether Postfix correctly (in)validates email addresses
test 1 -eq `postmap -q [email protected] mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf` && echo PASSED || echo 
test -z `postmap -q [email protected] mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf` && echo PASSED || echo FAILED

# Verify whether Postfix correctly resolves aliases 
test [email protected] = `postmap -q [email protected] mysql:/etc/postfix/mysql-virtual-alias-maps.cf` && echo PASSED || echo FAILED
test [email protected] = `postmap -q @example.org mysql:/etc/postfix/mysql-virtual-alias-maps.cf` && echo PASSED || echo FAILED
test -z `postmap -q [email protected] mysql:/etc/postfix/mysql-virtual-alias-maps.cf` && echo PASSED || echo FAILED

# Verify whether Postfix correctly resolves mail2mail requests
test [email protected] = `postmap -q [email protected] mysql:/etc/postfix/mysql-email2email.cf` && echo PASSED || echo FAILED
test -z `postmap -q [email protected] mysql:/etc/postfix/mysql-email2email.cf` && echo PASSED || echo FAILED

:bulb: Issue the following command to download and run all tests using a script:

wget -qO- https://raw.githubusercontent.com/SomethingWithHorizons/mailserver/master/tests/postfix-mysql.sh | bash