nawasara / wifi
Public WiFi hotspot monitoring for the Nawasara superapp framework — hotspot registry with location coordinates and connection status, ready for map plotting.
Requires
- php: ^8.1
- illuminate/support: ^10.0|^12.0
- livewire/livewire: ^3.0
- nawasara/auth-primitives: *
- nawasara/ui: *
- nawasara/vault: *
- spatie/laravel-activitylog: ^4.0
- spatie/laravel-permission: ^6.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Public WiFi point monitoring for the Nawasara superapp framework. It is a hotspot registry with location coordinates and connection status, meant to be shown on a map alongside CCTV points (nawasara/cctv).
Status v0.1.0
| Feature | Status |
|---|---|
| WiFi point registry plus CRUD | ready |
| Coordinates (latitude/longitude) per point | ready |
| Connection status (connected / disconnected), manual | ready |
| Quick status toggle from the table | ready |
| Automatic status probe (ping/HTTP) | not built yet |
| Map view (combined with CCTV) | not built yet, handled separately |
Connection status in v0.1.0 is set manually through CRUD (an admin toggle). There is no automatic probe yet. That would need an IP/host column plus probe logic, which can be added later without a large migration (the status and status_changed_at structure is already in place for it).
Setup
php artisan migrate
php artisan db:seed --class="Nawasara\\Wifi\\Database\\Seeders\\PermissionSeeder"
Model
WifiPoint (nawasara_wifi_points):
name,location: point identitylatitude,longitude: coordinates,decimal(10,7), nullable. Only points with complete coordinates are plotted on the map (themappable()scope).status:connectedordisconnected. Change it throughsetStatus()sostatus_changed_atis stamped consistently.is_active: admin enable/disable.
Permissions
| Permission | For |
|---|---|
wifi.point.view |
View the WiFi point list |
wifi.point.create |
Add a point |
wifi.point.update |
Edit a point and toggle status |
wifi.point.delete |
Delete a point |
Citizen SSO login (spike, v0.1.9)
Hotspot login with a citizen account (Google, realm ponorogo-citizen), so
each session carries a name, an email and usage figures. This is a spike
to prove the flow end to end; it will move to RADIUS.
phone → MikroTik login page → "Masuk dengan Google"
→ short trial login (internet open) → /nawasara-wifi/portal?router=&mac=&ip=
→ Keycloak → Google → /nawasara-wifi/portal/callback
→ session row (pending) + citizen profile (JIT, nawasara/citizen)
router scheduler, every 5 s: POST /nawasara-wifi/router/grants → RouterOS script
→ replaces the trial session with user W-<MAC> (status delivered)
router scheduler, every 60 s: POST /nawasara-wifi/router/usage → bytes + uptime (status active)
Decisions that look wrong but are not:
- Trial first, then Google. RouterOS 6 walled garden matches by IP. Google login and our Keycloak (behind Cloudflare) share IPs with millions of other services, so allowing them before login opens most of the internet, and it also fools Android's connectivity check so the login page never appears. Measured on the test router on 3 Dec 2026.
- The router pulls. Routers sit behind NAT; Nawasara cannot reach them.
- The router executes the returned script (
[:parse]). Every value is checked against a strict pattern and a bad value rejects the script instead of being cleaned (RouterScript). RADIUS removes this. - Router token in the POST body, not the query string, so it stays out of access logs.
- No browsing history is recorded: only duration and volume per session.
Credentials: Vault group wifi-sso (registered by this package):
client_id, client_secret (Keycloak client wifi-portal, confidential,
redirect https://<app>/nawasara-wifi/portal/callback) and router_token.
Keycloak base URL and realm come from keycloak-warga. Allowed routers are
listed in nawasara-wifi.sso.routers.
Table nawasara_wifi_sso_sessions: one row per login (router, mac, ip,
keycloak_sub, email, name, citizen_profile_id, bytes_in, bytes_out,
uptime_seconds, status).
Roadmap
- Auto-probe: add an
ip_address/hostcolumn plus awifi:probecommand (following thecctv:probepattern) to update status automatically. - Citizen SSO on RADIUS: replace the pull spike with FreeRADIUS (rlm_rest → Nawasara) and RADIUS accounting; add an admin page for sessions and a retention prune.
- Map view: an interactive map page that plots WiFi and CCTV markers (
nawasara/cctvalso already has coordinates) on a single map.