Build a pfSense captive portal
By the end you can
- Register the firewall in Authcha and create the portal zone on pfSense
- Set the RADIUS, accounting and HTTPS options that make sessions work
- Generate the branded pages and upload them
- Diagnose the most common portal failures
What you get
When you finish, visitors who join the guest network and open any web page see a branded login page, in English, Hindi, Spanish, French or German, that works on phones and desktops, in light and dark. Behind it:
- Username and password go straight from the browser to pfSense, which checks them with Authcha over RADIUS.
- A Use a voucher button opens an Authcha page that registers the device, and pfSense's MAC login then admits it.
- User types you choose (for example
human-write) sign in with password and a verification code, then get a single-use token that admits them. - A status page shows who is signed in, time online, data left and an End my session button.
- Error cases (wrong password, locked account, quota used up, expired password, unregistered device, too many tries) each get a clear message in the visitor's language.
The integration was written against pfSense 2.7 and verified in a lab on 2.9.0; other versions are unverified. You need Authcha 1.14 or later with a license that includes guest access (the trial does), and the console reachable from the guest network by a name whose certificate the guests' devices trust, because the helper pages are HTTPS-only.
1. Register the firewall in Authcha
- Authorization Policies → RADIUS Clients → Add: the address the firewall's RADIUS packets come from, and a shared secret.
- Devices → Add: the same address, device type Captive portal / hotspot (PAP), and CoA mode: none (pfSense CE has no listener). If pfSense puts a different address in
NAS-IP-Address, add it under Additional addresses. For vouchers, turn on MAC authentication bypass with the pfSense MAC auth preset. - Users: create users of type
network-userfor people who need only network access. Optionally add a network policy and a web policy.
2. Create the zone on pfSense
Services → Captive Portal → Add. Give a zone name (lowercase letters, digits, underscore, such as guest), tick Enable Captive Portal, choose the interface (such as the guest VLAN) and save.
3. Authentication and accounting
On the zone's configuration page:
| pfSense setting | Value |
|---|---|
| Authentication method | RADIUS Authentication |
| RADIUS protocol | PAP |
| Primary RADIUS server | the Authcha host, port 1812 |
| Shared secret | the one from step 1 |
| Reauthenticate users every minute | Off (a code login's password is a single-use token) |
| Accounting | Enable, port 1813, same secret |
| Accounting updates | Interim update, about every 60 seconds |
| Use RADIUS reply attributes | On (timeouts, bandwidth, quota) |
| Enable RADIUS MAC authentication | On if guests use vouchers; MAC format single dash or colon |
pfSense sends the client's IP address as Calling-Station-Id. Authcha keys sessions on that, so sessions, the status page and the one-person rule all work by address.
4. HTTPS and the walled garden
- Enable HTTPS login and set HTTPS server name to the name guests reach, with a certificate their devices trust. Without it every browser warns before the login page. The verification-code stage needs HTTPS login.
- Allowed hostnames: add the Authcha console host name in both directions, and its IP under Allowed IP addresses, on port 443. Without this the voucher, code, status and logo pages cannot load.
- Firewall rule: on the portal interface, pass TCP 443 from portal clients to the console, above any block rule.
5. Create the gateway in Authcha
Guest Access → Portal Gateways → New gateway. The important fields:
| Field | Value |
|---|---|
| Name, zone | any name; the zone from step 2 |
| Portal login address | https://<firewall>:8003/index.php?zone=<zone> |
| Device | the device from step 1 |
| Visitors can | username and password, or also a voucher |
| Verification code for | the user types that must pass a code (empty = none) |
| Original page after sign-in | any, allowlist or none (never an open redirect) |
| Look and text | brand name, accent colour (Authcha checks the contrast), a logo up to 20 KB, welcome, terms and help text |
| One person per device address | On, unless the console is reached through NAT or many people share an address |
Save, then open the gateway and choose Set up the firewall.
6. Upload the pages
Download the two files and paste them into the zone:
| File | pfSense field |
|---|---|
authcha-portal.html | Portal page contents |
authcha-portal-error.html | Authentication error page contents |
Each file is checked by an offline validator as it is generated, and the console will not let you download one that fails. The page carries a Content-Security-Policy with hashes of its own style and script, so editing the HTML by hand breaks it on purpose. Change settings in Authcha and download again. Test the connection checks that the console can reach the portal address and that the page is Authcha's, and reports problems in plain words (name not found, connection refused, timed out, a certificate problem).
7. Try it
- Connect a phone to the guest network and open any
http://page. The branded page appears. - A wrong password shows a message in the visitor's language. A right one lands on the page they asked for.
- Sessions and Portal gateways → Sessions show the session once pfSense's accounting Start arrives.
- End session removes it: Authcha queues the disconnect and the pfSense agent ends it.
When it goes wrong
| Symptom | Cause and fix |
|---|---|
| The page is pfSense's default | The file is not in Portal page contents. Test the connection |
| Voucher, code or status page will not open | The console is not in the walled garden (name and IP), or its certificate is not trusted |
| Certificate warning before the login page | The portal's HTTPS server name has no trusted certificate |
| "Authentication failed" for an OTP user | By design from this gateway: use Sign in with a verification code, or the three-tries lock (Users → Unlock) |
| Logged in, then thrown out after a minute | Reauthenticate users every minute is on with the code stage |
| Voucher accepted but device not admitted | MAC authentication is off on the zone, or the MAB mode does not match, or the MAC format differs |
| "No active session" while online | Requests reach the console from the firewall's NAT address, not the client's |
| Every login says the RADIUS server did not answer | Wrong source address or secret, or no Message-Authenticator. Auth History shows nothing for a dropped request |
LabHands-on
- Open Portal Gateways on the demo (viewer login
demo-viewer, passwordAuthcha-View-2026) and look at a gateway's settings. - Read the pfSense settings table above and tick off, from memory, the six pfSense options that matter most.
- On a pfSense lab (2.7 or later), follow steps 1 to 7 end to end.
- Break step 4 on purpose: remove the console from the walled garden. See which pages fail, then fix it.
- Turn on Reauthenticate users every minute and watch a code login fail after a minute. Turn it off again.
- End a session from Portal gateways → Sessions with the agent stopped, then with it running. Compare.
Check yourselfQuiz
Cheat sheetKeep this
- RADIUS client + device (Captive portal / hotspot (PAP), CoA none, MAC auth preset).
- Zone on pfSense.
- RADIUS PAP, 1812/1813, interim updates, reauth off, reply attributes on.
- HTTPS login + walled garden (name and IP) + TCP 443 rule.
- Portal Gateways → New gateway in Authcha.
- Upload two files (portal and error pages). Never hand-edit them.
- Test with a phone. The agent ends sessions on pfSense CE.
- Read more: pfSense / generic captive portal, phones and laptops.