critical
<source> blocks come in two breeds, and they behave differently.
Address blocks name one address (10.0.0.5) or a network in classless notation (10/8). A connection falls under all blocks whose addresses cover it, and the settings add up — exactly as with receiver blocks: where two blocks say different things, the narrower one wins.
The manual prints its own example twice — as written and as the engine sees it after merging. It is the clearest passage in the chapter: reading the configuration line by line is useless; what takes effect is not a line but the sum of lines.
Named blocks (<source S1>) are not matched against addresses at all. They are enabled only when referenced by name: with the source= parameter on smtp-listener or with the source directive inside <smtp-user>.
What happens to the address settings in that case the manual describes in one word: the named block overrides what was matched by address. The word promises inheritance — a setting the named block says nothing about should come to it from the address block.
For us it turned out differently. Return address rewriting set in the general 0/0 block did not carry over to an authenticated connection: the address stayed unchanged until the same line was repeated in the named block. Hence the rule by which the Hub now assembles the configuration — the named block repeats the whole set, not just what differs.
Names in curly braces are reserved. The manual names two: {pickup} changes how the pickup directory is processed, {auth} sets defaults for any authenticated user.
Hence the practical rule: a permission granted in the 0/0 block also applies to all subnets for which nothing to the contrary is said. “Grant it only to our own” means a ban in the wide block and a permission in the narrow one, not the other way around.
In the main file there are address blocks: 127.0.0.1 for submission from the machine itself, a block for each address in “Who may submit mail”, and 0/0 as the common base. The narrow block inherits from the wide one everything it does not say itself: stream selection by submission address, the selection list and the suppression of local reports. In the base configuration, installed before any pairs exist, 0/0 has neither stream selection nor the list yet.
In the addresses file there are named ones, one per submission login: the common {pmta-auth} and a block for each “domain plus address” pair. The source directive inside <smtp-user> refers to them. In each such block the Hub writes out the full set — the submission service, the relaying permission, the authentication requirement, stream selection, the suppression of local reports, header handling — not just the differences from the address blocks. This is not out of caution: we did not see inheritance reach the authenticated connection.
The Hub puts names in curly braces — a format shared with Protosender. The manual declares this namespace reserved and names two of its own names in it; ours do not resemble them and they work, but the namespace is still the vendor’s.
# both blocks cover submission from the machine itself — they act merged <source 0/0> default-virtual-mta by-smtp-source-ip add-received-header false </source> <source 127.0.0.1> always-allow-relaying yes max-message-size 30M </source>
what people get wrong and how it ends4 mistakes▶
§ 3.3.7
§ 3.3.7
our experience
our experience
3 relations
smtp-listenerGlobalThe source= parameter on a listener selects a named block and cancels address matching altogether. § 3.3.7source<smtp-user>An authenticated user can be bound to a named block. § 3.3.7
Headers the sender uses to control deliveryAll permissions are set on the source and obey its merging. § 3.3.7bcc<source>It follows source merging like any block setting: the copy is taken from the submission whose address fell under the block. § 3.3.7.3smtp-service<source>Source merging is what makes the “deny in the wide block, allow in the narrow one” technique work. § 3.3.7.63How the policy for a receiver is assembledThe same merging mechanism for senders: there it decides receiving, here delivery. § 3.3.10The load balancer header at the entranceThe address extracted from the header is what gets matched against the source list. § 3.3.17.16source<smtp-listener>Cancels the usual address-based block matching for this port. § 3.3.17.3
grep -n '^<source\|^</source' /etc/pmta/config /etc/pmta/virtualhost.txt pmta test config
3 articles
◇Configuration through the API and the file do not reconcileObjects created through the configuration interface cannot be edited in the file: two sources of truth about the configuration do not reconcile.◇Submission logins, plain-text passwords and per-user settingsA sender logs in with one of three methods; each login is a configuration block with a plain-text password, and that login’s named source overrides what its address would have given.◇Accept, route, deliverA message’s path inside the node: accept, decide where, deliver — and all the settings live between these three steps.