PowerMTA

PowerMTA Security Hardening: 10 Best Practices for 2026

Practical checklist to lock down PowerMTA servers against brute force, unauthorized relay, and OS-level exploits. Includes firewall, TLS, auth, and monitoring steps.

By Shane0 views
PowerMTA Security Hardening: 10 Best Practices for 2026

A PowerMTA server that is reachable on the public internet becomes a target within minutes. Attackers probe for open SMTP relays, weak SSH credentials, and misconfigured listeners. PowerMTA security hardening is not a one-time checkbox; it is a set of layered controls you apply before the first production send.

This checklist covers essential OS-level hardening, configuration file permissions, SMTP authentication, network controls, and monitoring. Each step shows the manual method first, then points to automation where PMTAcore can reduce the work. By the end, you will have a repeatable hardening process for any PowerMTA installation.

Essential OS-Level Hardening for PowerMTA

Most PowerMTA installs run on AlmaLinux, Rocky Linux, or Ubuntu. The first line of defence is the operating system, not the MTA itself.

Remove Unused Services and Accounts

List listening services with ss -tulpn. Disable anything not needed for PowerMTA: cockpit, rpcbind, avahi, cups. Remove or lock unused accounts with passwd -l games and usermod -s /sbin/nologin nobody. Every active service is a potential exploit path.

SSH Hardening

Use key-based authentication only. Disable root login. Changing the SSH port adds only obfuscation; real protection comes from key auth and fail2ban. Edit /etc/ssh/sshd_config with these settings.


# Disable root SSH login and password auth
sed -i 's/^PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
sed -i 's/^PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
systemctl restart sshd

# Enable automatic security updates on AlmaLinux/Rocky
dnf install -y dnf-automatic
systemctl enable --now dnf-automatic.timer

# On Ubuntu
apt install -y unattended-upgrades
dpkg-reconfigure -plow unattended-upgrades

Kernel and Network Protections

Apply sysctl settings to block IP spoofing, redirects, and SYN floods.


cat >> /etc/sysctl.d/99-hardening.conf <<'EOF'
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv6.conf.all.accept_redirects = 0
EOF
sysctl --system
ControlRisk addressedExample command
SSH key-only authBrute force on rootPermitRootLogin no
Disable unused servicesReduce attack surfacesystemctl disable cockpit
Unattended updatesExploit known CVEsdnf-automatic.timer
Sysctl hardeningIP spoofing, SYN floodsnet.ipv4.tcp_syncookies = 1

Securing PowerMTA Configuration Files and Permissions

The main config is /etc/pmta/config on Linux. It contains SMTP credentials, relay domains, and delivery rules. If a compromised web user can read it, they can exfiltrate credentials or alter routing.

File Ownership and Modes

Run PowerMTA under a dedicated non-root user, commonly pmta. Set restrictive ownership and permissions.


chown root:pmta /etc/pmta/config
chmod 640 /etc/pmta/config
chown -R pmta:pmta /etc/pmta/
find /etc/pmta -type f -exec chmod 600 {} \;

After changes, validate the config with pmta show config.

Configuration Backup and Change Control

Keep /etc/pmta under version control with git. Before any change, copy the current config to /etc/pmta/config.YYYYMMDD. Use git init /etc/pmta and commit after each edit. PMTAcore's PowerMTA Management module automates installation and can snapshot configs during deployment; see PowerMTA Management for details. The manual approach works, but automation reduces drift across multiple servers.

SMTP Authentication and Access Control

An open relay is the fastest way to get your sending IPs blacklisted. PowerMTA does not require SMTP authentication by default, so you must configure every listener explicitly.

Enforce SMTP AUTH

Require authentication on submission ports 587 and 465. Do not enable AUTH on port 25 unless you accept inbound mail for local domains. Use strong, unique passwords per sending account. After configuration, test auth and TLS with PMTAcore's SMTP Tester or a manual openssl command.

Restrict Relay by Source IP and Domain

For each domain, define allowed source IPs inside a domain block. A typical PowerMTA config looks like this.



    allow 10.10.0.0/16
    allow 192.0.2.10



    allow 10.10.0.0/16
    max-message-rate 100/s

