Repository navigation
Builder: provider-neutral mail relay (gmail, custom, none) - #52
Merged
Merged
Conversation
Adds MAIL_RELAY and related settings. GMAIL_USER and GMAIL_APP_PASSWORD still work as the old names.
A login on a port other than 587 or 465 used smtp_tls_security_level=may, so the password could be sent in plain text if TLS failed. It is now encrypt whenever a login is set. Opportunistic TLS stays for a no-login relay.
This was referenced Oct 23, 2026
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.
What
Makes the mail relay in
build-templates.shprovider-neutral. It was Gmail only.New
shared.confsettings:MAIL_RELAY(gmail,custom,none),MAIL_RELAY_HOST,MAIL_RELAY_PORT,MAIL_RELAY_USER,MAIL_RELAY_PASSWORD,MAIL_ROOT_TO,MAIL_SENDER.gmail(default) keeps today's behaviour:[smtp.gmail.com]:587, STARTTLS, app password.custom: own host and port. 587 uses STARTTLS, 465 addssmtp_tls_wrappermode=yes, other ports use opportunistic TLS. A blank user means no login: no SASL files and nolibsasl2-modules.none: no relay, mail stays local (Debian's "Local only" transports are left alone).MAIL_SENDERset rewrites every sender; blank keeps the current "no rewrite".GMAIL_USERandGMAIL_APP_PASSWORDstill work as the old names, with one warning.shared.conf.exampleand validates host, port and relay choice.postfix.shhas no branching onMAIL_RELAY.README and
--helpupdated.Testing
bash -nand shellcheck are clean. Nothing was run as root and no real Postfix or mail was involved.HEAD) and new script were both run with--generate-onlyon the same fake Gmail config and the payloads compared. Everypostconfargument and its order are identical; the only body differences are the variable rename (GMAIL_*toMAIL_*) and the aliases line reading$MAIL_ROOT_TO(same value). New names withMAIL_RELAY=gmailgive a byte-identicalpostfix.sh.MAIL_SENDER, andnone, were read, not executed.Not tested: a real Gmail build and mail send, and any non-Gmail relay. Please rebuild a template and run
verify-clone.shbefore relying on it.Known gap
verify-template.shstill expects the Gmail relay, so builds withcustomornoneshow FAILs in its mail section. That is the next PR (verify reads its expectations fromshared.conf).Follow-up fix
An automated security review found that a custom relay with a login on a port other than 587 or 465 used opportunistic TLS (
may), so the password could go in plain text if TLS failed. Fixed in 29c4e76: a login now always meansencrypt. Checked: login on 2525 givesencrypt, no login on 25 staysmay.