Per-replica EHLO name: KARTA_OUTBOUND_HOSTNAME=auto #102
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "outbound-hostname-auto"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
KARTA_OUTBOUND_HOSTNAME=autolearns each replica's outbound name: the PTR record of the address the node sends from, forward-confirmed (the PTR name's A/AAAA record must lead back). It keeps the name for an hour and learns it again on the next delivery after that. A fixed value is used exactly as before. On failure it logs the reason and usesKARTA_OUTBOUND_HOSTNAME_FALLBACK(defaultKARTA_SMTP_HOSTNAME, else the system host name); a name already learned is kept rather than replaced.The learned name is used wherever Karta names itself:
EHLO/HELOof outbound delivery (Karta.Outbound.Deliverer), the inbound relay (Karta.Inbound.Dispatcher) and the MTA-STS probeMessage-ID/Receivedfields Karta writes (Karta.Sending)Reporting-MTAandMessage-IDWhy
Two replicas of Karta that send from different addresses (two nodes, each source-NAT'd to its own public IP) must greet with their own address's name. One fleet-wide value cannot do that, and an IP pool cannot be used in a Swarm overlay because the pool address is not on the replica's interface. This is slice K1 of
docs/suite/plans/karta-two-replicas-plan.md.The limitation, stated plainly
The egress address is read as the local address of a connection, so it is the address receiving servers see only when the public address is on Karta's own interface (host networking, macvlan, bare metal). In a container whose packets the host source-NATs (Docker bridge or Swarm overlay), that address is private, its PTR record does not lead back, and
autologs the reason and uses the fallback every hour. The operations guide says so in Replicas § The name in EHLO. Making this work in a Swarm overlay needs a public-address echo or host networking — a separate decision.autolearns one name, so it wants one IP family (ipv4_only/ipv6_only); withprefer_ipv4/prefer_ipv6both families may be used and one name cannot match both PTRs. Documented.Tests
test/karta/outbound/hostname_test.exs(new): PTR + forward-confirmed choice, a PTR name that does not lead back, no PTR, IPv6, family fall-through, fixed value untouched, caching for an hour, fallback with the reason logged, keeping a previously learned name when a re-check fails — all with a fake DNS zone and a fake egress address.test/karta/outbound/deliverer_test.exs: anautodelivery greets withEHLO mta1.example.comon the wire (test SMTP peer).test/karta/runtime_config_test.exs: the fallback comes fromKARTA_OUTBOUND_HOSTNAME_FALLBACK, elseKARTA_SMTP_HOSTNAME; a fallback ofautostops the start.Docs and changelog
Configuration reference (the two variables), Replicas (new The name in EHLO section and audit row), installation, domains-and-DNS, delivery, IP pools, sending rules, API guide, the example
.env, and a CHANGELOG entry.mix precommit(format, compile with warnings as errors, credo strict, sobelow, deps audit, full test suite) passes: 3846 tests.mix docs --warnings-as-errorspasses.🤖 Generated with Claude Code