Development

This commit is contained in:
Matthew Grotke 2026-06-06 01:36:28 -04:00
parent a94863e25a
commit dc2be3e5aa
4 changed files with 29 additions and 1 deletions

View file

@ -70,6 +70,7 @@ def auth_mode_save():
if eap_protocol not in ('eap_peap', 'eap_ttls', 'eap_md5'):
eap_protocol = 'eap_peap'
tunneled_reply = 'tunneled_reply' in request.form
include_length = 'include_length' in request.form
inner_protocol = request.form.get('inner_protocol', '')
_valid_inner = {
@ -87,10 +88,15 @@ def auth_mode_save():
after['inner_protocol'] = inner_protocol
else:
after.pop('inner_protocol', None)
if eap_protocol == 'eap_ttls':
after['include_length'] = include_length
else:
after.pop('include_length', None)
else:
after.pop('eap_protocol', None)
after.pop('tunneled_reply', None)
after.pop('inner_protocol', None)
after.pop('include_length', None)
cfg.setdefault('radius', {})['options'] = after
changes = diff_fields(before, after)

View file

@ -272,6 +272,23 @@
"type": "raw_html",
"html": "</div>"
},
{
"type": "raw_html",
"html": "<div id=\"eap-ttls-row\">"
},
{
"type": "field",
"label": "",
"name": "include_length",
"input_type": "checkbox",
"checkbox_label": "Include Length",
"value": "%RADIUS_INCLUDE_LENGTH%",
"hint": "Include the total length of message in every packet."
},
{
"type": "raw_html",
"html": "</div>"
},
{
"type": "raw_html",
"html": "</div>"

View file

@ -120,6 +120,7 @@ def collect_tokens(cfg):
tokens['RADIUS_GEN_LOG_MAX_KB'] = str(fr_gen.get('log_max_kb', 1024))
tokens['RADIUS_TUNNELED_REPLY'] = 'true' if fr_opts.get('tunneled_reply', False) else ''
tokens['RADIUS_INCLUDE_LENGTH'] = 'true' if fr_opts.get('include_length', False) else ''
vlans = cfg.get('vlans', [])
default_vlan = next((v['name'] for v in vlans if v.get('radius_default') is True), '')

View file

@ -295,6 +295,10 @@ def set_freeradius_eap(data):
inner_block = 'peap' if eap_protocol == 'eap_peap' else 'ttls'
content4 = _patch_setting_in_block(content4, inner_block, 'default_eap_type', inner_protocol)
if eap_protocol == 'eap_ttls':
il_val = 'yes' if opts.get('include_length', False) else 'no'
content4 = _patch_setting_in_block(content4, 'ttls', 'include_length', il_val)
if content4 == content:
return False
RADIUS_EAP_FILE.write_text(content4)