net/freeradius: add routes and v6 address (#660)

This commit is contained in:
Michael
2018-05-02 12:50:36 +02:00
committed by Franco Fichtner
parent a99e13e55b
commit 611681d3bb
3 changed files with 57 additions and 11 deletions
@@ -35,6 +35,20 @@
<type>text</type>
<help>Subnet to receive, e.g. 255.255.255.0</help>
</field>
<field>
<id>user.route</id>
<label>Routes</label>
<style>tokenize</style>
<type>select_multiple</type>
<allownew>true</allownew>
<help>Add routes in CIDR notation, e.g. 192.168.2.0/24. Multiple entries are allowed</help>
</field>
<field>
<id>user.ip6</id>
<label>IPv6 Address</label>
<type>text</type>
<help>Set the IPv6 address the user should receive.</help>
</field>
<field>
<id>user.vlan</id>
<label>VLAN ID</label>
@@ -1,7 +1,7 @@
<model>
<mount>//OPNsense/freeradius/user</mount>
<description>FreeRADIUS user configuration</description>
<version>1.0.0</version>
<version>1.0.1</version>
<items>
<users>
<user type="ArrayField">
@@ -28,6 +28,13 @@
<Required>N</Required>
<mask>/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/</mask>
</subnet>
<route type="CSVListField">
<Required>N</Required>
<mask>/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,2},)*(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,2})$/</mask>
</route>
<ip6 type="NetworkField">
<Required>N</Required>
</ip6>
<vlan type="IntegerField">
<Required>N</Required>
<MinimumValue>1</MinimumValue>
@@ -5,19 +5,44 @@
{% if user_list.enabled == '1' %}
{{ user_list.username }} Cleartext-Password := "{{ user_list.password }}"{% if user_list.sessionlimit_max_session_limit is defined %}, Max-Daily-Session := {{ user_list.sessionlimit_max_session_limit }}{% endif %}
Framed-Protocol = PPP{% if user_list.ip is defined %},
Framed-IP-Address = {{ user_list.ip }}{% endif %}{% if user_list.subnet is defined %},
Framed-IP-Netmask = {{ user_list.subnet }}{% endif %}{% if user_list.vlan is defined %},
{% if user_list.ip is defined %}
Framed-IP-Address = {{ user_list.ip }},
{% endif %}
{% if user_list.subnet is defined %}
Framed-IP-Netmask = {{ user_list.subnet }},
{% endif %}
{% if user_list.route is defined %}
{% for network in user_list.route.split(',') %}
Framed-Route += "{{ network }}",
{% endfor %}
{% endif %}
{% if user_list.ip6 is defined %}
Framed-IPv6-Address = {{ user_list.ip6 }},
{% endif %}
{% if user_list.vlan is defined %}
Tunnel-Type = VLAN,
Tunnel-Medium-Type = IEEE-802,
Tunnel-Private-Group-Id = {{ user_list.vlan }}{% endif %}{% if user_list.wispr_bw_min_up is defined %},
WISPr-Bandwidth-Min-Up = {{ user_list.wispr_bw_min_up }}{% endif %}{% if user_list.wispr_bw_max_up is defined %},
WISPr-Bandwidth-Max-Up = {{ user_list.wispr_bw_max_up }}{% endif %}{% if user_list.wispr_bw_min_down is defined %},
WISPr-Bandwidth-Min-Down = {{ user_list.wispr_bw_min_down }}{% endif %}{% if user_list.wispr_bw_max_down is defined %},
WISPr-Bandwidth-Max-Down = {{ user_list.wispr_bw_max_down }}{% endif %}{% if user_list.chillispot_bw_max_up is defined %},
ChilliSpot-Bandwidth-Max-Up = {{ user_list.chillispot_bw_max_up }}{% endif %}{% if user_list.chillispot_bw_max_down is defined %},
ChilliSpot-Bandwidth-Max-Down = {{ user_list.chillispot_bw_max_down }}
Tunnel-Private-Group-Id = {{ user_list.vlan }},
{% endif %}
{% if user_list.wispr_bw_min_up is defined %}
WISPr-Bandwidth-Min-Up = {{ user_list.wispr_bw_min_up }},
{% endif %}
{% if user_list.wispr_bw_max_up is defined %}
WISPr-Bandwidth-Max-Up = {{ user_list.wispr_bw_max_up }},
{% endif %}
{% if user_list.wispr_bw_min_down is defined %}
WISPr-Bandwidth-Min-Down = {{ user_list.wispr_bw_min_down }},
{% endif %}
{% if user_list.wispr_bw_max_down is defined %}
WISPr-Bandwidth-Max-Down = {{ user_list.wispr_bw_max_down }},
{% endif %}
{% if user_list.chillispot_bw_max_up is defined %}
ChilliSpot-Bandwidth-Max-Up = {{ user_list.chillispot_bw_max_up }},
{% endif %}
{% if user_list.chillispot_bw_max_down is defined %}
ChilliSpot-Bandwidth-Max-Down = {{ user_list.chillispot_bw_max_down }},
{% endif %}
Framed-Protocol = PPP
{% endif %}