Currently I'm working on a project which requires me to implement SNMPv3 on a STM32 microcontroller running FreeRTOS. (specifically STM32H563VIT6). I'm using lwIP stack to implement this protocol, however I just cannot get the authentication to work.
I initialize the SNMPv3 agent using this function from the snmpv3_dummy.c example:
void
snmpv3_dummy_init(void)
{
snmpv3_set_engine_id("FOO", 3);
snmpv3_set_user_auth_algo("lwip", SNMP_V3_AUTH_ALGO_SHA);
snmpv3_set_user_auth_key("lwip", "maplesyrup");
snmpv3_set_user_priv_algo("lwip", SNMP_V3_PRIV_ALGO_DES);
snmpv3_set_user_priv_key("lwip", "maplesyrup");
/* Start the engine time timer */
snmpv3_enginetime_timer(NULL);
}
But when I try calling this using snmpwalk using this command:
snmpwalk -v3 -u lwip -l authNoPriv -a SHA -A "maplesyrup" 192.168.0.27
I get this error back:
USM authentication failure (incorrect password or key)
I also tried setting both the auth_algo and priv_algo enum to INVAL, so I could try SNMP without authentication. When I tried calling this using snmpwalk using this command:
snmpwalk -v3 -u lwip -l noAuthNoPriv 192.168.0.27
I got this response:
SNMPv2-MIB::sysDescr.0 = STRING: STM32H5 FreeRTOS SNMP Agent
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.26381
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1459) 0:00:14.59
SNMPv2-MIB::sysContact.0 = STRING: STM32H5 Agent
SNMPv2-MIB::sysName.0 = STRING: FQDN-unk
SNMPv2-MIB::sysLocation.0 = STRING: Lab Bench
SNMPv2-MIB::sysServices.0 = INTEGER: 72
So the communication with the MCU must work. There just must be some problem with authentication, that I sadly cannot grasp. If there is somebody who has experience with implementing SNMPv3 like this, I would be grateful for your help.