Blueprints · Systemd & Agents
Production
20 min · Postfix
Postfix send-only SMTP relay
Listens on loopback only and relays through an authenticated smarthost such as SES, Resend, or Brevo. The bundle writes the files and does not reload a running mail server.
Live config
Baked-in protections
- inet_interfaces is loopback-only
- The host is not an open relay
- SASL credentials are a mode 600 file
- DKIM and SPF are left to the relay domain, not generated here
Step 1 · conf
main.cf snippet
/etc/postfix/portgate-main.cf
Merge these into main.cf. Put the password only in sasl_passwd.
inet_interfaces = loopback-only inet_protocols = ipv4 mydestination = relayhost = [email-smtp.us-east-1.amazonaws.com]:587 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_tls_security_level = encrypt smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt myhostname = example.com
Step 2 · conf
SASL map
/etc/postfix/sasl_passwd
Replace the password. The apply script is not run, so an existing Postfix is left alone until you review it.
[email-smtp.us-east-1.amazonaws.com]:587 smtp-user:replace-with-smtp-password
Step 3 · bash
Apply notes
/root/portgate-blueprints/postfix-apply.sh
Run this yourself after the password is real. It refuses the placeholder password.
#!/bin/sh set -eu if grep -q 'replace-with-smtp-password' /etc/postfix/sasl_passwd; then echo "Set the SMTP password first." >&2 exit 1 fi chmod 600 /etc/postfix/sasl_passwd postmap /etc/postfix/sasl_passwd postfix reload