net/freeradius: modify VLAN fallback logic #5050

While it's nice to constrain this it's also very inflexible.
With fallback disabled we can retain values in tunnel pw and
VLAN ID.  Enabling it without these options may be weird, but
not a large problem.  Template was rearranged to generate
the most logic outcome.

Some due maintenance sprinkled on top.
This commit is contained in:
Franco Fichtner 2025-11-29 08:51:48 +01:00
parent 5ca28c8447
commit 4e967c787d
3 changed files with 34 additions and 55 deletions

View File

@ -25,6 +25,13 @@
<advanced>true</advanced>
<help>Define the Fallback VLAN group ID.</help>
</field>
<field>
<id>general.fallback_tunnel_password</id>
<label>Fallback VLAN tunnel password</label>
<type>password</type>
<advanced>true</advanced>
<help>Define the Fallback VLAN Tunnel-Password. Allowed characters are 0-9, a-z, A-Z, and ,._-!$%/()+#=: with up to 128 characters.</help>
</field>
<field>
<id>general.ldap_enabled</id>
<label>Enable LDAP</label>
@ -152,11 +159,4 @@
<advanced>true</advanced>
<help>Fallback for proxy server. Default disabled.</help>
</field>
<field>
<id>general.fallback_tunnel_password</id>
<label>Fallback Tunnel password</label>
<type>password</type>
<advanced>true</advanced>
<help>Define the Fallback Tunnel-Password. Allowed characters are 0-9, a-z, A-Z, and ,._-!$%/()+#=: with up to 128 characters.</help>
</field>
</form>

View File

@ -23,27 +23,9 @@
<fallbackvlan_id type="IntegerField">
<MinimumValue>1</MinimumValue>
<MaximumValue>4096</MaximumValue>
<Constraints>
<check001>
<ValidationMessage>VLAN fallback assignment needs to be enabled.</ValidationMessage>
<type>DependConstraint</type>
<addFields>
<field1>fallbackvlan_enabled</field1>
</addFields>
</check001>
</Constraints>
</fallbackvlan_id>
<fallback_tunnel_password type="TextField">
<Mask>/^([0-9a-zA-Z._\-\!\$\%\/\(\)\+\#\=\{\}:]){1,128}$/u</Mask>
<Constraints>
<check001>
<ValidationMessage>VLAN fallback assignment needs to be enabled.</ValidationMessage>
<type>DependConstraint</type>
<addFields>
<field1>fallbackvlan_enabled</field1>
</addFields>
</check001>
</Constraints>
</fallback_tunnel_password>
<ldap_enabled type="BooleanField">
<Default>0</Default>

View File

@ -1,36 +1,33 @@
{#
OPNsense® is Copyright © 2014 2017 by Deciso B.V.
This file is Copyright © 2017 by Michael Muenz <m.muenz@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
#}
# Copyright (c) 2014-2017 Deciso B.V.
# Copyright (c) 2017 Michael Muenz <m.muenz@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1 Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2 Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#}
<div class="content-box" style="padding-bottom: 1.5em;">
{{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_general_settings'])}}
<div class="col-md-12">
<hr />
<div class="col-md-12 __mt">
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b> <i id="saveAct_progress" class=""></i></button>
</div>
</div>
@ -52,7 +49,7 @@ POSSIBILITY OF SUCH DAMAGE.
updateServiceControlUI('freeradius');
$("#saveAct_progress").removeClass("fa fa-spinner fa-pulse");
});
});
}, true);
});
});
</script>