From a7341b418e4c103116753a0765f1923c30689f45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Fri, 12 May 2023 12:27:23 +0200 Subject: [PATCH] uspot: introduce mac_passwd and mac_suffix options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- feeds/ucentral/uspot/files/usr/share/uspot/handler.uc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/feeds/ucentral/uspot/files/usr/share/uspot/handler.uc b/feeds/ucentral/uspot/files/usr/share/uspot/handler.uc index 384d8901b..9890a0321 100644 --- a/feeds/ucentral/uspot/files/usr/share/uspot/handler.uc +++ b/feeds/ucentral/uspot/files/usr/share/uspot/handler.uc @@ -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']) {