QUICK START · 3 MINUTES

Up and Running with GoMilterD

GoMilterD compiles to a single static binary with zero runtime dependencies. Follow these steps to build the daemon, enable core email authentication (IPRev, SPF, DKIM, DMARC, Authentication-Results), and attach it to Postfix.

1. Prerequisites

2. Download & Build

Clone the repository and compile the binary from cmd/gomilterd:

git clone https://github.com/emailabuse-net/gomilterd.git
cd gomilterd
go build -o gomilterd ./cmd/gomilterd
sudo install -m 755 gomilterd /usr/local/bin/gomilterd

3. Create a Minimal gomilterd.yaml

Migrating existing milters? Run sudo python3 convert.py -o /etc/gomilterd/gomilterd.yaml to auto-import your Postfix/Sendmail RBLs and existing OpenDKIM, OpenDMARC, OpenARC, SPF, ClamAV, or greylist configs. See Migrating Existing Milters for CLI flags and details.

Or create /etc/gomilterd/gomilterd.yaml from scratch with core authentication enabled:

network: "unix"
address: "/var/run/gomilterd/gomilterd.sock"
max_connections: 1024

authserv_id: "mx.example.com"

resolvers:
  - "127.0.0.1:53"
timeout_ms: 3000

trusted_networks:
  - "127.0.0.0/8"
  - "::1/128"

pre_flight_check: true

iprev:
  enabled: true
  auth_results: true

spf:
  enabled: true
  auth_results: true

dkim:
  enabled: true
  verify: true
  auth_results: true

dmarc:
  enabled: true
  auth_results: true

auth_results:
  enabled: true

Start the daemon to verify pre-flight checks pass and the socket binds cleanly:

gomilterd /etc/gomilterd/gomilterd.yaml

4. Wire Into Postfix

Add the milter socket and required macros to /etc/postfix/main.cf:

smtpd_milters = unix:/var/run/gomilterd/gomilterd.sock
non_smtpd_milters = $smtpd_milters
milter_default_action = tempfail
milter_protocol = 6

milter_connect_macros = j i _ {daemon_name} {daemon_port} {client_name} {client_ptr} {client_resolve}
milter_helo_macros = s {tls_version} {cipher} {cipher_bits} {cert_authority} {cert_subject} {cert_issuer}
milter_mail_macros = i f {auth_type} {auth_authen} {auth_author} {auth_method}
milter_rcpt_macros = i {rcpt_addr} {rcpt_domain}
sudo postfix reload
Postfix Chroot Note: If Postfix smtpd runs chrooted in /var/spool/postfix, place the socket inside the chroot (e.g., /var/spool/postfix/gomilterd/gomilterd.sock) and reference it as unix:gomilterd/gomilterd.sock in main.cf.

5. Test Atomic Hot-Reload

After editing gomilterd.yaml, send SIGHUP. Active SMTP sessions finish on their existing snapshot while new connections immediately pick up the new config:

kill -HUP $(pgrep gomilterd)

Next Steps