Skip to main content

A script to generate SNMPv3 keys as detailed by rfc3414 (passphrases expanded with a kdf, then hashed with the engine id). All key generation is done using the new cryptographically secure secrets library.

As I wrote this with ESXi in mind, it also emits a string suitable for configuring the SNMP daemon via esxcli/PowerCLI, but the hashes are standard and compatible with other SNMPv3 implementations.

With no arguments, it will generate an authentication and privacy passphrase with associated random engine ID in text form. –json will format the output as json.

The script is fully idempotent; if you take the parameters it generates randomly and re-enter them, you will get the same output a second time.

Dependencies

Runtime: Python 3.6 or greater.

Sample Output

Standard

User: observium
Auth: gaYA82XVtNaf3WLwRgoIs544ghP6f80S / f78359764ca382922fa382cf884e588031de575a
Priv: H5XEtRpxXVaGzXU5i2rFwPnYGr8SEzTp / 31a001a56a225fdfc1916bd60190405a1aa22ff0
Engine: 7ae1b0ff0aa2f3950566d3de2274d05a
ESXi USM String: observium/f78359764ca382922fa382cf884e588031de575a/31a001a56a225fdfc1916bd60190405a1aa22ff0/authpriv

JSON

{
  "user": "observium",
  "engine": "b2a50167b7c8512ddfc9d5765a3490af",
  "phrases": {
    "auth": "71rOhjfj6QVSy2mw5tBo7PueZ8KWSv60",
    "priv": "xwsvzht8NEcuwAlEpUKzMxKFWeH72sK9"
  },
  "hashes": {
    "auth": "fa0d5249293404502f9953b9514d0636a96c2cbc",
    "priv": "cccbdcfa603817df340514ecc22dfae8c4c412e8"
  },
  "esxi": "observium/fa0d5249293404502f9953b9514d0636a96c2cbc/cccbdcfa603817df340514ecc22dfae8c4c412e8/authpriv"}

It should go without saying, but DO NOT use the engine id or passphrases in the samples.

Usage

usage: snmpv3-hashgen [-h] [--auth AUTH] [--priv PRIV] [--engine ENGINE]
                      [--user USER] [--mode {authpriv,auth,priv,none}]
                      [--hash {md5,sha1}] [--json]

Convert an SNMPv3 auth or priv passphrase to sha1 or md5 hashes

optional arguments:
  -h, --help            show this help message and exit
  --auth AUTH           Authentication passphrase to be derived as a string
  --priv PRIV           Privacy passphrase to be derived as a string
  --engine ENGINE       Engine ID as hex string
  --user USER           SNMPv3 USM username (default "observium")
  --mode {authpriv,auth,priv,none}
                        SNMPv3 mode (default "authpriv")
  --hash {md5,sha1}     Hash algorithm to use (default "sha1")
  --json                Emit output as json

Metadata

Release files for SNMPv3-Hash-Generator 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SNMPv3-Hash-Generator 0.2
File Size Uploaded Provenance Actions
SNMPv3 Hash Generator-0.2.tar.gz 4.2 kB Without provenance Details for SNMPv3 Hash Generator-0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for SNMPv3-Hash-Generator 0.2
File Interpreter ABI Platform Actions
SNMPv3_Hash_Generator-0.2-py3-none-any.whl Python 3 none any Details for SNMPv3_Hash_Generator-0.2-py3-none-any.whl

Total release size: 11.6 kB

Release files / SNMPv3 Hash Generator-0.2.tar.gz

Download URL SNMPv3 Hash Generator-0.2.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
11ea3433993923ace28e0cff42cd7f242ac357892aac914345590343aea599b0
BLAKE2b-256 checksum
How to use checksums
74599f60d2fb7027efc70306649acd8524b19b30125f90f2180e027936878a8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / SNMPv3_Hash_Generator-0.2-py3-none-any.whl

Download URL SNMPv3_Hash_Generator-0.2-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
738edc90bac237d1030f456656044f58082bf618a57376c8329f5652a7e6f06e
BLAKE2b-256 checksum
How to use checksums
eac1a8e935bb777f0bc40095ec40e537aaa17bfa34ec1ff444ecb69ec8ed5f2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for SNMPv3-Hash-Generator 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files No provenance

0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page