Archival Notice
This guide was written for legacy FreeBSD administration where Sendmail service overriding and source compiling in /usr/ports/mail/postfix was standard practice. Please adapt compilation parameters and verify user relay configurations before operating production MTA gateways.
Maintaining robust messaging transfer agents (MTAs) across secure communication centers (such as internal mail transfer relay clusters in east-dc1 or west-dc1) requires low-level compile and access tuning. Out of the box, FreeBSD sets legacy Sendmail daemons as the default mail transport agent. Reassigning local transport handlers requires compiling Postfix, disabling base Sendmail initialization daemons, and updating system configuration tables (mailer.conf).
In this infrastructure engineering manual, I explore how to compile Postfix from source ports, replace base system mail processing wrappers, and configure domain parameter limits inside main.cf.
Step 1: Compiling Postfix Source Packages
Access your local FreeBSD source ports tree directory and launch build commands for the Postfix MTA engine.
# Navigate to Postfix source ports directory
cd /usr/ports/mail/postfix
# Launch compilation engine
make install clean
Step 2: Overriding Legacy Base Sendmail Handlers (mailer.conf)
To permanently strip base Sendmail wrappers and route underlying messaging binaries directly to your compiled Postfix engine, modify /etc/mail/mailer.conf.
vi /etc/mail/mailer.conf
Replace default sendmail routing configuration properties with explicit Postfix execution bin paths:
# Execute Postfix drop-in wrappers
sendmail /usr/local/sbin/sendmail
send-mail /usr/local/sbin/sendmail
mailq /usr/local/sbin/sendmail
newaliases /usr/local/sbin/sendmail
Unbinding Base Sendmail Boot Triggers
Ensure FreeBSD startup daemons bypass Sendmail background tasks during system initialization by appending exclusion overrides to /etc/rc.conf:
# Disable Sendmail initialization
sysrc sendmail_enable="NONE"
sysrc sendmail_submit_enable="NO"
sysrc sendmail_outbound_enable="NO"
sysrc sendmail_msp_queue_enable="NO"
# Enable Postfix runtime initialization
sysrc postfix_enable="YES"
Step 3: Hardening Core Domain Policies (main.cf)
To establish secure inbound relay constraints and assign corporate identity domain bindings, modify the master Postfix configuration profile located inside /usr/local/etc/postfix/main.cf.
vi /usr/local/etc/postfix/main.cf
Insert hardened perimeter identities, descriptive hostname parameters, and safe access limits:
# Domain identification parameters
myhostname = mail.induslevel.com
mydomain = induslevel.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
# Restrict relay permissions to secure subnets
mynetworks = 127.0.0.0/8, 10.10.10.0/24
Rebuild system alias indexes and launch your compiled Postfix background processing daemons:
newaliases
service postfix start
MTA Secure
Your FreeBSD mail gateway is completely unlinked from obsolete sendmail handling and successfully managing messaging processing queues!