From 6edf9d8d01c0ae6aacf31db33a8c68eb0d5f3699 Mon Sep 17 00:00:00 2001 From: RobertBergman Date: Tue, 27 Feb 2024 05:50:51 -0800 Subject: [PATCH] Fix SNMPv3 password configuration (#1122) * Add SNMPInflight metric (#1119) * Add SNMPInflight metric --------- Signed-off-by: Kakuya Ando Signed-off-by: Robert Bergman * change #1074 broke SNMPv3 by removing the lines that need to go in config.go after 155 and 171 respectively: usm.AuthenticationPassphrase = string(c.Password) and usm.PrivacyPassphrase = string(c.PrivPassword) after adding the back in to the code, I tried running with having variables set via environment and in the snmp.yml and both worked. without them I was getting the error: securityParameter.PrivacyPassphrase is required when a privacy protocol is specified Signed-off-by: Robert Bergman --------- Signed-off-by: Kakuya Ando Signed-off-by: Robert Bergman Co-authored-by: Kakuya Ando --- config/config.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/config.go b/config/config.go index a41f664a..3f60edef 100644 --- a/config/config.go +++ b/config/config.go @@ -153,6 +153,7 @@ func (c Auth) ConfigureSNMP(g *gosnmp.GoSNMP) { priv = true } if auth { + usm.AuthenticationPassphrase = string(c.Password) switch c.AuthProtocol { case "SHA": usm.AuthenticationProtocol = gosnmp.SHA @@ -169,6 +170,7 @@ func (c Auth) ConfigureSNMP(g *gosnmp.GoSNMP) { } } if priv { + usm.PrivacyPassphrase = string(c.PrivPassword) switch c.PrivProtocol { case "DES": usm.PrivacyProtocol = gosnmp.DES