Log snmpv3 auth failures (#8917)
This commit is contained in:
parent
7cbde183de
commit
4b2e2c5263
2
go.mod
2
go.mod
|
|
@ -66,7 +66,7 @@ require (
|
|||
github.com/google/go-github/v32 v32.1.0
|
||||
github.com/gopcua/opcua v0.1.13
|
||||
github.com/gorilla/mux v1.7.3
|
||||
github.com/gosnmp/gosnmp v1.30.0
|
||||
github.com/gosnmp/gosnmp v1.31.0
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
|
||||
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
|
||||
github.com/harlow/kinesis-consumer v0.3.1-0.20181230152818-2f58b136fee0
|
||||
|
|
|
|||
4
go.sum
4
go.sum
|
|
@ -590,8 +590,8 @@ github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2z
|
|||
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/gosnmp/gosnmp v1.30.0 h1:P6uUvPaoZCZh2EXvSUIgsxYZ1vdD/Sonl2BSVCGieG8=
|
||||
github.com/gosnmp/gosnmp v1.30.0/go.mod h1:EIp+qkEpXoVsyZxXKy0AmXQx0mCHMMcIhXXvNDMpgF0=
|
||||
github.com/gosnmp/gosnmp v1.31.0 h1:l18tqymKfReKBPr3kMK4mMM+n3DHlIpsZbBBSy8nuko=
|
||||
github.com/gosnmp/gosnmp v1.31.0/go.mod h1:EIp+qkEpXoVsyZxXKy0AmXQx0mCHMMcIhXXvNDMpgF0=
|
||||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
|
||||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import (
|
|||
"bufio"
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"math"
|
||||
|
|
@ -434,7 +435,17 @@ func (t Table) Build(gs snmpConnection, walk bool) (*RTable, error) {
|
|||
// empty string. This results in all the non-table fields sharing the same
|
||||
// index, and being added on the same row.
|
||||
if pkt, err := gs.Get([]string{oid}); err != nil {
|
||||
return nil, fmt.Errorf("performing get on field %s: %w", f.Name, err)
|
||||
if errors.Is(err, gosnmp.ErrUnknownSecurityLevel) {
|
||||
return nil, fmt.Errorf("unknown security level (sec_level)")
|
||||
} else if errors.Is(err, gosnmp.ErrUnknownUsername) {
|
||||
return nil, fmt.Errorf("unknown username (sec_name)")
|
||||
} else if errors.Is(err, gosnmp.ErrWrongDigest) {
|
||||
return nil, fmt.Errorf("wrong digest (auth_protocol, auth_password)")
|
||||
} else if errors.Is(err, gosnmp.ErrDecryption) {
|
||||
return nil, fmt.Errorf("decryption error (priv_protocol, priv_password)")
|
||||
} else {
|
||||
return nil, fmt.Errorf("performing get on field %s: %w", f.Name, err)
|
||||
}
|
||||
} else if pkt != nil && len(pkt.Variables) > 0 && pkt.Variables[0].Type != gosnmp.NoSuchObject && pkt.Variables[0].Type != gosnmp.NoSuchInstance {
|
||||
ent := pkt.Variables[0]
|
||||
fv, err := fieldConvert(f.Conversion, ent.Value)
|
||||
|
|
|
|||
Loading…
Reference in New Issue