refactor: Share a common helper (vhost builder) for sourcing domains#2620
Merged
polarathene merged 8 commits intodocker-mailserver:masterfrom Jun 9, 2022
Conversation
Member
Author
|
# the `to` is important, don't delete itOriginally this The maintainer comment instructing the importance of Can we better clarify why it's important here? |
5 tasks
b25d6d5 to
12d7921
Compare
This comment was marked as outdated.
This comment was marked as outdated.
ea1b434 to
5df0e26
Compare
- Helpers `accounts.sh` and `aliases.sh` can move their vhost code into this helper. - They share duplicate code with `bin/open-dkim` which will also leverage this vhost helper going forward.
- Chunky commit, but mostly copy/paste of logic into a common method. - `bin/open-dkim` additionally wrapped relevant logic in a function call and revised inline docs.
- Revises notes for LDAP vhost support. - This now ensures LDAP users get vhost rebuilt to match the startup script for when change detection support is enabled. - `bin/open-dkim` will additionally be able to support the default `DOMAINNAME` var (set via `helpers/dns.sh`) for LDAP users instead of requiring them to provide one explicitly.
- This will ensure LDAP users insert the same `DOMAINNAME` value as used during container startup. - The container itself should panic at startup (during `helpers/dns.sh`) if this isn't configured correctly already, thus it should not introduce any breaking change to users of this utility?
5df0e26 to
3c44ed1
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
polarathene
commented
Jun 7, 2022
polarathene
commented
Jun 7, 2022
Line is split by a delimiter such as white-space (or via IFS: `|`), the blank `_` var is to indicate we're not interested in that value, but still leverage how `read -r` works, instead of splitting the var ourselves first thing.
polarathene
commented
Jun 7, 2022
Member
Author
polarathene
left a comment
There was a problem hiding this comment.
Good catch with those two lint lines! 😀
No longer applicable with the switch to `_`
georglauterbach
approved these changes
Jun 7, 2022
casperklein
approved these changes
Jun 9, 2022
8 tasks
5 tasks
8 tasks
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.
Description
bin/open-dkimandhelpers/accounts.sh+helpers/aliases.shhave roughly duplicate code for collecting domains to process. This code is now in sync by updating methods inhelpers/postfix.sh.Commit messages (first to last) for quick reference
chore: Split vhost helper method and use filepath vars
accounts.shandaliases.shcan move their vhost code into this helper.bin/open-dkimwhich will also leverage this vhost helper going forward.chore: Sync vhost generation logic into helper
bin/open-dkimadditionally wrapped relevant logic in a function call and revised inline docs.chore: Include LDAP vhost support
bin/open-dkimwill additionally be able to support the defaultDOMAINNAMEvar (set viahelpers/dns.sh) for LDAP users instead of requiring them to provide one explicitly.chore(
bin/open-dkim): EnsureDOMAINNAMEis properly setDOMAINNAMEvalue as used during container startup.helpers/dns.sh) if this isn't configured correctly already, thus it should not introduce any breaking change to users of this utility?/etc/postfix/vhostused by Postfixmain.cf:virtual_mailbox_domainssetting.bin/open-dkimleverages it to acquire domains relevant to Postfix.check-for-changes.shto generate vhost config whenhelpers/accounts.shorhelpers/aliases.shis not affected by the changed file. That support will be covered in refactor: Revisecheck-for-changes.sh#2615Relevant history -
bin/open-dkimargDOMAINSAdditional info regarding
bin/open-dkim(most of this isn't useful in the context of this PR, but helps understand the background of the alternative support viaDOMAINSarg):DOMAINSarg support was added in Jan 2021 to support the needs of LDAP users (earlier issue from 2017 for LDAP users).DOMAINS.DOMAINSarg replaced the need for a separate command that provided similar functionality (originally for a user with DKIM sourced via SQL, implemented Sep 2017 in Fixes #619 by adding a new command: generate-dkim-domain #690 ).main.cf:virtual_mailbox_domains(/etc/postfix/vhost), although LDAP setups also add a 2nd table value:ldap:/etc/postfix/ldap-domains.cf(could possible source viapostconfquery? Unlessbin/open-dkimis not meant to be dependent upon a running/configured Postfix instance).Type of change
Checklist: