Passkey login for pfSense

An add-on that protects the login to the pfSense web interface with a passkey, as a second factor after the password.

Context
Personal project, open source (Apache 2.0)
Time
October 2026, one day
Status
Version 1.0.1, in use on my firewall
Tools
PHP, JavaScript, WebAuthn, with AI as support

Why I built it

I reach the web interface of my pfSense firewall through a Cloudflare Tunnel. Cloudflare Access sits in front of it, but the firewall itself only asked for a password. For the most important login in my whole network, that wasn't enough for me.

pfSense doesn't offer passkeys for its web interface, so I added them myself. I'm not an application developer, so I wrote the code together with AI: I defined what the add-on must do and which security rules it has to follow, then reviewed, tested and installed the result on my own firewall.

How it works

  • After the normal password login, the add-on checks on every page of the web interface whether the session has been confirmed with a passkey. If not, the passkey step appears.
  • Passkeys are registered per user under System > WebAuthn Passkeys. They're stored in pfSense's own configuration, so every pfSense backup includes them.
  • The signature is checked entirely on the firewall, without any outside service. That includes a small parser of my own for CBOR, the data format WebAuthn uses.
  • Installing and updating takes one command, and settings and passkeys are kept on every update.
Passkey step after signing in, with the browser's passkey picker on the right
After the password comes the passkey step. The browser offers the saved passkey. (Hostname blurred.)
Management page with registered passkeys and the register button
The management page in pfSense: registered passkeys per user, and a new one is added with a name.

Challenges and solutions

Secure, without locking myself out

A second factor on the firewall only makes sense if it can't be bypassed. At the same time, a mistake must never leave me unable to reach my own firewall. Both goals pull in opposite directions.

  • Switch on in steps. The second factor is only enforced once I turn it on, after registering at least two passkeys.
  • An emergency way in. Trusted networks and the console still work if all passkeys are lost. Traffic through the tunnel is never exempt.
  • Fail closed. If files of the add-on go missing, the web interface locks instead of skipping the passkey step.
  • Survive updates. pfSense updates replace the files the add-on hooks into. The hooks are put back automatically at every start and every 5 minutes.
  • No back door. The sync interface for high availability (XMLRPC) only needs a password. Through the tunnel or any proxy it's always refused.
  • Limited sessions. A confirmation expires after 12 hours, and removing a passkey also ends the sessions it confirmed.

What I learned

  • How WebAuthn worksChallenge, public key, signature counter, and why the hostname decides which passkey is valid.
  • How pfSense handles loginsWhere a second step can be hooked in cleanly without breaking the rest.
  • Fail closed beats convenienceWhen in doubt, locked is better than unprotected, as long as there's a planned way back in.
  • Working with AIUsing AI to move fast, while checking and understanding every part myself.

My part

I wrote the code with AI. I decided what the add-on may and may not do, and I tested and installed it myself. One example: the rule that the second factor only applies once at least two passkeys are registered is mine. It keeps me from locking myself out by losing a single key.

What I'd do differently

I would write the edge cases, like pfSense updates, high availability and the emergency access, down as a test list before the first line of code, and go through that list again after every pfSense update.

Code

The full code, with install guide and setup instructions, is on GitHub: web-auth-pfsense