Development

This commit is contained in:
Matthew Grotke 2026-06-06 01:28:03 -04:00
parent 34abbae32e
commit a94863e25a
4 changed files with 77 additions and 4 deletions

View file

@ -69,7 +69,13 @@ def auth_mode_save():
eap_protocol = request.form.get('eap_protocol', 'eap_peap')
if eap_protocol not in ('eap_peap', 'eap_ttls', 'eap_md5'):
eap_protocol = 'eap_peap'
tunneled_reply = 'tunneled_reply' in request.form
tunneled_reply = 'tunneled_reply' in request.form
inner_protocol = request.form.get('inner_protocol', '')
_valid_inner = {
'eap_peap': {'mschapv2', 'md5', 'gtc'},
'eap_ttls': {'md5', 'mschapv2', 'gtc'},
}
cfg = load_config()
before = copy.deepcopy(cfg.get('radius', {}).get('options', {}))
@ -77,9 +83,14 @@ def auth_mode_save():
if auth_mode == 'eap_password':
after['eap_protocol'] = eap_protocol
after['tunneled_reply'] = tunneled_reply and eap_protocol in ('eap_peap', 'eap_ttls')
if eap_protocol in _valid_inner and inner_protocol in _valid_inner[eap_protocol]:
after['inner_protocol'] = inner_protocol
else:
after.pop('inner_protocol', None)
else:
after.pop('eap_protocol', None)
after.pop('tunneled_reply', None)
after.pop('eap_protocol', None)
after.pop('tunneled_reply', None)
after.pop('inner_protocol', None)
cfg.setdefault('radius', {})['options'] = after
changes = diff_fields(before, after)