KFC MAIL — PROXMOX MAIL GATEWAY
Installed and tested 1 November 2026
Cutover completed: public-hostname TCP 25 reaches PMG with valid TLS, and
kfc-pmg-inbound-lock is enabled on Mailcow. PMG delivery/recipient verification
works; direct LAN Mailcow port 25 is blocked. Client 587/465/993 remain available.

DEPLOYMENT AND ACCESS
Proxmox pve4 / 192.168.0.247, VM 120, pmg.local.kfc.network.
2 cores, 4 GiB RAM, 40 GiB local-lvm disk, guest agent, onboot enabled.
NIC vmbr0, VLAN 4, MAC BC:24:11:53:48:BD.
Static 10.0.2.161/24, gateway 10.0.2.1, interface ens18.
No ARP owner was found before allocation. Reserve/exclude this address from DHCP
in UniFi to avoid future collisions. No UniFi login or DHCP change was made.
PMG 9.1.4 on Debian 13 with official no-subscription repository/Proxmox kernel.
Cloud-init disabled after provisioning to preserve static networking/host keys.

Management: https://pmg.local.kfc.network, user root, Linux PAM realm (root@pam).
The strong initial password is delivered separately, never in source.
BunkerWeb 1.6.17 at 192.168.0.130 provides verified HTTPS, LAN-only source ACL,
verified/pinned upstream TLS and WAF block mode. Forwarded source headers are
not trusted. The native API certificate pin is /etc/bunkerweb/kfc-pmg-backend-ca.pem
on BunkerWeb, upstream name pmg. If PMG regenerates that certificate, verify the
replacement via Proxmox console before replacing the pin. The outer certificate
uses Let's Encrypt DNS-01. DNS points to the private proxy IP, DNS-only.
PMG SSH/8006 accept private IPv4 sources only; TCP 25 is public; TCP 26 is closed
to LAN clients. No WAN management forward is required. KFC Mail permission
groups and PMG administrator accounts remain separate.
OS SSH accepts keys only. The temporary installation key was revoked/deleted;
the restricted Mailcow sync key remains. Use the Proxmox console for OS access.

WAF false-positive correction, 21:36 UTC: CRS 934190 matched the legitimate
REQUEST_FILENAME /api2/{json,extjs}/nodes/localhost/... as scheme-less SSRF.
Repeated dashboard polls triggered a service-scoped bad-behavior ban for the
LAN client 10.0.1.122. Only that PMG ban was lifted. The native BunkerWeb custom
config modsec/kfc-pmg-localhost-node (service pmg.local.kfc.network) excludes only
REQUEST_FILENAME from 934190 on the anchored, normalized localhost node path for
GET/POST/PUT/DELETE. Arguments/cookies and other paths/methods remain inspected;
949110 and WAF block mode remain active. Source: bunkerweb-localhost-node.conf.
Native DB backup: /var/backups/kfc-pmg-waf-20261101T213629Z/database.sqlite3.
nginx syntax and scheduler reload passed. Authenticated dashboard, repositories,
subscription and rules requests returned 200. SSRF query-argument, other-path,
HEAD-method and scanner User-Agent controls returned 403. No IP allowlist was
added. If a future request is blocked, use its Request ID to locate the matching
access/audit logs; repeated 403 polling can trigger another bad-behavior ban.

ROUTING AND CUTOVER
Internet TCP 25 -> 10.0.2.161:25 -> 10.0.2.160:25 -> Dovecot -> KFC Mail.
Change only UniFi public TCP 25. Keep web, submission 587/465 and IMAP forwards
on Mailcow. MX and mail.kfc.network public DNS do not need changing.
Verify public port 25 EHLO says pmg.local.kfc.network, and STARTTLS validates for
mail.kfc.network, BEFORE restricting incoming Mailcow port 25:
  bash /opt/plmail/deploy/mailcow/pmg/enable-inbound-lock.sh
This uses dedicated IPv4/IPv6 DOCKER-USER chains: incoming ens18 port 25 accepts
only 10.0.2.161 and blocks an IPv6 port-25 bypass. Submission, IMAP, web and
container-local delivery are unaffected. The service follows Docker restarts.
  systemctl status kfc-pmg-inbound-lock
  /usr/local/sbin/kfc-pmg-inbound-lock --check
Do not enable before the router switch. To roll back, FIRST remove the lock:
  systemctl disable --now kfc-pmg-inbound-lock
Then forward public TCP 25 back to 10.0.2.160:25. Leave the AWS relay unchanged.
Until the lock is enabled, direct incoming SMTP can bypass the gateway.

Client apps still use authenticated mail.kfc.network:587 with STARTTLS and their
alerts credentials. PMG is not an unauthenticated outbound relay. Mailcow's
sender permission checks remain active; external recipients retain AWS/SES.
Hosted recipients, including administrator alerts, deliver locally without AWS.
Mailcow's existing @kfc.network catch-all remains active, so unknown hosted
recipients are accepted by design. Unauthenticated external relay was refused.

