Repository navigation
Description
The Mail application lets administrators add custom Postfix settings with files in the postfix-custom volume, but only for the general settings file, main.cf. The settings of each Postfix service (for example the SMTP listeners on ports 25, 465 and 587, or the delivery agents) live in a separate file, master.cf, which is generated by the application and cannot be customized: any manual change is lost at the next restart or configuration change.
Some setups need to change a single service, for example to limit the number of concurrent connections on port 587, or to add a new listener or delivery method for an external filter or archiving tool.
Proposed solution
Append the contents of a new file, master.append, to the generated master.cf. The file is in the existing postfix-custom volume (the same directory used for main.cf customizations, so it is already included in the backup):
- a new entry adds a service;
- an entry with the same service name and type (the first two fields) as a generated one replaces it, because Postfix uses the last entry and logs a "duplicate master.cf entry" warning;
- the file is not checked: an invalid entry stops Postfix until the file is fixed or removed, and the README explains how to recover;
- a new fact counts the entries of the file.
Alternative solutions
- Merge the custom entries into
master.cfand check them before starting Postfix, renaming an invalid file and logging a warning: much more code, and the check cannot catch every error (for example an address that cannot be bound), so it would need another safety net when Postfix starts. - Replace the whole
master.cfwith a custom copy: the copy no longer follows the module settings (debug options, restricted senders) or the services added by later updates. - A separate volume and directory for
master.cfcustomizations: more files and backup paths to handle for the same result. - To disable a service, Postfix already provides the
master_service_disablesetting, which can be set in amain.cfcustomization file.
Additional context
Planned for Mail 2.0, together with the Dovecot 2.4 upgrade (#8267).
See also
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsVerified
Activity
DavidePrincipi commentedon Nov 27, 2026
Implemented by NethServer/ns8-mail#340, available since Mail
2.0.0-beta.4. Test it with the latest testing release, Mail2.0.0-beta.6.Test cases
Cases marked with ✋ are not covered by the automated test suite (
tests/40__api/65__postfix.robot), or only in part: they need a manual check.Run the commands as the module user, e.g.
runagent -m mail1./etc/postfix/main.cf.d/master.appenddoes not exist in thepostfixcontainer,master.cfis the generated one, andapi-cli run module/mail1/get-factsreportspostfix_master_custom_count=0.podman exec postfix postconf -Mf submission/inet, copy it intomaster.appendand changemaxproc(7th field) from-to20, thensystemctl --user reload postfix.postconf -Mf submission/inetshows20, and the journal shows the "duplicate master.cf entry" warning. ✋ Open more than 20 concurrent connections to port 587: the extra ones wait.smtpdlistener on a free port, and reload:postconf -Mflists it and the port accepts SMTP connections. The fact counts both entries (2).master.appendand reload:master.cfis back to the generated one and the fact is0.postfix/mastererror. Fix the file with the dedicated container from the README (podman run --rm -ti -v postfix-custom:/srv:z alpine vi /srv/master.append) and restart: Postfix is running again.submissionentry replaced, change the restricted sender setting from the UI: the replaced entry does not follow it, as documented in the README.master.appendfile, restore it: the file is restored and its entries apply.main.cf:postconf -ndoes not contain themaster.appendlines.DavidePrincipi commentedon Nov 27, 2026
VERIFIED