Skip to content
Module 2 · Lesson 6 of 26

Firewall and fail2ban basics

Part of Mailcow: Self-Hosted Mail Server Mastery, in the Server Prerequisites & DNS module.

Author

Mailcow expects these inbound ports open from the internet:

Port Service
25 SMTP (inbound MX)
465 SMTPS submission
587 Submission with STARTTLS
993 IMAPS
995 POP3S
4190 ManageSieve
80 HTTP (ACME challenge + redirect)
443 HTTPS (admin UI + webmail)

UFW example:

ufw allow 25,80,443,465,587,993,995,4190/tcp

fail2ban inside Mailcow: the netfilter-mailcow container already runs fail2ban-style banning. Don't run host-level fail2ban on the same ports, because it fights the container's NFTables rules.

Block port 110 and 143 (cleartext IMAP/POP3). Mailcow leaves them open by default for legacy clients; close them at the firewall unless you need them.

Sign in to keep track of what you have read.

Pulse · email sending

Sending infrastructure that is yours alone.

Every domain gets its own MX host, IP, DKIM selector and certificate. Take it managed, and we run it for you, or buy a licence and run it on your own servers.

# on a fresh Ubuntu server
$ cd pulse && sudo ./install.sh
→ docker compose up · kumomta · stalwart · caddy
→ dashboard ready on https://pulse.yourdomain.com
$

Also from us:Beat: monitoring that tells you the fixConsulting: $65/hr, no retainer