From 9db8c197ab170d18a93d70fca4227e802a7154c1 Mon Sep 17 00:00:00 2001 From: Jamie Austin Date: Sat, 28 Jan 2023 01:13:25 +1100 Subject: T4958: ocserv: openconnect: refactor RADIUS accounting support --- src/conf_mode/vpn_openconnect.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/conf_mode') diff --git a/src/conf_mode/vpn_openconnect.py b/src/conf_mode/vpn_openconnect.py index 12ddac23c..737e23145 100755 --- a/src/conf_mode/vpn_openconnect.py +++ b/src/conf_mode/vpn_openconnect.py @@ -210,18 +210,16 @@ def generate(ocserv): return None if "radius" in ocserv["authentication"]["mode"]: - if "accounting" in ocserv and "mode" in ocserv["accounting"] and "radius" in ocserv["accounting"]["mode"]: - acct_and_auth_config = {'accounting': ocserv["accounting"], 'authentication': ocserv["authentication"]} + if dict_search(ocserv, 'accounting.mode.radius'): # Render radius client configuration - render(radius_cfg, 'ocserv/radius_conf.j2', acct_and_auth_config) + render(radius_cfg, 'ocserv/radius_conf.j2', ocserv) merged_servers = ocserv["accounting"]["radius"]["server"] | ocserv["authentication"]["radius"]["server"] # Render radius servers # Merge the accounting and authentication servers into a single dictionary render(radius_servers, 'ocserv/radius_servers.j2', {'server': merged_servers}) else: - acct_and_auth_config = {'accounting': {'mode': ''}, 'authentication': ocserv['authentication']} # Render radius client configuration - render(radius_cfg, 'ocserv/radius_conf.j2', acct_and_auth_config) + render(radius_cfg, 'ocserv/radius_conf.j2', ocserv) # Render radius servers render(radius_servers, 'ocserv/radius_servers.j2', ocserv["authentication"]["radius"]) elif "local" in ocserv["authentication"]["mode"]: -- cgit v1.2.3