Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If you don't want to use a plain file Postfix lookup table to manage TLS policy maps, but a SQL backend, you'll very likely find the files in this directory helpful. You can use them as follows:
Create a
tls_policy
table in the SQL database you want to use with Postfix. You can use the providedscheme.sql
if you want to.Create a proxy configuration file (e.g.
/etc/postfix/tls_policy.cf
) to tell Postfix the SQL query to use. You can again use the providedpostfix_proxy.cf
as a blueprint, but don't forget to change username and password.Configure Postfix to actually use the proxy configuration file by setting the
smtp_tls_policy_maps
parameter in Postfix'smain.cf
accordingly. Don't forget to reload/restart Postfix afterwards.Use the provided
update_database.sh
to convert the plain file Postfix lookup table to SQL queries and execute them. You can e.g. simply pipe stdout of the script to themysql
command.You can change the built-in SQL query template by setting the environment variable
TEMPLATE
. You can use the placeholders{domain}
,{policy}
and{params}
in the template. As a reference, this is the script's default template:You may want to repeat Step 4 on a regular basis (e.g. weekly) to always use the newest upstream TLS policy maps on your server. The provided
update_database.sh
always validates the policy file before converting it into SQL queries, so you can safely automatize this task with a cronjob. The following crontab line is intended to provide inspiration for you to create your own cronjob (it will work with Debian only). Most importantly, you'll have to find a way to safely pass the password of the SQL user to the cronjob.