Skip to content

Commit

Permalink
Fix SNMPv3 password configuration (#1122)
Browse files Browse the repository at this point in the history
* Add SNMPInflight metric (#1119)

* Add SNMPInflight metric

---------

Signed-off-by: Kakuya Ando <fservak@gmail.com>
Signed-off-by: Robert Bergman <rob.bergman@gmail.com>

* 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 <rob.bergman@gmail.com>

---------

Signed-off-by: Kakuya Ando <fservak@gmail.com>
Signed-off-by: Robert Bergman <rob.bergman@gmail.com>
Co-authored-by: Kakuya Ando <fservak@gmail.com>
  • Loading branch information
RobertBergman and servak authored Feb 27, 2024
1 parent 3b6d537 commit 6edf9d8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 6edf9d8

Please sign in to comment.