Development
This commit is contained in:
parent
a94863e25a
commit
dc2be3e5aa
4 changed files with 29 additions and 1 deletions
|
|
@ -70,6 +70,7 @@ def auth_mode_save():
|
||||||
if eap_protocol not in ('eap_peap', 'eap_ttls', 'eap_md5'):
|
if eap_protocol not in ('eap_peap', 'eap_ttls', 'eap_md5'):
|
||||||
eap_protocol = 'eap_peap'
|
eap_protocol = 'eap_peap'
|
||||||
tunneled_reply = 'tunneled_reply' in request.form
|
tunneled_reply = 'tunneled_reply' in request.form
|
||||||
|
include_length = 'include_length' in request.form
|
||||||
inner_protocol = request.form.get('inner_protocol', '')
|
inner_protocol = request.form.get('inner_protocol', '')
|
||||||
|
|
||||||
_valid_inner = {
|
_valid_inner = {
|
||||||
|
|
@ -87,10 +88,15 @@ def auth_mode_save():
|
||||||
after['inner_protocol'] = inner_protocol
|
after['inner_protocol'] = inner_protocol
|
||||||
else:
|
else:
|
||||||
after.pop('inner_protocol', None)
|
after.pop('inner_protocol', None)
|
||||||
|
if eap_protocol == 'eap_ttls':
|
||||||
|
after['include_length'] = include_length
|
||||||
|
else:
|
||||||
|
after.pop('include_length', None)
|
||||||
else:
|
else:
|
||||||
after.pop('eap_protocol', None)
|
after.pop('eap_protocol', None)
|
||||||
after.pop('tunneled_reply', None)
|
after.pop('tunneled_reply', None)
|
||||||
after.pop('inner_protocol', None)
|
after.pop('inner_protocol', None)
|
||||||
|
after.pop('include_length', None)
|
||||||
cfg.setdefault('radius', {})['options'] = after
|
cfg.setdefault('radius', {})['options'] = after
|
||||||
|
|
||||||
changes = diff_fields(before, after)
|
changes = diff_fields(before, after)
|
||||||
|
|
|
||||||
|
|
@ -272,6 +272,23 @@
|
||||||
"type": "raw_html",
|
"type": "raw_html",
|
||||||
"html": "</div>"
|
"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",
|
"type": "raw_html",
|
||||||
"html": "</div>"
|
"html": "</div>"
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,8 @@ def collect_tokens(cfg):
|
||||||
tokens['RADIUS_LOGGING_HINT'] = 'Unchecking will clear logs.' if fr_gen.get('logging', False) else ''
|
tokens['RADIUS_LOGGING_HINT'] = 'Unchecking will clear logs.' if fr_gen.get('logging', False) else ''
|
||||||
tokens['RADIUS_GEN_LOG_MAX_KB'] = str(fr_gen.get('log_max_kb', 1024))
|
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_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', [])
|
vlans = cfg.get('vlans', [])
|
||||||
default_vlan = next((v['name'] for v in vlans if v.get('radius_default') is True), '')
|
default_vlan = next((v['name'] for v in vlans if v.get('radius_default') is True), '')
|
||||||
|
|
|
||||||
|
|
@ -295,6 +295,10 @@ def set_freeradius_eap(data):
|
||||||
inner_block = 'peap' if eap_protocol == 'eap_peap' else 'ttls'
|
inner_block = 'peap' if eap_protocol == 'eap_peap' else 'ttls'
|
||||||
content4 = _patch_setting_in_block(content4, inner_block, 'default_eap_type', inner_protocol)
|
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:
|
if content4 == content:
|
||||||
return False
|
return False
|
||||||
RADIUS_EAP_FILE.write_text(content4)
|
RADIUS_EAP_FILE.write_text(content4)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue