CIS Postfix Benchmark

Security configuration recommendations for Postfix MTA

v1.0.0 01-2025

Overview

▶

This benchmark provides prescriptive guidance for establishing a secure configuration posture for Postfix mail transfer agent deployments. It covers installation hardening, SMTP authentication via SASL, TLS encryption for both inbound and outbound mail, anti-spam restrictions, SPF/DKIM integration, logging, and chroot isolation using postconf, master.cf, and related mail security tools.

17Recommendations
7Sections
2Profile Levels
SectionAreaFocus
1Installation & ConfigurationVersion management, relay scope, and file permissions
2SMTP AuthenticationSASL authentication and relay restriction enforcement
3TLS EncryptionInbound/outbound TLS and protocol version restrictions
4Anti-Spam & Anti-AbuseHELO restrictions, sender validation, and rate limiting
5Email AuthenticationSPF policy checking and DKIM signing integration
6Logging & MonitoringMail facility logging and queue monitoring
7Chroot & PrivilegesService chroot isolation and dedicated user enforcement

Profile Definitions

▶
ProfileDescriptionIntended Use
L1Level 1 — StandardEssential security for all Postfix deployments; minimal performance impact.
L2Level 2 — HardenedAdvanced hardening for PCI-DSS, HIPAA, or high-security environments.

1 — Installation & Configuration

▶

1.1 Base Setup

▶
1.1.1 Ensure Postfix is up to date (Automated)
L1 Auto
Description

This recommendation verifies that Postfix is up to date on the Postfix mail transfer agent. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Postfix mail transfer agent vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check Postfix version:
postconf mail_version
postconf -d | grep mail_version
dpkg -l postfix 2>/dev/null || rpm -qa postfix
Remediation
# Update Postfix:
sudo apt-get update && sudo apt-get install -y postfix
# or
sudo yum update -y postfix
sudo systemctl restart postfix
1.1.2 Ensure default configuration restricts relay scope (Automated)
L1 Auto
Description

This recommendation verifies that default configuration restricts relay scope on the Postfix mail transfer agent. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Postfix mail transfer agent vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check Postfix configuration:
postconf -n
postconf inet_interfaces mydestination mynetworks
Remediation
# Configure Postfix main.cf essentials:
postconf -e 'inet_interfaces = loopback-only'
postconf -e 'mydestination = $myhostname, localhost.$mydomain, localhost'
postconf -e 'mynetworks = 127.0.0.0/8 [::1]/128'
postconf -e 'relayhost = [smtp-relay.example.com]:587'
sudo systemctl reload postfix
1.1.3 Ensure configuration file permissions are correct (Automated)
L1 Auto
Description

This recommendation verifies that configuration file permissions are correct on the Postfix mail transfer agent. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Postfix mail transfer agent vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check file permissions:
ls -la /etc/postfix/main.cf /etc/postfix/master.cf
find /etc/postfix -type f -exec stat -c '%a %U:%G %n' {} \;
Remediation
# Set correct permissions:
chown root:root /etc/postfix/main.cf /etc/postfix/master.cf
chmod 644 /etc/postfix/main.cf
chmod 644 /etc/postfix/master.cf
chmod 755 /etc/postfix

2 — SMTP Authentication

▶

2.1 SASL Configuration

▶
2.1.1 Ensure SASL authentication is enabled with secure options (Automated)
L1 Auto
Description

This recommendation verifies that SASL authentication is enabled with secure options on the Postfix mail transfer agent. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Postfix mail transfer agent vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check SASL authentication:
postconf smtpd_sasl_auth_enable smtpd_sasl_type smtpd_sasl_security_options
grep -i sasl /etc/postfix/main.cf
Remediation
# Enable SASL authentication:
postconf -e 'smtpd_sasl_auth_enable = yes'
postconf -e 'smtpd_sasl_type = dovecot'
postconf -e 'smtpd_sasl_path = private/auth'
postconf -e 'smtpd_sasl_security_options = noanonymous, noplaintext'
postconf -e 'smtpd_sasl_tls_security_options = noanonymous'
sudo systemctl reload postfix
2.1.2 Ensure relay restrictions require authentication (Automated)
L1 Auto
Description

This recommendation ensures that relay restrictions require authentication on the Postfix mail transfer agent. Enforcing this requirement establishes a minimum security standard and prevents insecure configurations.

Rationale

