pfSense and OPNsense firewalls often guard small businesses, branch offices and labs with factory administrator accounts, a web interface reachable from too many networks and logs that never leave the box. Both are open source, FreeBSD-based firewalls with a web configurator, SSH, VPN services and package ecosystems, so the hardening problems are the same: who can administer the device, how they authenticate, what machine credentials exist, and whether anyone would notice a change. This guide gives a side-by-side hardening baseline for pfSense (Community Edition and Plus) and OPNsense, covering accounts and privileges, management plane exposure, API keys, VPN user authentication, remote logging and patching. It is for network and security engineers in SMB and mid-size environments, and for anyone building a benchmark-aligned configuration. Settings below were checked against the Netgate and OPNsense documentation on 27 October 2026. CIS publishes a CIS pfSense Firewall Benchmark (v1.1.1) and a CIS OPNsense Benchmark (v1.0.0); use those for audit-grade control text.
Key takeaways
- Change the factory account first. pfSense ships with
admin/pfsenseand OPNsense withroot/opnsense. Netgate's own documentation says not to keep the default even in a lab; pfSense Plus 24.03 and later force a change at first login. - The management plane belongs on one network. Bind the web GUI and SSH to a dedicated management interface, never WAN, and use firewall rules rather than relying on the anti-lockout rule.
- Use named accounts with group privileges. Both platforms support LDAP or RADIUS for authentication, but a local user is still required to carry privileges; build groups, not per-user grants.
- Treat API keys and SSH keys as non-human identities. OPNsense API key and secret pairs inherit the owning user's privileges; one key per application, a dedicated low-privilege user, and revocation when the integration ends.
- Logs must leave the firewall. pfSense's built-in remote syslog is UDP and cleartext, so send it over a management network or VPN, or use syslog-ng for TCP and TLS; OPNsense supports TLS destinations natively.
How identity and access work in pfSense and OPNsense
Both products use a local user manager as the link between an identity and its privileges. External directories answer "is this password valid", but the firewall's access control list still needs a matching local user or group for GUI and SSH access.
| Area | pfSense | OPNsense |
|---|---|---|
| Factory administrator | admin / pfsense; Plus 24.03+ forces change at first login | root / opnsense after install; live installer uses installer / opnsense |
| Default LAN management address | LAN interface (commonly 192.168.1.1), GUI on HTTPS 443 | 192.168.1.1, GUI on HTTPS |
| External authentication | LDAP and RADIUS authentication servers | LDAP (OpenLDAP, Active Directory, eDirectory), RADIUS, OpenID Connect (Business Edition) |
| Second factor | Via RADIUS or an external IdP that provides MFA | Built-in TOTP (RFC 6238) for GUI, Captive Portal, OpenVPN, IPsec and proxy; not for console or SSH |
| Authorisation model | Privileges such as WebCfg - All pages assigned to users or groups | Privileges assigned to groups (preferred) or users; groups can be constrained by Source Networks |
| Machine access | SSH keys per user; packages and HA sync use admin-level credentials | Per-user API key and secret pairs; SSH Authorized Keys per user |
| Session protection | HSTS, DNS rebind check, HTTP_REFERER enforcement on by default | HSTS option, DNS rebind check, HTTP_REFERER enforcement, session timeout, Strict security (GUI not running as root) |
Users who reach the firewall for services, not administration
VPN users (OpenVPN, IPsec), captive portal users and proxy users authenticate against the same user manager or authentication servers. These accounts are the bigger population and the bigger risk: a dormant VPN account without MFA was the way in for the Colonial Pipeline ransomware attack. Require MFA for every remote access account (OPNsense TOTP, or RADIUS with MFA on pfSense), set the OPNsense Expiration date field for contractors, and disable accounts as part of offboarding. See the VPN Security Guide.
Admin roles and privileged access
Neither platform has a fine-grained "read-only administrator" role that is safe by default. Every privilege maps to GUI pages, and some pages are equivalent to full administrator access.
| Privilege or setting | Effect | Guidance |
|---|---|---|
pfSense WebCfg - All pages and the OPNsense equivalent all-pages privilege | Access to every page in the GUI | Only the named firewall administrators group |
| Diagnostics pages that run commands, edit files or restore backups | Arbitrary command execution or configuration replacement; equivalent to administrator | Never grant to helpdesk or monitoring roles |
pfSense User - System - Shell account access | SSH login without root-level access (a sudo package can extend it) | Only where a shell is needed; prefer GUI roles |
pfSense User - Config - Deny Config Write | Blocks writes to config.xml, but not other actions that do not write configuration | Useful for "view" roles, but not a full read-only guarantee |
| OPNsense group Source Networks | Restricts a group's access to listed networks | Pin administrator groups to the management subnet |
| OPNsense Login shell (administrators only) | Creates a local shell account | Leave as /sbin/nologin unless SSH is required |
| Console menu password protection | Requires credentials at the physical or serial console | Enable (pfSense takes effect after reboot); OPNsense protects by default and allows unchecking |
- Factory account handling: after creating named administrator accounts, set a long random password on
adminorroot(OPNsense offers Scrambled Password for accounts that should not log in), keep it in a vault as break-glass, and alert on its use. See the Break-Glass Account Guide. - SSH: pfSense SSHd Key Only defaults to "Password or Public Key"; set "Public Key Only". In OPNsense disable Permit Root Login and Permit password login and add keys under each user's Authorized Keys. Keep agent forwarding off (the pfSense default). See the SSH Key Management Guide.
- Brute-force protection: pfSense Login Protection (sshguard) defaults to a threshold of 30, block time of 120 seconds and detection time of 1,800 seconds. Keep it on, and avoid adding broad subnets to the pass list.
Integrations, API tokens and service accounts
Firewalls accumulate machine credentials quietly: monitoring, configuration backup, automation, high availability sync, VPN certificates and package integrations.
| Credential | Where it lives | Risk | Control |
|---|---|---|---|
| OPNsense API key and secret | User manager, per user; secret downloadable once and not stored on the firewall | Inherits all of the user's page privileges | Dedicated API user per integration with only the needed pages; one key per application |
| SSH keys for automation and backup | Per-user authorised keys | Shared keys reaching every firewall | Separate key per tool; restrict source addresses at the firewall rule |
| HA configuration sync (pfSense XMLRPC) | Secondary node credentials in the primary's config | Administrator-level credentials stored on the peer | Sync over a dedicated interface; rotate when administrators change |
| LDAP or RADIUS bind credentials | Authentication server entries | Directory bind account readable from config.xml backups | Read-only bind account, LDAPS, scoped search base |
| VPN certificates and pre-shared keys | Certificate manager, IPsec and OpenVPN settings | Shared PSKs reused across sites | Certificates per peer, revocation lists, no shared PSKs |
| Configuration backups | config.xml exports, cloud or remote backup | Contains password hashes, keys and secrets for everything above | Encrypt backups, restrict storage access, treat as secrets |
- API hygiene: OPNsense recommends a unique key for every application. Record the owner and purpose against each key, review quarterly, and delete keys for retired tools. Always verify the firewall certificate from API clients; do not disable TLS verification in scripts. See the API Key Management Guide.
- Packages: each package (proxy, IDS, DNS filtering, VPN clients) adds code running on the firewall and sometimes its own credentials. Install only what is needed and remove unused packages.
Logging and detection
Both firewalls keep logs locally with limited retention, and an attacker with administrator access can clear them. Forward them off-box.
| Setting | pfSense | OPNsense |
|---|---|---|
| Where | Status > System Logs > Settings, "Send log messages to remote syslog server" | System > Settings > Logging, Remote tab, add a Destination |
| Servers | Up to three | Multiple destinations |
| Transport | UDP (default port 514), cleartext; syslog-ng package for TCP and TLS | Selectable transport including TLS with client certificate |
| Content selection | Everything, or categories: System, Firewall (raw filterlog), DNS, DHCP, General Authentication, VPN, Gateway Monitor, Routing and others | Select applications, or leave empty for all |
| Netgate warning | Do not send log data directly across a WAN; use a local network or VPN | Configure certificates and hostnames on both ends for TLS |
What to alert on
- Administrator logins: GUI and SSH logins by the factory account, logins from outside the management subnet, and repeated failures. pfSense logs successful GUI logins at emergency level by default, which makes them easy to forward.
- Configuration changes: pfSense and OPNsense record a configuration history with the user and description of each change; alert on changes outside change windows, new users or privileges, new API keys and rule changes allowing WAN access to management ports.
- Firewall defence impairment: rule deletions, disabled logging or a remote syslog target removed map to ATT&CK T1686 Disable or Modify System Firewall.
- Remote access abuse: VPN logins at unusual hours or from new countries, and accounts that log in after a long gap, map to T1133 External Remote Services and T1078.001 Default Accounts.
- Exploitation: GUI errors and unexpected processes after a published advisory, mapped to T1190 Exploit Public-Facing Application.
For detection content on these sources, see the VPN and Firewall Log Detection Guide and the Network Device Syslog and Configuration Change Detection Guide.
Metrics
- Management exposure: firewalls with GUI or SSH reachable from WAN or user networks (target 0).
- Factory account use: logins as
adminorrootoutside break-glass tests (target 0). - Remote access MFA coverage: share of VPN users with a second factor (target 100 percent).
- Patch lag: days from a pfSense-SA or OPNsense security release to deployment.
- Log continuity: firewalls with no syslog received in the last 24 hours (target 0).
- Key inventory: API and SSH keys with a recorded owner (target 100 percent).
Hardening baseline
Apply in this order. Keep console access available and tested before touching listen interfaces or anti-lockout behaviour; both vendors warn that mistakes here lock you out of the GUI and SSH.
- Back up and record: export an encrypted configuration backup and confirm console (VGA or serial) access works.
- Accounts: create named administrator accounts in an administrators group, connect LDAP or RADIUS if used, randomise and vault the factory account password.
- Management interface: create or select a management interface, set the GUI and SSH listen interfaces to it (OPNsense Listen interfaces), add explicit allow rules from the administration subnet, then disable the anti-lockout rule so access is governed by rules you control. Never allow GUI or SSH on WAN; for remote administration use a VPN into the management network.
- Web GUI: HTTPS only with a certificate from your internal CA instead of the self-signed default, HSTS on, DNS rebind check and HTTP_REFERER enforcement left on, session timeout set (for example 15 to 30 minutes), login autocomplete disabled, and on OPNsense Strict security enabled where your packages allow.
- SSH: disabled unless needed; if enabled, key only, no root login, listen on management only.
- Console: password protect the console menu, and physically secure the device.
- Remote access users: MFA for all VPN and captive portal accounts, expiry dates for temporary users, certificate-based VPN where possible.
- Logging and time: configure NTP, remote syslog over a protected path, and on OPNsense consider disabling local logging on flash-based devices once remote logging works.
- Updates: subscribe to Netgate advisories (named
pfSense-SA-YY_NN.component) and OPNsense release notes; run the OPNsense firmware security audit, which checks installed packages against known vulnerabilities. Take a configuration backup (and a boot environment snapshot where supported) before each upgrade so you can roll back. - Review: compare against the CIS Benchmark for the product quarterly and after upgrades. See the Firewall Rule Review Checklist.
Small office or larger estate
- Single site: one management VLAN, two named administrators plus a vaulted factory account, OPNsense TOTP or RADIUS MFA, remote syslog to a small collector or managed SIEM.
- Many sites: central authentication through LDAP or RADIUS with MFA, configuration management through API or backups pulled by a dedicated low-privilege identity, standard images per site, and a central log pipeline with configuration change alerts. At this scale, the identity that pulls backups is the most sensitive credential, because the backups contain every secret.
Common misconfigurations
- GUI on WAN "temporarily": a rule opened for remote support that is never removed, exposing the web configurator, which receives regular
webguisecurity advisories, to the internet. - Factory account as the daily login: no attribution in the configuration history and a known username for brute force.
- Helpdesk with diagnostics privileges: a "limited" account that can run commands or restore a configuration is an administrator.
- VPN users without MFA and without expiry: local accounts created for a project years ago that still work.
- Cleartext syslog across the internet: pfSense's built-in syslog is UDP and unencrypted; sending it across a WAN leaks network and authentication details.
- Unencrypted
config.xmlbackups on shared drives or in tickets, containing password hashes, VPN keys and directory bind credentials.
Framework mapping
| Control area | NIST SP 800-53 Rev 5 | NIST CSF 2.0 | CIS Controls v8.1 | ISO/IEC 27001:2022 Annex A |
|---|---|---|---|---|
| Default accounts and administrator access | AC-2, AC-6, IA-2 | PR.AA-05 | 4.7, 5.4, 6.5 | A.5.15, A.8.2, A.8.5 |
| Management plane and remote access | AC-17, SC-7 | PR.PS-01 | 4.4, 12.3 | A.8.20, A.8.22 |
| API and SSH keys | IA-5 | PR.AA-01 | 5.2 | A.5.17 |
| Secure configuration baseline | CM-2, CM-6 | PR.PS-01 | 4.1, 4.2 | A.8.9 |
| Logging and review | AU-2, AU-6 | DE.CM-09 | 8.2, 8.9 | A.8.15 |
| Patching | SI-2 | PR.PS-02 | 7.3 | A.8.8 |
Practitioner checklist
- Change and vault the factory
adminorrootpassword and alert on its use. - Create named administrator accounts in a group pinned to the management network.
- Bind the GUI and SSH to a management interface only and replace the anti-lockout rule with explicit rules.
- Use HTTPS with an internal CA certificate, HSTS, DNS rebind and HTTP_REFERER checks, and a session timeout.
- Set SSH to key only with root login and password login disabled, or turn SSH off.
- Remove diagnostics, command and restore privileges from every non-administrator role.
- Require MFA and expiry dates for all VPN and captive portal users.
- Issue one API key per integration to a dedicated low-privilege user and review keys quarterly.
- Forward logs to a SIEM over a protected path and alert on configuration and user changes.
- Track pfSense-SA advisories and OPNsense releases, back up before upgrades, and audit against the CIS Benchmark.
Standards and references
- Netgate: pfSense Advanced Configuration, Admin Access Tab
- Netgate: pfSense Default Username and Password
- Netgate: pfSense Remote Logging
- Netgate: Security Advisories
- OPNsense: Settings (Administration, Secure Shell, Logging)
- OPNsense: Access and User Management
- OPNsense: Use the API
- CIS: pfSense Firewall Benchmark
Related NHI Mgmt Group resources: Firewall Management Guide · SOHO and SMB Router Hardening Guide · Edge Device Security Guide · VPN and Firewall Log Detection Guide