Skip to content
subuilds.dev

← logbuild #18 passed8cbbde1

OPNsense Hardening: Lock Down Your Firewall After Install

Seven steps to harden a fresh OPNsense install: limit the admin interface, lock down SSH, turn on automatic updates, turn off unused services, check the firewall rules, and set up Suricata IDS.

· 7 min read

OPNsense protects your network. But the firewall itself also needs protection. By default, the admin GUI listens on every interface, including WAN. SSH accepts passwords. The default firewall ruleset still has loose allow-all rules from the install wizard. To close weak points like these is called hardening.

These are the seven steps I run on every fresh OPNsense install before it handles real traffic.

Environment: OPNsense 26.1.2, single LAN subnet 10.10.1.0/24, OPNsense LAN IP 10.10.1.3.


In Simple Words#

The problem
A fresh OPNsense install protects your network, but the firewall itself is easy to attack. Anyone who can reach your WAN IP can try to log in to the admin page.
The root cause
The default settings are loose. The admin GUI listens on every interface, SSH accepts passwords, and the install wizard leaves allow-all firewall rules.
The solution
This post has seven steps. Limit the GUI to LAN and use SSH keys only. Turn on automatic updates and Suricata. Turn off unused services, check the firewall rules, and back up the config.
Think of it like this
You pay a guard to watch your house. But the guard’s own room has an unlocked door to the street. Lock that door, give keys only to people you trust, and keep a copy of the house plan in a safe place.

The diagram shows the seven steps of this guide:

  1. A fresh install: the admin GUI listens on every interface. Anyone who can reach your WAN IP can try to log in.
  2. Step 1: the GUI listens on LAN only, on port 8443. The internet cannot reach the login page.
  3. Step 2: SSH accepts keys only, on port 2222. Password login is off.
  4. Steps 3 and 4: OPNsense installs updates every week, and unused services are off.
  5. Steps 5 and 6: you check the firewall rules, and Suricata watches the traffic from WAN.
  6. Step 7: you download the config file and store it in a safe place.
6 / 6

1. Restrict the Admin Interface to LAN Only#

By default, the web GUI listens on all interfaces, including WAN. Anyone who can reach your WAN IP can try to log in.

Go to System → Settings → Administration:

Setting Recommended Value
Protocol HTTPS
SSL Certificate Your own cert or self-signed
TCP port 8443 (or any non-standard port)
Listen Interfaces LAN only (uncheck WAN and any others)
HTTP Redirect Enable (redirect port 80 → HTTPS)
Anti-lockout rule Keep enabled during setup

Click Save.


2. Harden SSH Access#

Go to System → Settings → Administration → Secure Shell:

  • Enable SSH only if you really use it. If you do not, disable it
  • Set Login Group to admins only
  • Set SSH Authentication Method to Public Key Only
  • Change the port from 22 to a non-standard port (for example 2222)

Add your public key under System → Access → Users → your user → Authorized keys.

bash
ssh -p 2222 -i ~/.ssh/id_ed25519 [email protected]

When you have checked that the key login works, disable password authentication completely.


3. Enable Automatic Firmware Updates#

Go to System → Firmware → Settings:

  • Set Release type to Production
  • Enable Automatic updates
  • Set the update schedule to weekly (for example Sunday at 03:00)

OPNsense downloads the updates and prepares them for install. For critical security patches, also enable Auto-reboot after update. Then OPNsense applies them automatically, outside your busy hours.


4. Disable Unused Services#

Every enabled service is an attack surface. Go to System → Settings → Administration and disable what you don’t use:

Service Disable if…
SSH You manage OPNsense only via the web GUI
Console menu Physical access to the machine is restricted
mDNS repeater You don’t need Bonjour/Avahi across VLANs

Also check:

  • VPN: disable OpenVPN, WireGuard, and IPsec if you do not use them
  • Services: stop and disable Dyndns, Proxy, Stunnel, and anything else your setup does not need

5. Audit the Firewall Ruleset#

To audit the ruleset means to check every rule. The install wizard creates loose rules. They are fine for a first start, but you should make them stricter before real use.

Go to Firewall → Rules and look at each interface.

Common problems to look for:

Problem Fix
Any-to-any allow rule on LAN, left over from the install defaults Replace it with one clear rule for each allowed destination
WAN rules that allow inbound on wide port ranges Each open port needs a written reason and should be as specific as possible
No outbound NAT rules Add source-based rules so IoT devices can reach the internet but not your LAN servers

6. Enable Intrusion Detection (Suricata)#

Do you open any service to the internet, such as a VPN endpoint or a port forward to a home server? Then Suricata adds an important layer of detection. It watches traffic for known attack patterns, called signatures. It can also drop malicious (harmful) packets before they reach your services.

Go to Services → Intrusion Detection → Administration:

  • Enable IDS on the WAN interface
  • Download Emerging Threats Open rulesets
  • Start in IDS mode (alerts only) for a week, so you can watch the traffic without blocking. Then move to IPS mode

7. Back Up the Configuration#

Go to System → Configuration → Backups → Download configuration.

Store the config XML in a safe place: a password manager, an encrypted USB drive, or your NAS. Download it again after any big change. If you ever need to rebuild OPNsense, this file restores everything in minutes.


End State#

  1. A fresh install: the admin GUI listens on every interface. Anyone who can reach your WAN IP can try to log in.
  2. Step 1: the GUI listens on LAN only, on port 8443. The internet cannot reach the login page.
  3. Step 2: SSH accepts keys only, on port 2222. Password login is off.
  4. Steps 3 and 4: OPNsense installs updates every week, and unused services are off.
  5. Steps 5 and 6: you check the firewall rules, and Suricata watches the traffic from WAN.
  6. Step 7: you download the config file and store it in a safe place.
6 / 6

After you finish this guide:

  • Web GUI limited to LAN, on a non-standard port
  • SSH with keys only, password login disabled (or SSH fully disabled)
  • Firmware updates scheduled every week
  • Unused services disabled
  • Firewall ruleset checked and made stricter
  • Suricata watching WAN traffic

What to Do Next#

Do you want to see what OPNsense and Suricata report over time? The Grafana + Prometheus homelab stack exports firewall and IDS metrics into dashboards. They show the most blocked domains, alert trends, and traffic by host.

For more detail on IDS (rule tuning, IPS mode, and safe attack simulation), continue to the OPNsense Intrusion Detection Guide.