From d9c7dfb1e7a8ad4a44b571e3d4b8d87ff3898678 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 11 Jul 2020 17:55:21 +0200 Subject: snmp: T2687: precalculate snmpv3 encrypted keys As of now when adding new credentials for any SNMPv3 user we submit the credential either plaintext or encrypted. A plaintext credential will be hashed by SNMPd in the background and then passed back into the CLI so it's not stored in cleartext. This feels like the wrong way in changing the CLI content with data produced by a 3rd party daemon which implements the service. It feels like the tail wiggles the entire dog. This should be changed in the following way: - After retrieving the plaintext password from CLI, use Python to hash the key in advance - Re-populate the encrypted key into the CLI and drop the plaintext one - Generate service configuration and continue startup of SNMPd This also fixes a race condition when SNMPd started up but not properly provided the hasehd keys in the configuration resulting in a ConfigurationError. Now as we also support binding SNMPd to a VRF this fixes a deadlock situation on bootup as we can only bind late to the VRF and require up to 5 restarts of the service - but the service will never start. --- interface-definitions/snmp.xml.in | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'interface-definitions') diff --git a/interface-definitions/snmp.xml.in b/interface-definitions/snmp.xml.in index 4894d0ce8..2fe8ce583 100644 --- a/interface-definitions/snmp.xml.in +++ b/interface-definitions/snmp.xml.in @@ -197,9 +197,9 @@ - Specifies the EngineID that uniquely identify an agent (e.g. 0xff42) + Specifies the EngineID that uniquely identify an agent (e.g. 000000000000000000000002) - (0x){0,1}([0-9a-f][0-9a-f]){1,18}$ + ^([0-9a-f][0-9a-f]){1,18}$ ID must contain an even number (from 2 to 36) of hex digits @@ -284,16 +284,16 @@ Defines the privacy - + Defines the encrypted key for authentication - 0x[0-9a-f]*$ + ^[0-9a-f]*$ Encrypted key must only contain hex digits - + Defines the clear text key for authentication @@ -341,16 +341,16 @@ Defines the privacy - + Defines the encrypted key for privacy protocol - 0x[0-9a-f]*$ + ^[0-9a-f]*$ Encrypted key must only contain hex digits - + Defines the clear text key for privacy protocol @@ -442,16 +442,16 @@ Specifies the auth - + Defines the encrypted key for authentication - 0x[0-9a-f]*$ + ^[0-9a-f]*$ Encrypted key must only contain hex digits - + Defines the clear text key for authentication @@ -514,16 +514,16 @@ Defines the privacy - + Defines the encrypted key for privacy protocol - 0x[0-9a-f]*$ + ^[0-9a-f]*$ Encrypted key must only contain hex digits - + Defines the clear text key for privacy protocol -- cgit v1.2.3