From 78df0c46865b3af89d6bc327b4c1d08cc4450aff Mon Sep 17 00:00:00 2001 From: hagbard Date: Mon, 6 Jan 2020 11:43:03 -0800 Subject: service-snmp: T1931: Enabling SNMP commit error --- src/conf_mode/snmp.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3