net-snmp 3.6.0 → 3.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -6
- package/example/snmp-receiver.js +2 -1
- package/index.js +22 -11
- package/package.json +1 -1
- package/test/receiver-test.sh +2 -3
package/README.md
CHANGED
@@ -243,8 +243,8 @@ This object contains constants to select a supported encryption algorithm for
|
|
243
243
|
SNMPv3 messages that require privacy:
|
244
244
|
* `des` - for DES encryption (CBC-DES)
|
245
245
|
* `aes` - for 128-bit AES encryption (CFB-AES-128)
|
246
|
-
* `aes256b` - for 256-bit AES encryption (CFB-AES-256) with "Blumenthal" key
|
247
|
-
* `aes256r` - for 256-bit AES encryption (CFB-AES-256) with "Reeder" key
|
246
|
+
* `aes256b` - for 256-bit AES encryption (CFB-AES-256) with "Blumenthal" key localization
|
247
|
+
* `aes256r` - for 256-bit AES encryption (CFB-AES-256) with "Reeder" key localization
|
248
248
|
|
249
249
|
DES is the sole encryption algorithm specified in the original SNMPv3 User-Based
|
250
250
|
Security Model RFC (RFC 3414); 128-bit AES for SNMPv3 was added later in RFC 3826.
|
@@ -1062,7 +1062,7 @@ The `table()` method fetches the value for all OIDs lexicographically
|
|
1062
1062
|
following a specified OID in the MIB tree which have the specified OID as
|
1063
1063
|
their base, much like the `subtree()` method.
|
1064
1064
|
|
1065
|
-
This method is designed to fetch
|
1065
|
+
This method is designed to fetch conceptual tables, for example the ifTable
|
1066
1066
|
(`1.3.6.1.2.1.2.2`) table. The values for returned varbinds will be structured
|
1067
1067
|
into objects to represent conceptual rows. Each row is then placed into an
|
1068
1068
|
object with the rows index being the key, e.g.:
|
@@ -1171,7 +1171,7 @@ be in the resulting table.
|
|
1171
1171
|
|
1172
1172
|
This method should be used when only selected columns are required, and
|
1173
1173
|
will be many times faster than the `table()` method since a much smaller
|
1174
|
-
amount of data will be
|
1174
|
+
amount of data will be fetched.
|
1175
1175
|
|
1176
1176
|
The following example fetches the ifTable (`1.3.6.1.2.1.2.2`) table, and
|
1177
1177
|
specifies that only the ifDescr (`1.3.6.1.2.1.2.2.1.2`) and ifPhysAddress
|
@@ -1259,7 +1259,7 @@ returned by the `process.uptime ()` function multiplied by `100`.
|
|
1259
1259
|
SNMP version 2c messages are quite different in comparison with version 1.
|
1260
1260
|
The version 2c trap has a much simpler format, simply a sequence of varbinds.
|
1261
1261
|
The first varbind to be placed in the trap message will be for the
|
1262
|
-
`sysUptime.0` OID (`1.3.6.1.
|
1262
|
+
`sysUptime.0` OID (`1.3.6.1.2.1.1.3.0`). The value for this varbind will
|
1263
1263
|
be the value returned by the `process.uptime ()` function multiplied by 100
|
1264
1264
|
(this can be overridden by providing `upTime` in the optional `options`
|
1265
1265
|
parameter, as documented below).
|
@@ -1280,7 +1280,7 @@ following items:
|
|
1280
1280
|
|
1281
1281
|
* `agentAddr` - IP address used to populate the agent-addr field for SNMP
|
1282
1282
|
version 1 type traps, and defaults to `127.0.0.1`
|
1283
|
-
* `upTime` - Value of the `sysUptime.0` OID (`1.3.6.1.
|
1283
|
+
* `upTime` - Value of the `sysUptime.0` OID (`1.3.6.1.2.1.1.3.0`) in the
|
1284
1284
|
trap, defaults to the value returned by the `process.uptime ()` function
|
1285
1285
|
multiplied by 100
|
1286
1286
|
|
@@ -1452,6 +1452,7 @@ class:
|
|
1452
1452
|
var options = {
|
1453
1453
|
port: 162,
|
1454
1454
|
disableAuthorization: false,
|
1455
|
+
includeAuthentication: false,
|
1455
1456
|
accessControlModelType: snmp.AccessControlModelType.None,
|
1456
1457
|
engineID: "8000B98380XXXXXXXXXXXXXXXXXXXXXXXX", // where the X's are random hex digits
|
1457
1458
|
address: null,
|
@@ -1483,6 +1484,8 @@ an object, possibly empty, and can contain the following fields:
|
|
1483
1484
|
* `transport` - the transport family to use - defaults to `udp4`
|
1484
1485
|
* `address` - the IP address to bind to - default to `null`, which means bind to all IP
|
1485
1486
|
addresses
|
1487
|
+
* `includeAuthentication` - adds the community (v1/2c) or user name (v3) information
|
1488
|
+
to the notification callback - defaults to `false`
|
1486
1489
|
|
1487
1490
|
The `callback` parameter is a callback function of the form
|
1488
1491
|
`function (error, notification)`. On an error condition, the `notification`
|
@@ -3170,6 +3173,18 @@ Example programs are included under the module's `example` directory.
|
|
3170
3173
|
|
3171
3174
|
* Add calculated key cache to remove authNoPriv and authPriv performance bottleneck
|
3172
3175
|
|
3176
|
+
## Version 3.6.1 - 21/03/2022
|
3177
|
+
|
3178
|
+
* Add v3 context to non-initial PDUs
|
3179
|
+
|
3180
|
+
## Version 3.6.2 - 07/04/2022
|
3181
|
+
|
3182
|
+
* Add option for receiver to receive client authentication identity
|
3183
|
+
|
3184
|
+
## Version 3.6.3 - 26/04/2022
|
3185
|
+
|
3186
|
+
* Fix logic for v3 time syncronization requirement
|
3187
|
+
|
3173
3188
|
# License
|
3174
3189
|
|
3175
3190
|
Copyright (c) 2020 Mark Abrahams <mark@abrahams.co.nz>
|
package/example/snmp-receiver.js
CHANGED
package/index.js
CHANGED
@@ -2211,7 +2211,7 @@ Session.prototype.onMsg = function (buffer) {
|
|
2211
2211
|
return;
|
2212
2212
|
}
|
2213
2213
|
req.originalPdu.contextName = this.context;
|
2214
|
-
var timeSyncNeeded = ! message.msgSecurityParameters.msgAuthoritativeEngineBoots
|
2214
|
+
var timeSyncNeeded = ! message.msgSecurityParameters.msgAuthoritativeEngineBoots && ! message.msgSecurityParameters.msgAuthoritativeEngineTime;
|
2215
2215
|
this.sendV3Req (req.originalPdu, req.feedCb, req.responseCb, req.options, req.port, timeSyncNeeded);
|
2216
2216
|
}
|
2217
2217
|
} else if ( this.proxy ) {
|
@@ -2338,6 +2338,7 @@ Session.prototype.set = function (varbinds, responseCb) {
|
|
2338
2338
|
Session.prototype.simpleGet = function (pduClass, feedCb, varbinds,
|
2339
2339
|
responseCb, options) {
|
2340
2340
|
var id = _generateId (this.idBitsSize);
|
2341
|
+
options = Object.assign({}, options, { context: this.context });
|
2341
2342
|
var pdu = SimplePdu.createFromVariables (pduClass, id, varbinds, options);
|
2342
2343
|
var message;
|
2343
2344
|
var req;
|
@@ -3125,6 +3126,7 @@ var Receiver = function (options, callback) {
|
|
3125
3126
|
this.port = options.port || 162;
|
3126
3127
|
options.port = this.port;
|
3127
3128
|
this.disableAuthorization = options.disableAuthorization || false;
|
3129
|
+
this.includeAuthentication = options.includeAuthentication || false;
|
3128
3130
|
this.context = (options && options.context) ? options.context : "";
|
3129
3131
|
this.listener = new Listener (options, this);
|
3130
3132
|
};
|
@@ -3161,29 +3163,38 @@ Receiver.prototype.onMsg = function (buffer, rinfo) {
|
|
3161
3163
|
// Inform/trap processing
|
3162
3164
|
// debug (JSON.stringify (message.pdu, null, 2));
|
3163
3165
|
if ( message.pdu.type == PduType.Trap || message.pdu.type == PduType.TrapV2 ) {
|
3164
|
-
this.callback (null, this.formatCallbackData (message
|
3166
|
+
this.callback (null, this.formatCallbackData (message, rinfo) );
|
3165
3167
|
} else if ( message.pdu.type == PduType.InformRequest ) {
|
3166
3168
|
message.pdu.type = PduType.GetResponse;
|
3167
3169
|
message.buffer = null;
|
3168
3170
|
message.setReportable (false);
|
3169
3171
|
this.listener.send (message, rinfo);
|
3170
3172
|
message.pdu.type = PduType.InformRequest;
|
3171
|
-
this.callback (null, this.formatCallbackData (message
|
3173
|
+
this.callback (null, this.formatCallbackData (message, rinfo) );
|
3172
3174
|
} else {
|
3173
3175
|
this.callback (new RequestInvalidError ("Unexpected PDU type " + message.pdu.type + " (" + PduType[message.pdu.type] + ")"));
|
3174
3176
|
}
|
3175
3177
|
};
|
3176
3178
|
|
3177
|
-
Receiver.prototype.formatCallbackData = function (
|
3178
|
-
if ( pdu.contextEngineID ) {
|
3179
|
-
pdu.contextEngineID = pdu.contextEngineID.toString('hex');
|
3179
|
+
Receiver.prototype.formatCallbackData = function (message, rinfo) {
|
3180
|
+
if ( message.pdu.contextEngineID ) {
|
3181
|
+
message.pdu.contextEngineID = message.pdu.contextEngineID.toString('hex');
|
3180
3182
|
}
|
3181
|
-
delete pdu.nonRepeaters;
|
3182
|
-
delete pdu.maxRepetitions;
|
3183
|
-
|
3184
|
-
pdu: pdu,
|
3185
|
-
rinfo: rinfo
|
3183
|
+
delete message.pdu.nonRepeaters;
|
3184
|
+
delete message.pdu.maxRepetitions;
|
3185
|
+
const formattedData = {
|
3186
|
+
pdu: message.pdu,
|
3187
|
+
rinfo: rinfo
|
3186
3188
|
};
|
3189
|
+
if (this.includeAuthentication) {
|
3190
|
+
if (message.community) {
|
3191
|
+
formattedData.pdu.community = message.community;
|
3192
|
+
} else if (message.user) {
|
3193
|
+
formattedData.pdu.user = message.user.name;
|
3194
|
+
}
|
3195
|
+
}
|
3196
|
+
|
3197
|
+
return formattedData;
|
3187
3198
|
};
|
3188
3199
|
|
3189
3200
|
Receiver.prototype.close = function() {
|
package/package.json
CHANGED
package/test/receiver-test.sh
CHANGED
@@ -61,8 +61,8 @@ node ${HOME_DIR}/example/snmp-trap.js -v 3 -l authNoPriv -u ${USER_AUTH} -a ${AU
|
|
61
61
|
node ${HOME_DIR}/example/snmp-trap.js -v 3 -l authPriv -u ${USER_PRIV} -a ${AUTH_PROTOCOL} -A ${AUTH_KEY} -x ${PRIV_PROTOCOL} -X ${PRIV_KEY} ${PARAMS} ${HOST} ${TRAP_OID}
|
62
62
|
node ${HOME_DIR}/example/snmp-inform.js -v 2c -c ${COMMUNITY} ${PARAMS} ${HOST} ${TRAP_OID}
|
63
63
|
node ${HOME_DIR}/example/snmp-inform.js -v 3 -l noAuthNoPriv -u ${USER_NONE} ${PARAMS} ${HOST} ${TRAP_OID}
|
64
|
-
node ${HOME_DIR}/example/snmp-inform.js -v 3 -u ${USER_AUTH} -a ${AUTH_PROTOCOL} -A ${AUTH_KEY} ${PARAMS} ${HOST} ${TRAP_OID}
|
65
|
-
node ${HOME_DIR}/example/snmp-inform.js -v 3 -u ${USER_PRIV} -a ${AUTH_PROTOCOL} -A ${AUTH_KEY} -x ${PRIV_PROTOCOL} -X ${PRIV_KEY} ${PARAMS} ${HOST} ${TRAP_OID}
|
64
|
+
node ${HOME_DIR}/example/snmp-inform.js -v 3 -l authNoPriv -u ${USER_AUTH} -a ${AUTH_PROTOCOL} -A ${AUTH_KEY} ${PARAMS} ${HOST} ${TRAP_OID}
|
65
|
+
node ${HOME_DIR}/example/snmp-inform.js -v 3 -l authPriv -u ${USER_PRIV} -a ${AUTH_PROTOCOL} -A ${AUTH_KEY} -x ${PRIV_PROTOCOL} -X ${PRIV_KEY} ${PARAMS} ${HOST} ${TRAP_OID}
|
66
66
|
ENDOFCMDS
|
67
67
|
|
68
68
|
COUNT=1
|
@@ -81,4 +81,3 @@ while read CMD ; do
|
|
81
81
|
done <${CMDS}
|
82
82
|
|
83
83
|
rm -f ${CMDS}
|
84
|
-
|