summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsarthurdev <965089+sarthurdev@users.noreply.github.com>2024-03-28 21:04:47 +0100
committersarthurdev <965089+sarthurdev@users.noreply.github.com>2024-03-28 21:04:47 +0100
commita39f8c73ba6063c01e734b27a6e6a6dc72b20a2d (patch)
tree320104dc019cd7fb1aa1233f6d7a77bca1cbdad7
parent82001265750fec18bab13161734ff1a90d2f7fc3 (diff)
downloadvyos-1x-a39f8c73ba6063c01e734b27a6e6a6dc72b20a2d.tar.gz
vyos-1x-a39f8c73ba6063c01e734b27a6e6a6dc72b20a2d.zip
dhcp: T6174: Add TACACS/Radius users to _kea group
Also raise op-mode error when unable to fetch data from Kea socket
-rw-r--r--debian/vyos-1x.postinst2
-rwxr-xr-xsrc/op_mode/dhcp.py10
2 files changed, 10 insertions, 2 deletions
diff --git a/debian/vyos-1x.postinst b/debian/vyos-1x.postinst
index 74fd229b4..0e6e3c863 100644
--- a/debian/vyos-1x.postinst
+++ b/debian/vyos-1x.postinst
@@ -71,6 +71,7 @@ if ! grep -q '^tacacs' /etc/passwd; then
adduser --quiet tacacs${level} sudo
adduser --quiet tacacs${level} disk
adduser --quiet tacacs${level} frr
+ adduser --quiet tacacs${level} _kea
fi
level=$(( level+1 ))
done 2>&1 | grep -v "User tacacs${level} already exists"
@@ -102,6 +103,7 @@ if ! grep -q '^radius_priv_user' /etc/passwd; then
adduser --quiet radius_priv_user disk
adduser --quiet radius_priv_user users
adduser --quiet radius_priv_user frr
+ adduser --quiet radius_priv_user _kea
fi
# add hostsd group for vyos-hostsd
diff --git a/src/op_mode/dhcp.py b/src/op_mode/dhcp.py
index a2f947400..f6029c748 100755
--- a/src/op_mode/dhcp.py
+++ b/src/op_mode/dhcp.py
@@ -80,14 +80,20 @@ def _get_raw_server_leases(family='inet', pool=None, sorted=None, state=[], orig
:return list
"""
inet_suffix = '6' if family == 'inet6' else '4'
- leases = kea_get_leases(inet_suffix)
+ try:
+ leases = kea_get_leases(inet_suffix)
+ except:
+ raise vyos.opmode.DataUnavailable('Cannot fetch DHCP server lease information')
if pool is None:
pool = _get_dhcp_pools(family=family)
else:
pool = [pool]
- active_config = kea_get_active_config(inet_suffix)
+ try:
+ active_config = kea_get_active_config(inet_suffix)
+ except:
+ raise vyos.opmode.DataUnavailable('Cannot fetch DHCP server configuration')
data = []
for lease in leases: