summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsever-sever <v.gletenko@vyos.io>2020-10-22 10:35:19 +0000
committersever-sever <v.gletenko@vyos.io>2020-10-27 10:45:03 +0000
commit29ed00aed66c648510480897bd92977652e5d18f (patch)
tree317da5634237e8b1184cd4423be619348965e0ad
parentc6c8c453076a06188d577730f0ab570e8daef5f2 (diff)
downloadvyos-1x-29ed00aed66c648510480897bd92977652e5d18f.tar.gz
vyos-1x-29ed00aed66c648510480897bd92977652e5d18f.zip
accel: T2631: Add option for radius disable-accounting
-rw-r--r--interface-definitions/include/accel-radius-additions-disable-accounting.xlm.in7
-rw-r--r--interface-definitions/include/accel-radius-additions.xml.i1
-rw-r--r--interface-definitions/vpn_l2tp.xml.in1
-rw-r--r--python/vyos/configdict.py5
-rwxr-xr-xsrc/conf_mode/vpn_l2tp.py3
-rwxr-xr-xsrc/conf_mode/vpn_pptp.py3
6 files changed, 20 insertions, 0 deletions
diff --git a/interface-definitions/include/accel-radius-additions-disable-accounting.xlm.in b/interface-definitions/include/accel-radius-additions-disable-accounting.xlm.in
new file mode 100644
index 000000000..026f67453
--- /dev/null
+++ b/interface-definitions/include/accel-radius-additions-disable-accounting.xlm.in
@@ -0,0 +1,7 @@
+<leafNode name="disable-accounting">
+ <properties>
+ <help>Disable accounting</help>
+ <valueless/>
+ </properties>
+</leafNode>
+
diff --git a/interface-definitions/include/accel-radius-additions.xml.i b/interface-definitions/include/accel-radius-additions.xml.i
index 598fb73f8..bf0f0ac94 100644
--- a/interface-definitions/include/accel-radius-additions.xml.i
+++ b/interface-definitions/include/accel-radius-additions.xml.i
@@ -29,6 +29,7 @@
</properties>
<defaultValue>1813</defaultValue>
</leafNode>
+ #include <include/accel-radius-additions-disable-accounting.xlm.in>
<leafNode name="fail-time">
<properties>
<help>Mark server unavailable for &lt;n&gt; seconds on failure</help>
diff --git a/interface-definitions/vpn_l2tp.xml.in b/interface-definitions/vpn_l2tp.xml.in
index 8802c0564..82af86470 100644
--- a/interface-definitions/vpn_l2tp.xml.in
+++ b/interface-definitions/vpn_l2tp.xml.in
@@ -225,6 +225,7 @@
<children>
<tagNode name="server">
<children>
+ #include <include/accel-radius-additions-disable-accounting.xlm.in>
<leafNode name="fail-time">
<properties>
<help>Mark server unavailable for &lt;n&gt; seconds on failure</help>
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index 62df3334c..db17c33fc 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -455,6 +455,11 @@ def get_accel_dict(config, base, chap_secrets):
dict['authentication']['radius']['server'][server] = dict_merge(
default_values, dict['authentication']['radius']['server'][server])
+ # Check option "disable-accounting" per server and replace default value from '1813' to '0'
+ # set vpn sstp authentication radius server x.x.x.x disable-accounting
+ if 'disable_accounting' in dict['authentication']['radius']['server'][server]:
+ dict['authentication']['radius']['server'][server]['acct_port'] = '0'
+
# Add individual local-user default values
if vyos_dict_search('authentication.local_users.username', dict):
default_values = defaults(base + ['authentication', 'local-users', 'username'])
diff --git a/src/conf_mode/vpn_l2tp.py b/src/conf_mode/vpn_l2tp.py
index da51b0d06..4d82a9400 100755
--- a/src/conf_mode/vpn_l2tp.py
+++ b/src/conf_mode/vpn_l2tp.py
@@ -161,6 +161,9 @@ def get_config(config=None):
conf.set_level(base_path + ['authentication', 'radius', 'server', server])
+ if conf.exists(['disable-accounting']):
+ radius['acct_port'] = '0'
+
if conf.exists(['fail-time']):
radius['fail_time'] = conf.return_value(['fail-time'])
diff --git a/src/conf_mode/vpn_pptp.py b/src/conf_mode/vpn_pptp.py
index 306d05c60..3125ee9d0 100755
--- a/src/conf_mode/vpn_pptp.py
+++ b/src/conf_mode/vpn_pptp.py
@@ -121,6 +121,9 @@ def get_config(config=None):
conf.set_level(base_path + ['authentication', 'radius', 'server', server])
+ if conf.exists(['disable-accounting']):
+ radius['acct_port'] = '0'
+
if conf.exists(['fail-time']):
radius['fail_time'] = conf.return_value(['fail-time'])