netsnmp 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/lib/netsnmp/message.rb +15 -5
- data/lib/netsnmp/security_parameters.rb +10 -2
- data/lib/netsnmp/version.rb +1 -1
- data/sig/message.rbs +4 -0
- data/sig/security_parameters.rbs +2 -2
- data/spec/client_spec.rb +44 -35
- data/spec/handlers/celluloid_spec.rb +11 -11
- data/spec/security_parameters_spec.rb +18 -0
- data/spec/support/request_examples.rb +13 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93b380d735dc2250a9c3528e7ab1e6c70147124a6dc439fe7dd4eac1f4c0fd55
|
4
|
+
data.tar.gz: 52db8f559bc3485ab4802d72ccba98fb29429a0b9a0cceec13fc5a489409e35e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a7573fe1ca2f0d78a3ca4d88d8054b9fd872078352d8ed3f700525e049719d601fe8f7dda94f0ff77b866e75961eb26af80a4acd332e04d390c433405970fd7
|
7
|
+
data.tar.gz: 3524298a40a89f5364a27cfe0444f7e298016822439020c04b203960cc4c77622453f9a48d6c01ea1e072c3a004705299b6a8f34a89cb1ce00f66a98f3919d7a
|
data/README.md
CHANGED
@@ -31,6 +31,7 @@ $ gem install netsnmp
|
|
31
31
|
This gem provides:
|
32
32
|
|
33
33
|
* Implementation in ruby of the SNMP Protocol for v3, v2c and v1 (most notable the rfc3414 and 3826).
|
34
|
+
* SNMPv3 USM supporting MD5/SHA/SHA256 auth and DES/AES128 privacy crypto algorithms.
|
34
35
|
* Client/Manager API with simple interface for get, genext, set and walk.
|
35
36
|
* Pure Ruby.
|
36
37
|
* Support for concurrency and evented I/O.
|
@@ -80,7 +81,7 @@ manager.get(oid: "sysName.0") #=> 'tt'
|
|
80
81
|
# SNMP walk
|
81
82
|
# sysORDescr
|
82
83
|
manager.walk(oid: "sysORDescr").each do |oid_code, value|
|
83
|
-
# do something with them
|
84
|
+
# do something with them
|
84
85
|
puts "for #{oid_code}: #{value}"
|
85
86
|
end
|
86
87
|
|
@@ -214,8 +215,8 @@ gem 'netsnmp'
|
|
214
215
|
|
215
216
|
# or, in the command line
|
216
217
|
|
217
|
-
$ gem install netsnmp
|
218
|
-
```
|
218
|
+
$ gem install netsnmp
|
219
|
+
```
|
219
220
|
|
220
221
|
and `netsnmp` will automatically pick it up.
|
221
222
|
|
data/lib/netsnmp/message.rb
CHANGED
@@ -7,8 +7,7 @@ module NETSNMP
|
|
7
7
|
|
8
8
|
prepend Loggable
|
9
9
|
|
10
|
-
|
11
|
-
PRIVNONE = OpenSSL::ASN1::OctetString.new("")
|
10
|
+
PRIVNONE = OpenSSL::ASN1::OctetString.new("")
|
12
11
|
MSG_MAX_SIZE = OpenSSL::ASN1::Integer.new(65507).with_label(:max_message_size)
|
13
12
|
MSG_SECURITY_MODEL = OpenSSL::ASN1::Integer.new(3).with_label(:security_model) # usmSecurityModel
|
14
13
|
MSG_VERSION = OpenSSL::ASN1::Integer.new(3).with_label(:message_version)
|
@@ -17,7 +16,7 @@ module NETSNMP
|
|
17
16
|
def initialize(**); end
|
18
17
|
|
19
18
|
def verify(stream, auth_param, security_level, security_parameters:)
|
20
|
-
security_parameters.verify(stream.sub(auth_param,
|
19
|
+
security_parameters.verify(stream.sub(auth_param, authnone(security_parameters.auth_protocol).value), auth_param, security_level: security_level)
|
21
20
|
end
|
22
21
|
|
23
22
|
# @param [String] payload of an snmp v3 message which can be decoded
|
@@ -91,7 +90,7 @@ module NETSNMP
|
|
91
90
|
OpenSSL::ASN1::Integer.new(engine_boots).with_label(:engine_boots),
|
92
91
|
OpenSSL::ASN1::Integer.new(engine_time).with_label(:engine_time),
|
93
92
|
OpenSSL::ASN1::OctetString.new(security_parameters.username).with_label(:username),
|
94
|
-
|
93
|
+
authnone(security_parameters.auth_protocol),
|
95
94
|
salt_param
|
96
95
|
]).with_label(:security_params)
|
97
96
|
log(level: 2) { sec_params.to_hex }
|
@@ -120,11 +119,22 @@ module NETSNMP
|
|
120
119
|
log { "signing V3 message..." }
|
121
120
|
auth_salt = OpenSSL::ASN1::OctetString.new(signature).with_label(:auth)
|
122
121
|
log(level: 2) { auth_salt.to_hex }
|
123
|
-
none_der =
|
122
|
+
none_der = authnone(security_parameters.auth_protocol).to_der
|
124
123
|
encoded[encoded.index(none_der), none_der.size] = auth_salt.to_der
|
125
124
|
log { Hexdump.dump(encoded) }
|
126
125
|
end
|
127
126
|
encoded
|
128
127
|
end
|
128
|
+
|
129
|
+
private
|
130
|
+
|
131
|
+
# https://datatracker.ietf.org/doc/html/rfc7860#section-4.2.2 part 3
|
132
|
+
# https://datatracker.ietf.org/doc/html/rfc3414#section-6.3.2 part 3
|
133
|
+
def authnone(auth_protocol)
|
134
|
+
# The digest in the msgAuthenticationParameters field is replaced by the 12 zero octets.
|
135
|
+
# 24 octets for sha256
|
136
|
+
number_of_octets = auth_protocol == :sha256 ? 24 : 12
|
137
|
+
OpenSSL::ASN1::OctetString.new("\x00" * number_of_octets).with_label(:auth_mask)
|
138
|
+
end
|
129
139
|
end
|
130
140
|
end
|
@@ -22,13 +22,13 @@ module NETSNMP
|
|
22
22
|
# The 150 Seconds is specified in https://www.ietf.org/rfc/rfc2574.txt 2.2.3
|
23
23
|
TIMELINESS_THRESHOLD = 150
|
24
24
|
|
25
|
-
attr_reader :security_level, :username
|
25
|
+
attr_reader :security_level, :username, :auth_protocol
|
26
26
|
attr_reader :engine_id
|
27
27
|
|
28
28
|
# @param [String] username the snmp v3 username
|
29
29
|
# @param [String] engine_id the device engine id (initialized to '' for report)
|
30
30
|
# @param [Symbol, integer] security_level allowed snmp v3 security level (:auth_priv, :auth_no_priv, etc)
|
31
|
-
# @param [Symbol, nil] auth_protocol a supported authentication protocol (currently supported: :md5, :sha)
|
31
|
+
# @param [Symbol, nil] auth_protocol a supported authentication protocol (currently supported: :md5, :sha, :sha256)
|
32
32
|
# @param [Symbol, nil] priv_protocol a supported privacy protocol (currently supported: :des, :aes)
|
33
33
|
# @param [String, nil] auth_password the authentication password
|
34
34
|
# @param [String, nil] priv_password the privacy password
|
@@ -110,6 +110,12 @@ module NETSNMP
|
|
110
110
|
|
111
111
|
key = auth_key.dup
|
112
112
|
|
113
|
+
# SHA256 => https://datatracker.ietf.org/doc/html/rfc7860#section-4.2.2
|
114
|
+
# The 24 first octets of HMAC are taken as the computed MAC value
|
115
|
+
return OpenSSL::HMAC.digest("SHA256", key, message)[0, 24] if @auth_protocol == :sha256
|
116
|
+
|
117
|
+
# MD5 => https://datatracker.ietf.org/doc/html/rfc3414#section-6.3.2
|
118
|
+
# SHA1 => https://datatracker.ietf.org/doc/html/rfc3414#section-7.3.2
|
113
119
|
key << "\x00" * (@auth_protocol == :md5 ? 48 : 44)
|
114
120
|
k1 = key.xor(IPAD)
|
115
121
|
k2 = key.xor(OPAD)
|
@@ -120,6 +126,7 @@ module NETSNMP
|
|
120
126
|
|
121
127
|
digest.reset
|
122
128
|
digest << (k2 + d1)
|
129
|
+
# The 12 first octets of the digest are taken as the computed MAC value
|
123
130
|
digest.digest[0, 12]
|
124
131
|
end
|
125
132
|
|
@@ -204,6 +211,7 @@ module NETSNMP
|
|
204
211
|
@digest ||= case @auth_protocol
|
205
212
|
when :md5 then OpenSSL::Digest::MD5.new
|
206
213
|
when :sha then OpenSSL::Digest::SHA1.new
|
214
|
+
when :sha256 then OpenSSL::Digest::SHA256.new
|
207
215
|
else
|
208
216
|
raise Error, "unsupported auth protocol: #{@auth_protocol}"
|
209
217
|
end
|
data/lib/netsnmp/version.rb
CHANGED
data/sig/message.rbs
CHANGED
@@ -7,5 +7,9 @@ module NETSNMP
|
|
7
7
|
def decode: (String stream, security_parameters: SecurityParameters) -> [ScopedPDU, String, Integer, Integer]
|
8
8
|
|
9
9
|
def encode: (ScopedPDU pdu, security_parameters: SecurityParameters, ?engine_boots: Integer, ?engine_time: Integer) -> String
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def authnone: (SecurityParameters::auth_protocol?) -> OpenSSL::ASN1::ASN1Data
|
10
14
|
end
|
11
15
|
end
|
data/sig/security_parameters.rbs
CHANGED
@@ -4,11 +4,10 @@ module NETSNMP
|
|
4
4
|
|
5
5
|
type security_level = :noauth | :auth_no_priv | :auth_priv | 0 | 1 | 3 | nil
|
6
6
|
|
7
|
-
type auth_protocol = :md5 | :sha
|
7
|
+
type auth_protocol = :md5 | :sha | :sha256
|
8
8
|
type priv_protocol = :des | :aes
|
9
9
|
|
10
10
|
|
11
|
-
@auth_protocol: auth_protocol?
|
12
11
|
@auth_password: String?
|
13
12
|
@priv_protocol: priv_protocol?
|
14
13
|
@priv_password: String?
|
@@ -18,6 +17,7 @@ module NETSNMP
|
|
18
17
|
attr_reader security_level: security_level
|
19
18
|
attr_reader username: String
|
20
19
|
attr_reader engine_id: String
|
20
|
+
attr_reader auth_protocol: auth_protocol?
|
21
21
|
|
22
22
|
def engine_id=: (String id) -> void
|
23
23
|
|
data/spec/client_spec.rb
CHANGED
@@ -23,19 +23,19 @@ RSpec.describe NETSNMP::Client do
|
|
23
23
|
let(:next_oid) { "1.3.6.1.2.1.1.6.0" }
|
24
24
|
let(:walk_oid) { "1.3.6.1.2.1.1" }
|
25
25
|
let(:set_oid) { "sysUpTime.0" } # sysUpTimeInstance
|
26
|
-
let(:get_result) { "
|
27
|
-
let(:next_result) { "
|
26
|
+
let(:get_result) { "zeus.snmplabs.com (you can change this!)" }
|
27
|
+
let(:next_result) { "San Francisco, California, United States" }
|
28
28
|
let(:walk_result) do
|
29
|
-
|
30
|
-
1.3.6.1.2.1.1.1.0:
|
31
|
-
1.3.6.1.2.1.1.2.0
|
32
|
-
1.3.6.1.2.1.1.3.0
|
33
|
-
1.3.6.1.2.1.1.4.0
|
34
|
-
1.3.6.1.2.1.1.5.0
|
35
|
-
1.3.6.1.2.1.1.6.0
|
36
|
-
1.3.6.1.2.1.1.7.0
|
37
|
-
1.3.6.1.2.1.1.8.0
|
38
|
-
|
29
|
+
{
|
30
|
+
"1.3.6.1.2.1.1.1.0" => "Linux zeus 4.8.6.5-smp #2 SMP Sun Nov 13 14:58:11 CDT 2016 i686",
|
31
|
+
"1.3.6.1.2.1.1.2.0" => "1.3.6.1.4.1.8072.3.2.10",
|
32
|
+
"1.3.6.1.2.1.1.3.0" => /Timeticks: \(\d+\) \d+ days, \d+:\d+:\d+\.\d+/,
|
33
|
+
"1.3.6.1.2.1.1.4.0" => "SNMP Laboratories, info@snmplabs.com",
|
34
|
+
"1.3.6.1.2.1.1.5.0" => "zeus.snmplabs.com (you can change this!)",
|
35
|
+
"1.3.6.1.2.1.1.6.0" => "San Francisco, California, United States",
|
36
|
+
"1.3.6.1.2.1.1.7.0" => "72",
|
37
|
+
"1.3.6.1.2.1.1.8.0" => /Timeticks: \(\d+\) \d+ days, \d+:\d+:\d+\.\d+/
|
38
|
+
}
|
39
39
|
end
|
40
40
|
let(:set_oid_result) { 43 }
|
41
41
|
end
|
@@ -52,19 +52,19 @@ RSpec.describe NETSNMP::Client do
|
|
52
52
|
let(:next_oid) { "1.3.6.1.2.1.1.6.0" }
|
53
53
|
let(:walk_oid) { "system" }
|
54
54
|
let(:set_oid) { "sysUpTime.0" }
|
55
|
-
let(:get_result) { "
|
56
|
-
let(:next_result) { "
|
55
|
+
let(:get_result) { "zeus.snmplabs.com (you can change this!)" }
|
56
|
+
let(:next_result) { "San Francisco, California, United States" }
|
57
57
|
let(:walk_result) do
|
58
|
-
|
59
|
-
1.3.6.1.2.1.1.1.0:
|
60
|
-
1.3.6.1.2.1.1.2.0
|
61
|
-
1.3.6.1.2.1.1.3.0
|
62
|
-
1.3.6.1.2.1.1.4.0
|
63
|
-
1.3.6.1.2.1.1.5.0
|
64
|
-
1.3.6.1.2.1.1.6.0
|
65
|
-
1.3.6.1.2.1.1.7.0
|
66
|
-
1.3.6.1.2.1.1.8.0
|
67
|
-
|
58
|
+
{
|
59
|
+
"1.3.6.1.2.1.1.1.0" => "Linux zeus 4.8.6.5-smp #2 SMP Sun Nov 13 14:58:11 CDT 2016 i686",
|
60
|
+
"1.3.6.1.2.1.1.2.0" => "1.3.6.1.4.1.8072.3.2.10",
|
61
|
+
"1.3.6.1.2.1.1.3.0" => /Timeticks: \(\d+\) \d+ days, \d+:\d+:\d+\.\d+/,
|
62
|
+
"1.3.6.1.2.1.1.4.0" => "SNMP Laboratories, info@snmplabs.com",
|
63
|
+
"1.3.6.1.2.1.1.5.0" => "zeus.snmplabs.com (you can change this!)",
|
64
|
+
"1.3.6.1.2.1.1.6.0" => "San Francisco, California, United States",
|
65
|
+
"1.3.6.1.2.1.1.7.0" => "72",
|
66
|
+
"1.3.6.1.2.1.1.8.0" => /Timeticks: \(\d+\) \d+ days, \d+:\d+:\d+\.\d+/
|
67
|
+
}
|
68
68
|
end
|
69
69
|
let(:set_oid_result) { 43 }
|
70
70
|
|
@@ -101,18 +101,18 @@ RSpec.describe NETSNMP::Client do
|
|
101
101
|
let(:set_oid) { "sysUpTime.0" } # sysUpTimeInstance
|
102
102
|
let(:walk_oid) { "1.3.6.1.2.1.1.9.1.3" }
|
103
103
|
let(:get_result) { "tt" }
|
104
|
-
let(:next_result) { "KK12" }
|
104
|
+
let(:next_result) { "KK12 (edit /etc/snmp/snmpd.conf)" }
|
105
105
|
let(:walk_result) do
|
106
|
-
|
107
|
-
1.3.6.1.2.1.1.9.1.3.1
|
108
|
-
1.3.6.1.2.1.1.9.1.3.2
|
109
|
-
1.3.6.1.2.1.1.9.1.3.3
|
110
|
-
1.3.6.1.2.1.1.9.1.3.4
|
111
|
-
1.3.6.1.2.1.1.9.1.3.5
|
112
|
-
1.3.6.1.2.1.1.9.1.3.6
|
113
|
-
1.3.6.1.2.1.1.9.1.3.7
|
114
|
-
1.3.6.1.2.1.1.9.1.3.8
|
115
|
-
|
106
|
+
{
|
107
|
+
"1.3.6.1.2.1.1.9.1.3.1" => "The SNMP Management Architecture MIB.",
|
108
|
+
"1.3.6.1.2.1.1.9.1.3.2" => "The MIB for Message Processing and Dispatching.",
|
109
|
+
"1.3.6.1.2.1.1.9.1.3.3" => "The management information definitions for the SNMP User-based Security Model.",
|
110
|
+
"1.3.6.1.2.1.1.9.1.3.4" => "The MIB module for SNMPv2 entities",
|
111
|
+
"1.3.6.1.2.1.1.9.1.3.5" => "The MIB module for managing TCP implementations",
|
112
|
+
"1.3.6.1.2.1.1.9.1.3.6" => "The MIB module for managing IP and ICMP implementations",
|
113
|
+
"1.3.6.1.2.1.1.9.1.3.7" => "The MIB module for managing UDP implementations",
|
114
|
+
"1.3.6.1.2.1.1.9.1.3.8" => "View-based Access Control Model for SNMP."
|
115
|
+
}
|
116
116
|
end
|
117
117
|
let(:set_oid_result) { 43 }
|
118
118
|
context "with a no auth no priv policy" do
|
@@ -157,6 +157,15 @@ RSpec.describe NETSNMP::Client do
|
|
157
157
|
let(:protocol_options) { version_options.merge(user_options).merge(extra_options) }
|
158
158
|
end
|
159
159
|
end
|
160
|
+
context "speaking sha256" do
|
161
|
+
let(:user_options) do
|
162
|
+
{ username: "authsha256", security_level: :auth_no_priv,
|
163
|
+
auth_password: "maplesyrup", auth_protocol: :sha256 }
|
164
|
+
end
|
165
|
+
it_behaves_like "an snmp client" do
|
166
|
+
let(:protocol_options) { version_options.merge(user_options).merge(extra_options) }
|
167
|
+
end
|
168
|
+
end
|
160
169
|
end
|
161
170
|
context "with an auth priv policy" do
|
162
171
|
context "auth in md5, encrypting in des" do
|
@@ -17,18 +17,18 @@ RSpec.describe "with cellulloid", type: :celluloid do
|
|
17
17
|
let(:set_oid) { "1.3.6.1.2.1.1.3.0" } # sysUpTimeInstance
|
18
18
|
let(:walk_oid) { "1.3.6.1.2.1.1.9.1.3" }
|
19
19
|
let(:get_result) { "tt" }
|
20
|
-
let(:next_result) { "KK12" }
|
20
|
+
let(:next_result) { "KK12 (edit /etc/snmp/snmpd.conf)" }
|
21
21
|
let(:walk_result) do
|
22
|
-
|
23
|
-
1.3.6.1.2.1.1.9.1.3.1
|
24
|
-
1.3.6.1.2.1.1.9.1.3.2
|
25
|
-
1.3.6.1.2.1.1.9.1.3.3
|
26
|
-
1.3.6.1.2.1.1.9.1.3.4
|
27
|
-
1.3.6.1.2.1.1.9.1.3.5
|
28
|
-
1.3.6.1.2.1.1.9.1.3.6
|
29
|
-
1.3.6.1.2.1.1.9.1.3.7
|
30
|
-
1.3.6.1.2.1.1.9.1.3.8
|
31
|
-
|
22
|
+
{
|
23
|
+
"1.3.6.1.2.1.1.9.1.3.1" => "The SNMP Management Architecture MIB.",
|
24
|
+
"1.3.6.1.2.1.1.9.1.3.2" => "The MIB for Message Processing and Dispatching.",
|
25
|
+
"1.3.6.1.2.1.1.9.1.3.3" => "The management information definitions for the SNMP User-based Security Model.",
|
26
|
+
"1.3.6.1.2.1.1.9.1.3.4" => "The MIB module for SNMPv2 entities",
|
27
|
+
"1.3.6.1.2.1.1.9.1.3.5" => "The MIB module for managing TCP implementations",
|
28
|
+
"1.3.6.1.2.1.1.9.1.3.6" => "The MIB module for managing IP and ICMP implementations",
|
29
|
+
"1.3.6.1.2.1.1.9.1.3.7" => "The MIB module for managing UDP implementations",
|
30
|
+
"1.3.6.1.2.1.1.9.1.3.8" => "View-based Access Control Model for SNMP."
|
31
|
+
}
|
32
32
|
end
|
33
33
|
|
34
34
|
before(:all) { Celluloid.boot }
|
@@ -13,6 +13,13 @@ RSpec.describe NETSNMP::SecurityParameters do
|
|
13
13
|
subject { described_class.new(security_level: :auth_priv, auth_protocol: :sha, username: "username", engine_id: engine_id, auth_password: "maplesyrup", priv_password: "maplesyrup") }
|
14
14
|
it { expect(subject.send(:passkey, password).b).to eq("\x9f\xb5\xcc\x03\x81\x49\x7b\x37\x93\x52\x89\x39\xff\x78\x8d\x5d\x79\x14\x52\x11".b) }
|
15
15
|
end
|
16
|
+
context "sha256" do
|
17
|
+
subject do
|
18
|
+
described_class.new(security_level: :auth_priv, auth_protocol: :sha256, username: "username", engine_id: engine_id, auth_password: "maplesyrup", priv_password: "maplesyrup")
|
19
|
+
end
|
20
|
+
|
21
|
+
it { expect(subject.send(:passkey, password).b).to eq("\xABQ\x01M\x1E\a\x7F`\x17\xDF+\x12\xBE\xE5\xF5\xAAr\x991w\xE9\xBBV\x9CM\xFFZL\xA0\xB4\xAF\xAC".b) }
|
22
|
+
end
|
16
23
|
end
|
17
24
|
|
18
25
|
describe "keys" do
|
@@ -34,11 +41,22 @@ RSpec.describe NETSNMP::SecurityParameters do
|
|
34
41
|
priv_password: password,
|
35
42
|
engine_id: engine_id)
|
36
43
|
end
|
44
|
+
let(:sha256_sec) do
|
45
|
+
described_class.new(security_level: :auth_priv,
|
46
|
+
auth_protocol: :sha256,
|
47
|
+
priv_protocol: :des,
|
48
|
+
username: "username",
|
49
|
+
auth_password: password,
|
50
|
+
priv_password: password,
|
51
|
+
engine_id: engine_id)
|
52
|
+
end
|
37
53
|
it do
|
38
54
|
expect(md5_sec.send(:auth_key)).to eq("\x52\x6f\x5e\xed\x9f\xcc\xe2\x6f\x89\x64\xc2\x93\x07\x87\xd8\x2b".b)
|
39
55
|
expect(md5_sec.send(:priv_key)).to eq("\x52\x6f\x5e\xed\x9f\xcc\xe2\x6f\x89\x64\xc2\x93\x07\x87\xd8\x2b".b)
|
40
56
|
expect(sha_sec.send(:auth_key)).to eq("\x66\x95\xfe\xbc\x92\x88\xe3\x62\x82\x23\x5f\xc7\x15\x1f\x12\x84\x97\xb3\x8f\x3f".b)
|
41
57
|
expect(sha_sec.send(:priv_key)).to eq("\x66\x95\xfe\xbc\x92\x88\xe3\x62\x82\x23\x5f\xc7\x15\x1f\x12\x84\x97\xb3\x8f\x3f".b)
|
58
|
+
expect(sha256_sec.send(:auth_key)).to eq("\x89\x82\xE0\xE5I\xE8f\xDB6\x1Akb]\x84\xCC\xCC\x11\x16-E>\xE8\xCE:dE\xC2\xD6wo\x0F\x8B".b)
|
59
|
+
expect(sha256_sec.send(:priv_key)).to eq("\x89\x82\xE0\xE5I\xE8f\xDB6\x1Akb]\x84\xCC\xCC\x11\x16-E>\xE8\xCE:dE\xC2\xD6wo\x0F\x8B".b)
|
42
60
|
end
|
43
61
|
end
|
44
62
|
|
@@ -22,8 +22,8 @@ RSpec.shared_examples "an snmp client" do
|
|
22
22
|
let(:value) { subject.get({ oid: get_oid }, oid: next_oid) }
|
23
23
|
it "returns the values for both" do
|
24
24
|
expect(value).to be_a(Array)
|
25
|
-
expect(value).to include(
|
26
|
-
expect(value).to include(
|
25
|
+
expect(value).to include(get_result)
|
26
|
+
expect(value).to include(next_result)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -40,8 +40,17 @@ RSpec.shared_examples "an snmp client" do
|
|
40
40
|
describe "#walk" do
|
41
41
|
let(:value) { subject.walk(oid: walk_oid) }
|
42
42
|
it "fetches the varbinds for the next oid" do
|
43
|
-
|
44
|
-
|
43
|
+
value.each do |oid, val|
|
44
|
+
match = walk_result[oid]
|
45
|
+
case match
|
46
|
+
when String
|
47
|
+
expect(val.to_s).to eq(match)
|
48
|
+
when Regexp
|
49
|
+
expect(val.to_s).to match(match)
|
50
|
+
else
|
51
|
+
next
|
52
|
+
end
|
53
|
+
end
|
45
54
|
end
|
46
55
|
end
|
47
56
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netsnmp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parslet
|