Repository navigation
Conversation
A bind mount whose host file is missing makes Docker create a directory in its place. setup.sh meant to catch that, but three faults kept it from working: - The check tested /etc/postifx/rbl_override, so it never fired. Setup then reported creating a default file, skipped postmap, and Postfix answered unauthenticated clients' RCPT with 451 4.3.5 for want of the map. - The error message put the path in backticks inside double quotes, so the shell tried to run it and the message printed without the path. - exit 1 only ended setup.sh. run.sh ignores its exit status, so services started with the rest of setup skipped. The check now looks at the right path, prints it, and marks the error in /etc/setup-error as the other setup checks do, so run.sh stops the container. The default-file branch is unchanged. Two tests: a container with a directory at that path must exit 1 with the error, and a default start must still build the map. Closes mailserver2#99
The administrator creates rbl_override on the host. If a regular user creates it, the bind mount keeps that UID, so inside the container the file is owned by a non-root UID. setup.sh ran postmap on it as root, but postmap drops root privileges and runs as the owner of a non-root input file unless given -o. As that UID it could not create rbl_override.db in /etc/postfix, which is root:root 755. setup.sh ignored the exit status and logged "RBL Override initialized", and Postfix answered unauthenticated clients' RCPT from outside mynetworks with 451 4.3.5. setup.sh now runs postmap -o, and a failed postmap marks /etc/setup-error, so run.sh stops the container instead of starting Postfix without the map. Two tests: - reverse bind-mounts an rbl_override owned by the user running the suite, checks that this is not root, and looks up an entry in the built map. - default starts a container with a directory where the .db goes and expects startup to stop with the error. The startup tests in default.bats start their own container and named the :testing image directly. run_default now passes NAME to them as MAILSERVER_IMAGE, so make default NAME=... tests that image.
SaraSmiseth
approved these changes
Nov 15, 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.
Description
Fixes #99. The second fault, a file not owned by root, has no issue of its own and is described below.
What
rbl_overrideisrbl_overrideis an optional Postfix access table for exempting mail servers from thezen.spamhaus.orgblocklist check (README, "Whitelist Hosts/IP Addresses In Postfix"). The administrator writes a file of client IPs or host names, one per line, such as1.2.3.4 OK, and bind-mounts it at/etc/postfix/rbl_override.smtpd_recipient_restrictionslooks the client up withcheck_client_access hash:/etc/postfix/rbl_overridejust beforereject_rbl_client zen.spamhaus.org, so anOKentry lets a listed client through. If nothing is mounted,setup.shcreates an empty file. Either way,setup.shrunspostmapon first start to buildrbl_override.db, the file Postfix actually reads.If the
.dbis missing, the lookup fails and Postfix answersRCPT TOwith451 4.3.5 ... Server configuration error. That hits every client that reaches the restriction, meaning anyone who is not authenticated and not inmynetworks. In practice, that is all mail from the internet.What is the current behavior (you can also link to an open issue here) ?
rbl_overrideis a directory (postfix rbl override check has a typo #99). Docker creates a directory when the host file of a bind mount is missing.setup.shmeant to catch this, but three faults stopped the check from working:/etc/postifx/rbl_override, so it never fired. Setup reported creating a default file, skippedpostmap, and Postfix had no map.exit 1only endedsetup.sh.run.shignores its exit status, so the services started anyway, with the rest of setup skipped.rbl_overrideis not owned by root. The administrator createsrbl_overrideon the host. If a regular user creates it, the bind mount keeps that user's UID, so inside the container the file is owned by a non-root UID too.setup.shrunspostmapas root inside the container, to createrbl_override.dbnext to the mounted file in the container's/etc/postfix. By default, postmap(1) drops root privileges and runs as the owner of a non-root input file, so here it runs as that UID./etc/postfixisroot:root 755, sopostmapcan't create the.dbthere.setup.shdidn't checkpostmap's exit status:Nothing in the README says the file must be owned by root, so following it as a regular user is enough to hit this. Reproduced on a build of master (
bd09d3b) with a1.2.3.4 OKfile owned by a regular user:RCPT TOfrom outsidemynetworksgot451 4.3.5. Runningpostmap -o /etc/postfix/rbl_overrideandpostfix reloadin that container turned it into250 2.1.5 Ok.sender_accessdoesn't have this problem, becausesetup.shcopies it into/etc/postfixfirst, sopostmapreads a copy owned by root.What is the new behavior (if this is a feature change) ?
/etc/setup-errorlike the other setup checks, sorun.shstops the container.setup.shrunspostmap -o, which keeps root privileges, so the owner of the file no longer matters. Postfix still logswarning: not owned by root: /etc/postfix/./rbl_overrideat start. That warning comes from its own ownership check on the source file, and the map works.postmapfails for any reason,setup.shlogs[ERROR] Could not build the rbl_override mapand marks/etc/setup-error, so the container stops instead of deferring mail.default.batsstart their own container, so they need an image name.run_defaultnow passesNAMEto them asMAILSERVER_IMAGE, somake default NAME=...tests that image rather than whatever:testingholds. A plainmake default, as in CI, behaves as before.Type of change
Status
Todo List
How has this been tested ?
Four new tests. The first, third and fourth fail on a build without the fixes and pass with them. The second guards the default path, which was already working:
default: "startup stops when rbl_override is a directory" mounts a tmpfs at/etc/postfix/rbl_overrideand expects the container to exit 1 with the error.default: "rbl_override map is built when none is provided" checks that the default start still builds the map.default: "startup stops when the rbl_override map cannot be built" mounts a directory whererbl_override.dbgoes, sopostmapfails, and expects the container to exit 1 with the error. Without the fix,postmaploggedfatal: open /etc/postfix/rbl_override.db: Is a directory, setup reportedRBL Override initialized, and the services started.reverse: "rbl_override map is built from a file not owned by root" bind-mountstest/share/postfix/rbl_overridefrom the checkout, so it belongs to the user running the suite. The test first checks that this owner isn't root, then looks up192.0.2.1in the built map and expectsOK. Without the fix, the container logged thePermission deniedlines above, and the lookup failed becauserbl_override.dbdid not exist.caa2b58), 358/358: default 139, reverse 85, ldap 66, ldap2 30, sieve 2, ecdsa 4, traefik_acmev1 11, traefik_acmev2 12, traefik_v3 9.38c6cd3), both "startup stops" tests fail: the container keeps running until the test's 180-second timeout. For the directory case, setup logsCreated default (empty) rbl_override file.