authcha learn

Learn / Guest and portals

Build a pfSense captive portal

Module 3 of 5 · 40 minutes

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

  1. Authorization Policies → RADIUS Clients → Add: the address the firewall's RADIUS packets come from, and a shared secret.
  2. 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.
  3. Users: create users of type network-user for 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 settingValue
Authentication methodRADIUS Authentication
RADIUS protocolPAP
Primary RADIUS serverthe Authcha host, port 1812
Shared secretthe one from step 1
Reauthenticate users every minuteOff (a code login's password is a single-use token)
AccountingEnable, port 1813, same secret
Accounting updatesInterim update, about every 60 seconds
Use RADIUS reply attributesOn (timeouts, bandwidth, quota)
Enable RADIUS MAC authenticationOn 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:

FieldValue
Name, zoneany name; the zone from step 2
Portal login addresshttps://<firewall>:8003/index.php?zone=<zone>
Devicethe device from step 1
Visitors canusername and password, or also a voucher
Verification code forthe user types that must pass a code (empty = none)
Original page after sign-inany, allowlist or none (never an open redirect)
Look and textbrand name, accent colour (Authcha checks the contrast), a logo up to 20 KB, welcome, terms and help text
One person per device addressOn, 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:

FilepfSense field
authcha-portal.htmlPortal page contents
authcha-portal-error.htmlAuthentication 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

  1. Connect a phone to the guest network and open any http:// page. The branded page appears.
  2. A wrong password shows a message in the visitor's language. A right one lands on the page they asked for.
  3. Sessions and Portal gateways → Sessions show the session once pfSense's accounting Start arrives.
  4. End session removes it: Authcha queues the disconnect and the pfSense agent ends it.

When it goes wrong

SymptomCause and fix
The page is pfSense's defaultThe file is not in Portal page contents. Test the connection
Voucher, code or status page will not openThe console is not in the walled garden (name and IP), or its certificate is not trusted
Certificate warning before the login pageThe portal's HTTPS server name has no trusted certificate
"Authentication failed" for an OTP userBy 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 minuteReauthenticate users every minute is on with the code stage
Voucher accepted but device not admittedMAC authentication is off on the zone, or the MAB mode does not match, or the MAC format differs
"No active session" while onlineRequests reach the console from the firewall's NAT address, not the client's
Every login says the RADIUS server did not answerWrong source address or secret, or no Message-Authenticator. Auth History shows nothing for a dropped request

LabHands-on

  1. Open Portal Gateways on the demo (viewer login demo-viewer, password Authcha-View-2026) and look at a gateway's settings.
  2. Read the pfSense settings table above and tick off, from memory, the six pfSense options that matter most.
  3. On a pfSense lab (2.7 or later), follow steps 1 to 7 end to end.
  4. Break step 4 on purpose: remove the console from the walled garden. See which pages fail, then fix it.
  5. Turn on Reauthenticate users every minute and watch a code login fail after a minute. Turn it off again.
  6. End a session from Portal gateways → Sessions with the agent stopped, then with it running. Compare.

Check yourselfQuiz

1Why must "Reauthenticate users every minute" be off?
2What does pfSense send as Calling-Station-Id?
3A phone cannot open the voucher page. Which is the likeliest cause?
4Why does editing the generated HTML by hand break the page?
5What ends a session on pfSense CE?

Cheat sheetKeep this

  1. RADIUS client + device (Captive portal / hotspot (PAP), CoA none, MAC auth preset).
  2. Zone on pfSense.
  3. RADIUS PAP, 1812/1813, interim updates, reauth off, reply attributes on.
  4. HTTPS login + walled garden (name and IP) + TCP 443 rule.
  5. Portal Gateways → New gateway in Authcha.
  6. Upload two files (portal and error pages). Never hand-edit them.
  7. Test with a phone. The agent ends sessions on pfSense CE.
  8. Read more: pfSense / generic captive portal, phones and laptops.