Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#73552 - [net-snmp] broken `net-snmp-config --create-snmpv3-user`
Attached to Project:
Arch Linux
Opened by Noel Kuntze (thermi) - Saturday, 29 January 2022, 23:33 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:17 GMT
Opened by Noel Kuntze (thermi) - Saturday, 29 January 2022, 23:33 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:17 GMT
|
DetailsDescription:
Using `net-snmp-config --create-snmpv3-user` is recommended for adding SNMPv3 users. However execution of the script fails because of two issues, both easily solvable: 1) broken check for snmpd running: ``` if -acx | egrep ' snmpd *$' > /dev/null 2>&1 ; then echo "Apparently at least one snmpd demon is already running." echo "You must stop them in order to use this command." exit 1 fi ``` Here the issue is that if -acx is not valid syntax. This is because in the wide whitespace between `if` and `-acx` there is supposed to be the expansion of $PSPROG which is determined at build time and resolves to `/usr/bin/ps`, but only if it is installed. `ps` is part of `procps-ng`. The variable is successfully expanded when procps-ng is installed at build time. So please add that to makedepends and depends. 2) broken expansion of ${datarootdir} The script adds the user to /etc/snmp/snmpd.conf, which fails because ${datarootdir} is not set prior to expansion, thus it's empty, causing the script to try to write /snmp/snmpd.conf, which doesn't exist. ``` outfile="${datarootdir}/snmp/snmpd.conf" line="$token $user" echo "adding the following line to $outfile:" echo " $line" if test ! -d "$outfile"; then touch "$outfile" fi echo "$line" >> $outfile ``` Commit 72dee028836d233979e4563ce3c3d5e303e0e042 in the net-snmp repo fixes that: https://github.com/net-snmp/net-snmp/commit/72dee028836d233979e4563ce3c3d5e303e0e042 I tried with the two changes and it fixes the issues. Steps to reproduce: 1) Have net-snmp installed (sudo pacman -S net-snmp) 2) mkdir /etc/snmp && touch /etc/snmp/snmpd.conf 3) net-snmp-config --create-snmpv3-user -A FOOBAR -X FOOBAR testuser see execution fail: ``` [root@rpi2-1 thermi]# LANG=C net-snmp-config --create-snmpv3-user -A FOOBAR -X FOOBAR testuser /usr/bin/net-snmp-create-v3-user: line 6: -acx: command not found adding the following line to /var/net-snmp/snmpd.conf: createUser testuser MD5 "FOOBAR" DES "FOOBAR" adding the following line to /snmp/snmpd.conf: rwuser testuser touch: cannot touch '/snmp/snmpd.conf': No such file or directory /usr/bin/net-snmp-create-v3-user: line 146: /snmp/snmpd.conf: No such file or directory ``` |
This task depends upon
Closed by Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:17 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/p ackaging/packages/net-snmp/issues/1
Saturday, 25 November 2023, 20:17 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/p ackaging/packages/net-snmp/issues/1

Disregard the hostname in the output, it's reproducible on my Arch Linux laptop, and version is naturally latest, 5.9.1-3.