Without this enforcement, the Postfix mail transfer agent may accept insecure configurations that weaken overall security posture. Mandating this control ensures consistent protection against common attack vectors.

Audit
# Check relay restrictions:
postconf smtpd_relay_restrictions smtpd_recipient_restrictions
Remediation
# Configure relay restrictions:
postconf -e 'smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination'
postconf -e 'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_non_fqdn_recipient'
sudo systemctl reload postfix

3 — TLS Encryption

▶

3.1 Transport Security

▶
3.1.1 Ensure TLS is enabled for inbound connections (Automated)
L1 Auto
Description

This recommendation verifies that TLS is enabled for inbound connections on the Postfix mail transfer agent. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Postfix mail transfer agent vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check TLS settings:
postconf smtpd_tls_cert_file smtpd_tls_key_file smtpd_tls_security_level
postconf smtp_tls_security_level smtp_tls_loglevel
Remediation
# Enable mandatory TLS:
postconf -e 'smtpd_tls_cert_file = /etc/ssl/certs/mail.pem'
postconf -e 'smtpd_tls_key_file = /etc/ssl/private/mail.key'
postconf -e 'smtpd_tls_security_level = may'
postconf -e 'smtpd_tls_auth_only = yes'
postconf -e 'smtpd_tls_loglevel = 1'
postconf -e 'smtpd_tls_received_header = yes'
sudo systemctl reload postfix
3.1.2 Ensure TLS is enabled for outbound connections (Automated)
L1 Auto
Description

This recommendation verifies that TLS is enabled for outbound connections on the Postfix mail transfer agent. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Postfix mail transfer agent vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check outgoing TLS:
postconf smtp_tls_security_level smtp_tls_mandatory_protocols smtp_tls_mandatory_ciphers
Remediation
# Configure outgoing TLS:
postconf -e 'smtp_tls_security_level = may'
postconf -e 'smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1'
postconf -e 'smtp_tls_mandatory_ciphers = high'
postconf -e 'smtp_tls_loglevel = 1'
postconf -e 'smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache'
sudo systemctl reload postfix
3.1.3 Ensure only TLS 1.2 or higher is accepted (Automated)
L1 Auto
Description

This recommendation verifies that only TLS 1.2 or higher is accepted on the Postfix mail transfer agent. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Postfix mail transfer agent vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check TLS protocol versions:
postconf smtpd_tls_mandatory_protocols smtpd_tls_protocols
postconf tls_preempt_cipherlist
Remediation
# Restrict to TLS 1.2+:
postconf -e 'smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1'
postconf -e 'smtpd_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1'
postconf -e 'tls_preempt_cipherlist = yes'
postconf -e 'smtpd_tls_mandatory_ciphers = high'
sudo systemctl reload postfix

4 — Anti-Spam & Anti-Abuse

▶

4.1 SMTP Restrictions

▶
4.1.1 Ensure HELO restrictions are configured (Automated)
L1 Auto
Description

This recommendation verifies that HELO restrictions are configured on the Postfix mail transfer agent. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Postfix mail transfer agent vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check HELO restrictions:
postconf smtpd_helo_required smtpd_helo_restrictions
Remediation
# Enable HELO restrictions:
postconf -e 'smtpd_helo_required = yes'
postconf -e 'smtpd_helo_restrictions = permit_mynetworks, reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname, reject_unknown_helo_hostname'
sudo systemctl reload postfix
4.1.2 Ensure sender restrictions reject invalid domains (Automated)
L1 Auto
Description

This recommendation verifies that sender restrictions reject invalid domains on the Postfix mail transfer agent. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Postfix mail transfer agent vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check sender restrictions:
postconf smtpd_sender_restrictions
Remediation
# Configure sender restrictions:
postconf -e 'smtpd_sender_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_sender, reject_unknown_sender_domain'
sudo systemctl reload postfix
4.1.3 Ensure rate limiting is enabled (Automated)
L1 Auto
Description

This recommendation verifies that rate limiting is enabled on the Postfix mail transfer agent. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Postfix mail transfer agent vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check rate limiting:
postconf smtpd_client_message_rate_limit smtpd_client_recipient_rate_limit anvil_rate_time_unit
Remediation
# Enable rate limiting:
postconf -e 'smtpd_client_message_rate_limit = 100'
postconf -e 'smtpd_client_recipient_rate_limit = 50'
postconf -e 'smtpd_client_connection_rate_limit = 20'
postconf -e 'anvil_rate_time_unit = 60s'
sudo systemctl reload postfix

