---
# System prepended metadata

title: Captive Portal

---

# Captive Portal 


Start from /etc/rc.d/captiveportal
1. start API dispatcher lighttp daemon
2. generate SSL certificates
3. setup working directories for zones
4. setup custom user layout if available
5. start new lighttp daemon for zones
6. clean up removed zones
7. start captiveportal background process by cp-background-process.py


in /usr/local/opnsense/scripts/OPNsense/CaptivePortal/cp-background-process.py
1. check and repair database (/var/captiveportal/captiveportal.sqlite)
2. update the zone information from date base
3. open /var/captiveportal/captiveportal.sqlite
4. cleanup old settings, every 5 minutes
5. parse system arp table and store result in this object
6. update internal accounting database with given ipfw info
7. synchronize captiveportal zone. (timeouts and administrative changes)
8. close the database
9. process accounting messages (uses php script, for reuse of Auth classes)



in /usr/local/opnsense/scripts/OPNsense/CaptivePortal/process_accounting_messages.php
1. open database (/var/captiveportal/captiveportal.sqlite)
2. query all sessions which client restrictions
3. get new authenticator based on configuration
4. if the user is new -> send start accounting
   else if the user is stopped -> send stop event
   else update event


in /usr/local/opnsense/mvc/app/library/OPNsense/Auth/Radius.php
1. configure the authenticator
2. start accounting
3. stop accounting
4. update accounting