hotspot-to-wpa: support non-local users

This has some limitations, though: The password is not known and
additional configuration can not be given in user's comment.
This commit is contained in:
Christian Hesse 2023-06-23 17:33:51 +02:00
parent 5ba34c819a
commit f8a2b88692
4 changed files with 9 additions and 2 deletions

View file

@ -54,6 +54,9 @@ Create hotspot login credentials:
/ip/hotspot/user/add comment="Test User 1" name=user1 password=v3ry;
/ip/hotspot/user/add comment="Test User 2" name=user2 password=s3cr3t;
This also works with authentication via radius, but is limited then:
Additional information is not available, including the password.
Additionally templates can be created to give more options for access list:
* `action`: set to `reject` to ignore logins on that hotspot

View file

@ -12,7 +12,7 @@
:local 0 "global-functions";
# expected configuration version
:global ExpectedConfigVersion 101;
:global ExpectedConfigVersion 102;
# global variables not to be changed by user
:global GlobalFunctionsReady false;

View file

@ -25,7 +25,10 @@ $ScriptLock $0;
}
:local Date [ /system/clock/get date ];
:local UserVal [ /ip/hotspot/user/get [ find where name=$UserName ] ];
:local UserVal ({});
:if ([ :len [ /ip/hotspot/user/find where name=$UserName ] ] > 0) do={
:set UserVal [ /ip/hotspot/user/get [ find where name=$UserName ] ];
}
:local UserInfo [ $ParseKeyValueStore ($UserVal->"comment") ];
:local Hotspot [ /ip/hotspot/host/get [ find where mac-address=$MacAddress authorized ] server ];

View file

@ -15,6 +15,7 @@
99="Modified 'dhcp-to-dns', which dropped global configuration. Settings moved to dhcp server's network definitions.";
100="The script 'ssh-keys-import' became a module 'mod/ssh-keys-import' with enhanced functionality.";
101="Introduced new script 'fw-addr-lists' to download, import and update firewall address-lists.";
102="Modified 'hotspot-to-wpa' to support non-local (radius) users.";
};
# Migration steps to be applied on script updates