Creation of SNMPv3 user broken (Jammy/22.04)

Bug #1969623 reported by Sascha Lucas
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
net-snmp (Debian)
Fix Released
Unknown
net-snmp (Ubuntu)
Fix Released
High
Sergio Durigan Junior
Impish
Fix Released
High
Sergio Durigan Junior
Jammy
Fix Released
High
Sergio Durigan Junior

Bug Description

[ Impact ]

When creating a SNMPv3 user, the net-snmp-create-v3-user script fails to write the generated configuration file with the following error:

# net-snmp-create-v3-user -ro -A MD5 -a XXXXXX -x YYYYY -X DES ZZZZZ
adding the following line to /var/lib/snmp/snmpd.conf:
   createUser ZZZZZ MD5 "XXXXXX" DES "YYYYY"
adding the following line to /snmp/snmpd.conf:
   rouser ZZZZZ
touch: cannot touch '/snmp/snmpd.conf': No such file or directory
/usr/bin/net-snmp-create-v3-user: 144: cannot create /snmp/snmpd.conf: Directory nonexistent

[ Test Plan ]

The bug affects Impish and Jammy. One can reproduce it by issuing the following commands:

$ lxc launch ubuntu-daily:jammy net-snmp-bug1969623-jammy
$ lxc shell net-snmp-bug1969623-jammy
# apt update
# apt install -y snmpd
# systemctl stop snmpd
# net-snmp-create-v3-user -ro -A MD5 -a XXXXXX -x YYYYY -X DES ZZZZZ

You can verify that the command errors out with:

adding the following line to /var/lib/snmp/snmpd.conf:
   createUser ZZZZZ MD5 "XXXXXX" DES "YYYYY"
adding the following line to /snmp/snmpd.conf:
   rouser ZZZZZ
touch: cannot touch '/snmp/snmpd.conf': No such file or directory
/usr/bin/net-snmp-create-v3-user: 146: cannot create /snmp/snmpd.conf: Directory nonexistent

When using a fixed version of the package, the command should succeed with:

adding the following line to /var/lib/snmp/snmpd.conf:
   createUser ZZZZZ MD5 "XXXXXX" DES "YYYYY"
adding the following line to /usr/share/snmp/snmpd.conf:
   rouser ZZZZZ

[ Where problems could occur ]

The fix is very trivial and shouldn't cause regressions in existing deployments; the only thing being patched is the net-snmp-create-v3-user script, so in the unlikely case that a regression occurs it should be limited to the script. If the user has made local modifications to /usr/bin/net-snmp-create-v3-user in order to workaround the problem, they will lose those modifications when updating the package.

[ Other Info ]

The same bug has been reported in Debian, but the fix there is a bit different:

https://salsa.debian.org/debian/net-snmp/-/commit/b4281b2fc9b7ae7897a01d8be586711df98abad7

Debian's fix is arguably more correct because SNMPCONFPATH will expand to /etc/snmp/, which is the right directory to place configuration files in. However, since we're dealing with an SRU here, I chose to go with upstream's fix because it keeps the old behaviour of placing the config file inside /var/lib/snmp/. We will likely revisit this decision during the KK cycle.

[ Original Description ]

When creating a SNMPv3 user this error appears:

$ /usr/bin/net-snmp-config --create-snmpv3-user -ro -A MD5 -a XXXXXX -x YYYYY -X DES ZZZZZ
touch: cannot touch '/snmp/snmpd.conf': No such file or directory
/usr/bin/net-snmp-create-v3-user: 146: cannot create /snmp/snmpd.conf: Directory nonexistent

Looking at /usr/bin/net-snmp-create-v3-user line 146, it seems that $outfile references ${datarootdir} in line 139, which is undefined. Further outfile is already defined at line 121.

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: snmpd 5.9.1+dfsg-1ubuntu2
ProcVersionSignature: Ubuntu 5.15.0-25.25-generic 5.15.30
Uname: Linux 5.15.0-25-generic x86_64
ApportVersion: 2.20.11-0ubuntu82
Architecture: amd64
CasperMD5CheckResult: pass
Date: Wed Apr 20 13:34:44 2022
InstallationDate: Installed on 2022-04-20 (0 days ago)
InstallationMedia: Ubuntu-Server 22.04 LTS "Jammy Jellyfish" - Beta amd64 (20220330)
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: net-snmp
UpgradeStatus: No upgrade log present (probably fresh install)
modified.conffile..etc.snmp.snmpd.conf: [modified]
mtime.conffile..etc.snmp.snmpd.conf: 2022-04-20T12:50:27.596000

Related branches

Revision history for this message
Sascha Lucas (sascha-lucas) wrote :
Revision history for this message
Paride Legovini (paride) wrote :

Hello Sascha and thanks for this bug report. I can reproduce it using LXD containers and the same dummy options from the bug description. This is a regression from Focal and likely from Impish, at least by looking at the version numbers.

== Focal ==

root@paride-f:~# net-snmp-config --create-snmpv3-user -ro -A MD5 -a XXXXXX -x YYYYY -X DES ZZZZZ
adding the following line to /var/lib/snmp/snmpd.conf:
   createUser ZZZZZ MD5 "XXXXXX" DES "YYYYY"
adding the following line to /usr/share/snmp/snmpd.conf:
   rouser ZZZZZ

== Jammy ==

root@paride-j:~# net-snmp-config --create-snmpv3-user -ro -A MD5 -a XXXXXX -x YYYYY -X DES ZZZZZ
adding the following line to /var/lib/snmp/snmpd.conf:
   createUser ZZZZZ MD5 "XXXXXX" DES "YYYYY"
