uspot: introduce mac_passwd and mac_suffix options

This carries over two Chilli options used during mac authentication:

- macpasswd, which sets a static password when performing mac-auth
- macsuffix, which allows suffixing the mac address provided as username

These options are implemented in config uspot section as:

- option mac_passwd 'password'
- option mac_suffix 'suffix'

If unset, this commit is a NOP.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
This commit is contained in:
Thibaut VARÈNE
2023-05-12 12:27:23 +02:00
committed by John Crispin
parent fc80a4aa84
commit a7341b418e

View File

@@ -19,10 +19,11 @@ function request_start(ctx) {
include('radius.uc', ctx);
return;
case 'uam':
// try mac-auth first if enabled
if (+ctx.config.mac_auth) {
let payload = portal.radius_init(ctx);
payload.username = ctx.format_mac;
payload.password = ctx.format_mac;
payload.username = ctx.format_mac + (ctx.config.mac_suffix || '');
payload.password = ctx.config.mac_passwd || ctx.format_mac;
payload.service_type = 2;
let radius = portal.radius_call(ctx, payload);
if (radius['access-accept']) {