This prevents unauthorised hosts from injecting mail under your domains. For bulk senders, also set per-domain rate limits to slow down credential stuffing or a compromised application.

Fail2ban for SMTP Brute Force

Install fail2ban and create a jail for PowerMTA authentication failures. Configure a filter to parse /var/log/pmta/log for authentication failed. A basic jail looks like this.


[pmta-auth]
enabled = true
port = 25,587,465
filter = pmta-auth
logpath = /var/log/pmta/log
maxretry = 5
bantime = 3600

Adjust maxretry and bantime to match your traffic patterns. Too aggressive a ban can block legitimate users; too lenient allows brute force.

Network Security: Firewalls, TLS, and Rate Limiting

Firewall rules should allow only necessary ports and trusted management IPs. A default-deny policy is best.

Firewall Rules for SMTP and Management

On AlmaLinux/Rocky use firewalld; on Ubuntu use ufw. Port 25 may need to accept inbound mail from anywhere if you are a full MTA. If you only send outbound and receive via API, restrict port 25 to trusted relay sources. Ports 587 and 465 should be open only to your sending applications. SSH should be restricted to your office IP or VPN.


# Allow SMTP submission and SMTPS only from trusted management IP
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="203.0.113.10" port port="587" protocol="tcp" accept'
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="203.0.113.10" port port="465" protocol="tcp" accept'
firewall-cmd --permanent --remove-service=smtp
firewall-cmd --reload

Enforce TLS on Public Listeners

Use a valid certificate from Let's Encrypt or a commercial CA. Configure PowerMTA's tls-certificate and require-tls directives on public listeners. Test with openssl s_client -starttls smtp -connect your-server:25 or use PMTAcore's SMTP Tester for automated validation. Never run production mail over plaintext on public IPs.

Rate Limiting

Use PowerMTA's built-in max-message-rate and max-connection-rate per domain or VMTA. This slows credential stuffing and accidental mail floods. At the OS level, you can also use iptables hashlimit for SSH. If you run bulk campaigns through a self-hosted platform, Choco Mailer provides per-account rate limits and smart rotation, which reduces the chance of overloading PowerMTA and triggering protective measures.

Monitoring and Incident Response for PowerMTA

Hardening is not static; you must watch logs and reputation continuously.

Centralised Logging and Alerting

Ship PowerMTA logs to a central system with rsyslog or Vector. Alert on repeated authentication failures, bounce spikes, and config changes. Use journalctl -u pmta -f for live debugging, but centralise for long-term retention.

Blacklist Monitoring and Reputation Checks

Check your sending IPs against Spamhaus, Barracuda, and other DNSBLs. Manual check: dig +short 2.0.0.127.zen.spamhaus.org. PMTAcore's IP Blacklist Checker automates this across single IPs, bulk lists, or server groups; see IP Blacklist Checker. For inbox placement, external seedlist tools such as GlockApps or MXToolbox provide independent monitoring. That answers the common question about the best tool for testing deliverability: use a seedlist service that reports placement at Google, Microsoft, and Yahoo.

Incident Response Runbook

Write a runbook with clear steps, and rehearse it. A minimal runbook includes:

  • Isolate the affected server by removing its public IP or firewall rule.
  • Revoke all SMTP credentials and SSH keys.
  • Rotate DKIM keys and update DNS records.
  • Check PowerMTA config for unauthorised changes and restore from backup.
  • Review logs for the initial entry point.
  • Re-image the server if root access was achieved.

Some senders ask about the 12-second rule and the 30/30/50 rule for emails. Those are copywriting heuristics, not SMTP security settings. The 12-second rule refers to how long a recipient reads a sales email; the 30/30/50 rule is a cold email volume guideline. Neither affects server hardening.

PowerMTA security hardening is a continuous task. Use this checklist before every deployment, and automate the repetitive parts with PMTAcore. Start with the free trial or review license plans to see which tier fits your sending volume.

#powermta security hardening#powermta security configuration#email server hardening#smtp security best practices#powermta#email infrastructure