python - ciphering services not available error on pysnmp v3 get using pysnmp7 - pycryptodome and cryptography not installed - S

admin2025-04-17  3

I am unable to get snmp usng pysnmp7 - cryptography and pycryptodome installed.

Getting Error Indication: Ciphering services

Referring Ciphering services not available error on pysnmp v3 walk did not help.

$# pip show pysnmp
Name: pysnmp
Version: 7.1.16


$:/etc/zabbix# pip show cryptography
Name: cryptography
Version: 42.0.5

$# pip show pycryptodome
Name: pycryptodome
Version: 3.21.0
import asyncio
from pysnmp.hlapi.v3arch.asyncio import *


async def main():
    iterator = get_cmd(
        SnmpEngine(),
        UsmUserData(
            'admin',
            authKey='privateprivate',
            privKey='privateprivate',
            authProtocol=usmHMACMD5AuthProtocol,
            privProtocol=usmDESPrivProtocol
        ),
        await UdpTransportTarget.create(("10.20.7.108", 161)),
        ContextData(),
        ObjectType(ObjectIdentity('1.3.6.1.4.1.248.11.22.1.8.10.2.0')),
    )
    errorIndication, errorStatus, errorIndex, varBinds = await iterator
    print(f"Error Indication: {errorIndication}, Error Status: {errorStatus}, Error Index: {errorIndex}")
    print(f"VarBinds: {varBinds}")
    
if __name__ == '__main__':
    try:
        asyncio.run(main())
    except RuntimeError:
        pass # to avoid RuntimeError: Event loop is closed
    print('out')

Output is

Error Indication: Ciphering services not available, Error Status: 0, Error Index: 0
VarBinds: ()
out

I am unable to get snmp usng pysnmp7 - cryptography and pycryptodome installed.

Getting Error Indication: Ciphering services

Referring Ciphering services not available error on pysnmp v3 walk did not help.

$# pip show pysnmp
Name: pysnmp
Version: 7.1.16


$:/etc/zabbix# pip show cryptography
Name: cryptography
Version: 42.0.5

$# pip show pycryptodome
Name: pycryptodome
Version: 3.21.0
import asyncio
from pysnmp.hlapi.v3arch.asyncio import *


async def main():
    iterator = get_cmd(
        SnmpEngine(),
        UsmUserData(
            'admin',
            authKey='privateprivate',
            privKey='privateprivate',
            authProtocol=usmHMACMD5AuthProtocol,
            privProtocol=usmDESPrivProtocol
        ),
        await UdpTransportTarget.create(("10.20.7.108", 161)),
        ContextData(),
        ObjectType(ObjectIdentity('1.3.6.1.4.1.248.11.22.1.8.10.2.0')),
    )
    errorIndication, errorStatus, errorIndex, varBinds = await iterator
    print(f"Error Indication: {errorIndication}, Error Status: {errorStatus}, Error Index: {errorIndex}")
    print(f"VarBinds: {varBinds}")
    
if __name__ == '__main__':
    try:
        asyncio.run(main())
    except RuntimeError:
        pass # to avoid RuntimeError: Event loop is closed
    print('out')

Output is

Error Indication: Ciphering services not available, Error Status: 0, Error Index: 0
VarBinds: ()
out
Share edited Feb 4 at 20:08 Lex Li 63.5k11 gold badges124 silver badges161 bronze badges asked Jan 31 at 4:59 UlyssesUlysses 6,04510 gold badges55 silver badges93 bronze badges 2
  • How did you execute the Python script? Keep in mind you might have tons of Python environments on the same machine, so the actual command you execute the script might be using an environment different from the one pip used. – Lex Li Commented Jan 31 at 17:09
  • I used pycharm and setup a virtuall environment for the same and executed within the virtual environment - I also setup a venv on linux and then attempted the same – Ulysses Commented Feb 4 at 7:44
Add a comment  | 

1 Answer 1

Reset to default 1

You are using an old version of cryptography. If you upgrade to 43.0.x releases, things should work well,

https://github.com/lextudio/pysnmp/blob/v7.1.16/pyproject.toml#L53

BTW, pycryptodome dependency has been completely removed (since 7.1.4) if you check the release notes,

https://github.com/lextudio/pysnmp/blob/v7.1.16/CHANGES.rst

转载请注明原文地址:http://anycun.com/QandA/1744880123a88928.html