summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhagbard <vyosdev@derith.de>2020-01-06 11:43:03 -0800
committerhagbard <vyosdev@derith.de>2020-01-06 11:43:03 -0800
commit78df0c46865b3af89d6bc327b4c1d08cc4450aff (patch)
treec955ede42e031c1d1db3b3b374d135e9193394d5 /src
parentc83d83da98b4521f14c4150c51d4ed4f52f3f902 (diff)
downloadvyos-1x-78df0c46865b3af89d6bc327b4c1d08cc4450aff.tar.gz
vyos-1x-78df0c46865b3af89d6bc327b4c1d08cc4450aff.zip
service-snmp: T1931: Enabling SNMP commit error
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/snmp.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/conf_mode/snmp.py b/src/conf_mode/snmp.py
index 0cba5c88f..7bbfe69bf 100755
--- a/src/conf_mode/snmp.py
+++ b/src/conf_mode/snmp.py
@@ -725,7 +725,18 @@ def apply(snmp):
os.makedirs(nonvolatiledir)
os.chmod(nonvolatiledir, stat.S_IWUSR | stat.S_IRUSR)
# get uid for user 'snmp'
- snmp_uid = pwd.getpwnam('snmp').pw_uid
+ # jessie snmp user = snmp
+ # buster snmp user = Debian-snmp
+ # keep it backwards compatible for Crux
+
+ un = [x[0] for x in pwd.getpwall()]
+ # debian snmp uid is 114 per default across releases
+ snmp_uid = 114
+ if 'snmp' in un:
+ snmp_uid = pwd.getpwnam('snmp').pw_uid
+ elif 'Debian-snmp' in un:
+ snmp_uid = pwd.getpwnam('Debian-snmp').pw_uid
+
os.chown(nonvolatiledir, snmp_uid, -1)
# move SNMP certificate files from volatile location to non volatile /config/snmp