adding the following line to /snmp/snmpd.conf:
   rouser ZZZZZ
touch: cannot touch '/snmp/snmpd.conf': No such file or directory
/usr/bin/net-snmp-create-v3-user: 146: cannot create /snmp/snmpd.conf: Directory nonexistent

Changed in net-snmp (Ubuntu):
importance: Undecided → High
status: New → Triaged
tags: added: server-todo
Revision history for this message
Paride Legovini (paride) wrote :

Maybe there are good reasons to keep them as they are, but looking at the Focal output:

adding the following line to /var/lib/snmp/snmpd.conf:
   createUser ZZZZZ MD5 "XXXXXX" DES "YYYYY"
adding the following line to /usr/share/snmp/snmpd.conf:
   rouser ZZZZZ

those conf file paths do not look right (policy compliant) to me.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

This has been reported against the Debian package and is fixed in salsa (pending upload).

I will backport the fix to Jammy and Impish, which is also affected.

Changed in net-snmp (Ubuntu Impish):
importance: Undecided → High
assignee: nobody → Sergio Durigan Junior (sergiodj)
Changed in net-snmp (Ubuntu Jammy):
assignee: nobody → Sergio Durigan Junior (sergiodj)
Changed in net-snmp (Ubuntu Impish):
status: New → In Progress
Changed in net-snmp (Ubuntu Jammy):
status: Triaged → In Progress
Changed in net-snmp (Debian):
status: Unknown → Fix Committed
description: updated
description: updated
Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Hello Sascha, or anyone else affected,

Accepted net-snmp into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/net-snmp/5.9.1+dfsg-1ubuntu2.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in net-snmp (Ubuntu Jammy):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-jammy
Revision history for this message
Sascha Lucas (sascha-lucas) wrote :

Hi,

I've testet snmpd-5.9.1+dfsg-1ubuntu2.1 from jammy-proposed. Creation of SNMNPv3 user works now.

Thanks, Sascha.

tags: added: verification-done-jammy
removed: verification-needed-jammy
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package net-snmp - 5.9.1+dfsg-1ubuntu2.1

---------------
net-snmp (5.9.1+dfsg-1ubuntu2.1) jammy; urgency=medium

  * d/p/lp1969623-net-snmp-create-v3-user-Fix-the-snmpd.conf-path.patch:
    Set ${datarootdir} value in net-snmp-create-v3-user and fix
    error when creating user. (LP: #1969623)

 -- Sergio Durigan Junior <email address hidden> Thu, 21 Apr 2022 16:14:05 -0400

Changed in net-snmp (Ubuntu):
status: Fix Committed → Fix Released
Changed in net-snmp (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for net-snmp has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Sascha, or anyone else affected,

Accepted net-snmp into impish-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/net-snmp/5.9+dfsg-3ubuntu3.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-impish to verification-done-impish. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-impish. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in net-snmp (Ubuntu Impish):
status: In Progress → Fix Committed
tags: added: verification-needed-impish
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Verifying the bug for Impish.

First, make sure that the bug is reproduceable:

# apt policy snmpd
snmpd:
  Installed: 5.9+dfsg-3ubuntu2
  Candidate: 5.9+dfsg-3ubuntu2
  Version table:
 *** 5.9+dfsg-3ubuntu2 500
        500 http://archive.ubuntu.com/ubuntu impish/main amd64 Packages
        100 /var/lib/dpkg/status

# net-snmp-create-v3-user -ro -A MD5 -a XXXXXX -x YYYYY -X DES ZZZZZ
adding the following line to /var/lib/snmp/snmpd.conf:
   createUser ZZZZZ MD5 "XXXXXX" DES "YYYYY"
adding the following line to /snmp/snmpd.conf:
   rouser ZZZZZ
touch: cannot touch '/snmp/snmpd.conf': No such file or directory
/usr/bin/net-snmp-create-v3-user: 144: cannot create /snmp/snmpd.conf: Directory nonexistent

Now, update the package and verify that the new version fixes the problem:

# apt policy snmpd
snmpd:
  Installed: 5.9+dfsg-3ubuntu3.1
  Candidate: 5.9+dfsg-3ubuntu3.1
  Version table:
 *** 5.9+dfsg-3ubuntu3.1 500
        500 http://archive.ubuntu.com/ubuntu impish-proposed/main amd64 Packages
        100 /var/lib/dpkg/status
     5.9+dfsg-3ubuntu2 500
        500 http://archive.ubuntu.com/ubuntu impish/main amd64 Packages

# net-snmp-create-v3-user -ro -A MD5 -a XXXXXX -x YYYYY -X DES ZZZZZ
adding the following line to /var/lib/snmp/snmpd.conf:
   createUser ZZZZZ MD5 "XXXXXX" DES "YYYYY"
adding the following line to /usr/share/snmp/snmpd.conf:
   rouser ZZZZZ

Everything works as expected, therefore the fix is verified.

tags: added: verification-done-impish
removed: server-todo verification-needed verification-needed-impish
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package net-snmp - 5.9+dfsg-3ubuntu3.1

---------------
net-snmp (5.9+dfsg-3ubuntu3.1) impish; urgency=medium

  * d/p/lp1969623-net-snmp-create-v3-user-Fix-the-snmpd.conf-path.patch:
    Set ${datarootdir} value in net-snmp-create-v3-user and fix
    error when creating user. (LP: #1969623)

 -- Sergio Durigan Junior <email address hidden> Thu, 21 Apr 2022 18:55:17 -0400

Changed in net-snmp (Ubuntu Impish):
status: Fix Committed → Fix Released
Changed in net-snmp (Debian):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.