5 — Email Authentication

▶

5.1 SPF & DKIM

▶
5.1.1 Ensure SPF policy checking is enabled (Automated)
L1 Auto
Description

This recommendation verifies that SPF policy checking is enabled on the Postfix mail transfer agent. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Postfix mail transfer agent vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check SPF:
dig TXT $(postconf -h mydomain) | grep spf
postconf smtpd_recipient_restrictions | grep policy-spf
Remediation
# Enable SPF checking:
sudo apt-get install -y postfix-policyd-spf-python

# Add to master.cf:
# policy-spf  unix  -  n  n  -  0  spawn
#   user=policyd-spf argv=/usr/bin/policyd-spf

# Add to main.cf:
postconf -e 'smtpd_recipient_restrictions = ... check_policy_service unix:private/policy-spf'
postconf -e 'policy-spf_time_limit = 3600s'
5.1.2 Ensure DKIM signing is configured (Automated)
L1 Auto
Description

This recommendation verifies that DKIM signing is configured on the Postfix mail transfer agent. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Postfix mail transfer agent vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check DKIM:
apt list --installed 2>/dev/null | grep opendkim
rpm -qa | grep opendkim
systemctl status opendkim
Remediation
# Install and configure OpenDKIM:
sudo apt-get install -y opendkim opendkim-tools

# /etc/opendkim.conf:
# Mode sv
# KeyFile /etc/dkimkeys/default.private
# Selector default
# Domain example.com
# Socket inet:12301@localhost

# Add to main.cf:
postconf -e 'milter_default_action = accept'
postconf -e 'milter_protocol = 2'
postconf -e 'smtpd_milters = inet:localhost:12301'
postconf -e 'non_smtpd_milters = inet:localhost:12301'

6 — Logging & Monitoring

▶

6.1 Mail Logs

▶
6.1.1 Ensure mail logging is configured (Automated)
L1 Auto
Description

This recommendation verifies that mail logging is configured on the Postfix mail transfer agent. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Postfix mail transfer agent vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check mail logging:
postconf syslog_facility syslog_name
tail -20 /var/log/mail.log 2>/dev/null || tail -20 /var/log/maillog
Remediation
# Configure logging:
postconf -e 'syslog_facility = mail'
postconf -e 'syslog_name = postfix'

# Ensure rsyslog routes mail facility:
# /etc/rsyslog.d/50-default.conf:
# mail.*    /var/log/mail.log
# mail.err  /var/log/mail.err
sudo systemctl restart rsyslog
6.1.2 Ensure mail queue is monitored (Automated)
L1 Auto
Description

This recommendation verifies that mail queue is monitored on the Postfix mail transfer agent. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Postfix mail transfer agent vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check mail queue monitoring:
mailq
postqueue -p
qshape deferred | head -20
Remediation
# Monitor mail queue:
# Cron job to alert on large queue:
# */5 * * * * [ $(mailq | tail -1 | awk '{print $5}') -gt 100 ] && echo 'Mail queue > 100' | mail admin@example.com

# Check deferred queue:
postqueue -p | tail -1
qshape deferred

7 — Chroot & Privileges

▶

7.1 Process Isolation

▶
7.1.1 Ensure Postfix services run in chroot (Automated)
L1 Auto
Description

This recommendation verifies that Postfix services run in chroot on the Postfix mail transfer agent. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Postfix mail transfer agent vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check chroot status in master.cf:
awk '/^[a-z]/ {print $1, $5}' /etc/postfix/master.cf
Remediation
# Enable chroot for services in /etc/postfix/master.cf:
# Ensure column 5 (chroot) is 'y' for smtp, smtpd, cleanup, etc.:
# smtp      inet  n       -       y       -       -       smtpd
# pickup    unix  n       -       y       60      1       pickup
# cleanup   unix  n       -       y       -       0       cleanup

sudo systemctl restart postfix
7.1.2 Ensure Postfix runs as dedicated unprivileged user (Automated)
L1 Auto
Description

This recommendation verifies that Postfix runs as dedicated unprivileged user on the Postfix mail transfer agent. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Postfix mail transfer agent vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check Postfix process ownership:
ps aux | grep postfix
postconf mail_owner setgid_group
Remediation
# Ensure Postfix runs as dedicated user:
postconf -e 'mail_owner = postfix'
postconf -e 'setgid_group = postdrop'

# Verify user exists:
id postfix
id postdrop