hotspot-to-wpa: rework for RouterOS 7.24 compatibility

This commit is contained in:
Christian Hesse 2026-07-23 12:47:15 +02:00
parent 23e5c00de0
commit b47ada967c
11 changed files with 408 additions and 333 deletions

View file

@ -26,35 +26,40 @@ Requirements and installation
You need a properly configured hotspot on one (open) SSID and a WPA enabled
SSID with suffix "`-wpa`".
Then install the script.
Depending on whether you use `wifi` package (`/interface/wifi`)or legacy
wifi with CAPsMAN (`/caps-man`) you need to install a different script and
set it as `on-login` script in hotspot.
Then install the scripts. Depending on whether you use `wifi` package
(`/interface/wifi`) or legacy wifi with CAPsMAN (`/caps-man`) you need to
install a different set of scripts.
For `wifi`:
$ScriptInstallUpdate hotspot-to-wpa.wifi;
/ip/hotspot/user/profile/set on-login="hotspot-to-wpa.wifi" [ find ];
$ScriptInstallUpdate hotspot-to-wpa,hotspot-to-wpa-lease.wifi,dhcpv4-server-lease;
For legacy CAPsMAN:
$ScriptInstallUpdate hotspot-to-wpa.capsman;
/ip/hotspot/user/profile/set on-login="hotspot-to-wpa.capsman" [ find ];
$ScriptInstallUpdate hotspot-to-wpa,hotspot-to-wpa-lease.capsman,dhcpv4-server-lease;
Then set `hotspot-to-wpa` as `on-login` script in hotspot.
/ip/hotspot/user/profile/set on-login="hotspot-to-wpa" [ find ];
Finally ad add the lease script your hotspot interfaces' dhcp server.
/ip/dhcp-server/set lease-script="dhcpv4-server-lease" hotspot;
### Automatic cleanup
With just `hotspot-to-wpa` installed the mac addresses will last in the
With just the above scripts installed the mac addresses will last in the
access list forever. Install the optional script for automatic cleanup
and add a scheduler.
For `wifi`:
$ScriptInstallUpdate hotspot-to-wpa-cleanup.wifi,dhcpv4-server-lease;
$ScriptInstallUpdate hotspot-to-wpa-cleanup.wifi;
/system/scheduler/add interval=1d name="hotspot-to-wpa-cleanup" on-event="/system/script/run hotspot-to-wpa-cleanup.wifi;" start-time=startup;
For legacy CAPsMAN:
$ScriptInstallUpdate hotspot-to-wpa-cleanup.capsman,dhcpv4-server-lease;
$ScriptInstallUpdate hotspot-to-wpa-cleanup.capsman;
/system/scheduler/add interval=1d name="hotspot-to-wpa-cleanup" on-event="/system/script/run hotspot-to-wpa-cleanup.capsman;" start-time=startup;
And add the lease script and matcher comment to your wpa interfaces' dhcp