Join our Newsletter — 33% off our NHI Course
Home› Guides› pfSense and OPNsense Hardening Guide: Admin Access, Keys…
Guide Network Security

pfSense and OPNsense Hardening Guide: Admin Access, Keys and Logging

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 27 October 2026 13 min read
On this page

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 / pfsense and OPNsense with root / 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.

AreapfSenseOPNsense
Factory administratoradmin / pfsense; Plus 24.03+ forces change at first loginroot / opnsense after install; live installer uses installer / opnsense
Default LAN management addressLAN interface (commonly 192.168.1.1), GUI on HTTPS 443192.168.1.1, GUI on HTTPS
External authenticationLDAP and RADIUS authentication serversLDAP (OpenLDAP, Active Directory, eDirectory), RADIUS, OpenID Connect (Business Edition)
Second factorVia RADIUS or an external IdP that provides MFABuilt-in TOTP (RFC 6238) for GUI, Captive Portal, OpenVPN, IPsec and proxy; not for console or SSH
Authorisation modelPrivileges such as WebCfg - All pages assigned to users or groupsPrivileges assigned to groups (preferred) or users; groups can be constrained by Source Networks
Machine accessSSH keys per user; packages and HA sync use admin-level credentialsPer-user API key and secret pairs; SSH Authorized Keys per user
Session protectionHSTS, DNS rebind check, HTTP_REFERER enforcement on by defaultHSTS 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 settingEffectGuidance
pfSense WebCfg - All pages and the OPNsense equivalent all-pages privilegeAccess to every page in the GUIOnly the named firewall administrators group
Diagnostics pages that run commands, edit files or restore backupsArbitrary command execution or configuration replacement; equivalent to administratorNever grant to helpdesk or monitoring roles
pfSense User - System - Shell account accessSSH 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 WriteBlocks writes to config.xml, but not other actions that do not write configurationUseful for "view" roles, but not a full read-only guarantee
OPNsense group Source NetworksRestricts a group's access to listed networksPin administrator groups to the management subnet
OPNsense Login shell (administrators only)Creates a local shell accountLeave as /sbin/nologin unless SSH is required
Console menu password protectionRequires credentials at the physical or serial consoleEnable (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 admin or root (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.

CredentialWhere it livesRiskControl
OPNsense API key and secretUser manager, per user; secret downloadable once and not stored on the firewallInherits all of the user's page privilegesDedicated API user per integration with only the needed pages; one key per application
SSH keys for automation and backupPer-user authorised keysShared keys reaching every firewallSeparate key per tool; restrict source addresses at the firewall rule
HA configuration sync (pfSense XMLRPC)Secondary node credentials in the primary's configAdministrator-level credentials stored on the peerSync over a dedicated interface; rotate when administrators change
LDAP or RADIUS bind credentialsAuthentication server entriesDirectory bind account readable from config.xml backupsRead-only bind account, LDAPS, scoped search base
VPN certificates and pre-shared keysCertificate manager, IPsec and OpenVPN settingsShared PSKs reused across sitesCertificates per peer, revocation lists, no shared PSKs
Configuration backupsconfig.xml exports, cloud or remote backupContains password hashes, keys and secrets for everything aboveEncrypt 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.

SettingpfSenseOPNsense
WhereStatus > System Logs > Settings, "Send log messages to remote syslog server"System > Settings > Logging, Remote tab, add a Destination
ServersUp to threeMultiple destinations
TransportUDP (default port 514), cleartext; syslog-ng package for TCP and TLSSelectable transport including TLS with client certificate
Content selectionEverything, or categories: System, Firewall (raw filterlog), DNS, DHCP, General Authentication, VPN, Gateway Monitor, Routing and othersSelect applications, or leave empty for all
Netgate warningDo not send log data directly across a WAN; use a local network or VPNConfigure 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 admin or root outside 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.

  1. Back up and record: export an encrypted configuration backup and confirm console (VGA or serial) access works.
  2. Accounts: create named administrator accounts in an administrators group, connect LDAP or RADIUS if used, randomise and vault the factory account password.
  3. 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.
  4. 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.
  5. SSH: disabled unless needed; if enabled, key only, no root login, listen on management only.
  6. Console: password protect the console menu, and physically secure the device.
  7. Remote access users: MFA for all VPN and captive portal accounts, expiry dates for temporary users, certificate-based VPN where possible.
  8. 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.
  9. 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.
  10. 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 webgui security 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.xml backups on shared drives or in tickets, containing password hashes, VPN keys and directory bind credentials.

Framework mapping

Control areaNIST SP 800-53 Rev 5NIST CSF 2.0CIS Controls v8.1ISO/IEC 27001:2022 Annex A
Default accounts and administrator accessAC-2, AC-6, IA-2PR.AA-054.7, 5.4, 6.5A.5.15, A.8.2, A.8.5
Management plane and remote accessAC-17, SC-7PR.PS-014.4, 12.3A.8.20, A.8.22
API and SSH keysIA-5PR.AA-015.2A.5.17
Secure configuration baselineCM-2, CM-6PR.PS-014.1, 4.2A.8.9
Logging and reviewAU-2, AU-6DE.CM-098.2, 8.9A.8.15
PatchingSI-2PR.PS-027.3A.8.8

Practitioner checklist

  • Change and vault the factory admin or root password 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

Related NHI Mgmt Group resources: Firewall Management Guide · SOHO and SMB Router Hardening Guide · Edge Device Security Guide · VPN and Firewall Log Detection Guide

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 27 October 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org