Add SQL backend files#5
Open
PhrozenByte wants to merge 1 commit into
Open
Conversation
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. See sql/README.md for details.
|
I would change the sql query in sql/postfix_proxy.cf to:
if the params column is empty (postfix doesn't like null results) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_policytable in the SQL database you want to use with Postfix. You can use the providedscheme.sqlif 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.cfas 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_mapsparameter in Postfix'smain.cfaccordingly. Don't forget to reload/restart Postfix afterwards.Use the provided
update_database.shto convert the plain file Postfix lookup table to SQL queries and execute them. You can e.g. simply pipe stdout of the script to themysqlcommand.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.shalways 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.