FILTERING
PMG runs SpamAssassin, DNS reputation checks, greylisting, ClamAV and recipient
verification before queueing. Score 3 subject rewriting is off; score 5+ goes
to spam quarantine for 14 days. Virus quarantine is 7 days. Dangerous-file rules
quarantine whole messages instead of stripping attachments. Signed headers and
bodies stay intact for release. End-user quarantine reports are off; use the
native PMG spam/virus quarantine UI to review messages. Do not release malware.
Virus notifications go from alerts@kfc.network to admins@kfc.network, the existing
alias synchronized with active KFC Mail administrators. Test notifications
reached Jamie's INBOX internally. This grants no end-user sender permissions.

Mailcow Rspamd remains a second check. Only connecting IP 10.0.2.161 may supply
trusted forwarding metadata. SPF/DKIM/DMARC still run. Gateway-delivered mail that
Rspamd would reject is marked as spam instead, avoiding downstream bounces to
forged senders after PMG acceptance. Scanner/rate-limit temporary failures remain
temporary failures. SPOOFED_UNAUTH excludes aligned DMARC-pass mail, fixing false
positives on correctly signed forwarded mail. Forged/unsigned checks still work.
  bash /opt/plmail/deploy/mailcow/pmg/install-mailcow-relay.sh
This backs up touched files and checks syntax before restart. Review upstream
Mailcow/Rspamd template/composite changes when upgrading.

DNS AND ANTIVIRUS
PMG Unbound recurses locally with DNSSEC. SpamAssassin explicitly uses 127.0.0.1
in /etc/mail/spamassassin/custom.cf. Keep 10.0.2.160 and 10.0.2.161 exempt from
UniFi DNS/ad-block redirection. Allow outbound UDP/TCP 53, HTTPS and NTP.
Post-reboot checks passed: signed-domain AD, bogus-domain SERVFAIL, Spamhaus ZEN
127.0.0.2/4/10, URIBL 127.0.0.14 and SURBL 127.0.0.254 test responses.
The Proxmox kernel exposed an AppArmor ABI issue in Debian ClamAV/Unbound profiles.
Explicit ABI 3.0 fixes IPC while keeping enforcement. ClamAV additionally has
read-only PMG active/virus spool access. See fix-clamav-profile.sh and
fix-unbound-profile.sh; recheck after profile package upgrades. Primary reference:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1110135
Harmless standard EICAR and GTUBE fixtures were quarantined before and after
reboot. Signed mail reached the disposable recipient inbox with DKIM/DMARC pass
and no AWS hop. Test mailboxes and recorded quarantine fixtures were removed.

CERTIFICATES AND DOMAINS
Mailcow's existing Let's Encrypt mail.kfc.network certificate is copied over
restricted SSH to PMG /etc/pmg/pmg-tls.pem every five minutes; native API TLS is
separate. Renewals propagate automatically. Active Mailcow domains are mirrored;
only previously integration-managed domains are removed, manual extras preserved.
  systemctl status kfc-pmg-sync.timer
  journalctl -u kfc-pmg-sync.service --since today
  systemctl start kfc-pmg-sync.service
Root-only /var/lib/kfc-pmg-sync contains config.json, id_ed25519 and pinned
known_hosts. The PMG authorized key uses restrict, from=10.0.2.160 and the forced
command /usr/local/sbin/kfc-pmg-mailcow-sync. No shell/forwarding is available.
The receiver validates hostname/key/expiry and has bounded input. Private keys
are never logged. Previous certificate permits rollback. Source: receive-sync.py.
  bash /opt/plmail/deploy/mailcow/pmg/install-sync-runtime.sh
The KFC Mail update script refreshes existing gateway runtime code and relay
integration only when the private gateway config exists. It never auto-enables
the incoming lock. Update the receiver separately using trusted administrative SSH.
The missing dkim._domainkey.kfc.network TXT was restored from Mailcow's public
key. Actual forwarded mail now passes DKIM/DMARC. No private DKIM key was exported;
existing SES selectors, SPF and DMARC policy were preserved.

BACKUPS AND RECOVERY
Full Proxmox VM backup on pve4-nas-proxmox:
backup/vzdump-qemu-120-2026_11_01-20_49_32.vma.zst (about 1.86 GB).
  pvesm list pve4-nas-proxmox --vmid 120
PMG native config: /var/lib/pmg/backup/pmg-backup_2026_11_01_6AE7A5D8.tgz
Root integration copy: /var/backups/kfc-pmg/ready/config-and-integration.tar.gz
Mailcow integration state: /opt/plmail-backups/installation/pmg-integration.tar.gz
BunkerWeb DB snapshot: /var/backups/kfc-pmg-proxy-20261101T202202Z/.
Proxmox /var/lib/kfc-pmg stores initial root password/VM metadata with mode 600.
Private backups contain keys/password hashes: never include them in source.
Create recurring Proxmox backups with your preferred retention; this deployment
created a full backup, not a recurring schedule. The backup predates fixture
cleanup and can contain harmless test quarantine records, not executable malware.
These scripts describe this deployment's fixed addresses and installed PMG rule
IDs. configure-gateway.py is initial setup, not a generic unattended installer
or a command to reset a customized ruleset. Review before reapplying it.
