[AGENT++] Regarding how to set read/write community and username/passwd

Frank Fock fock at agentpp.com
Tue May 8 09:36:58 CEST 2012


Hi Danyi,

Regarding your questions (1) ad (2) below:
(1) Please read RFC 2576 section 5.
(2) When using SNMP++ as client, you can use the add_usm_user
methods. Within an agent (thus with AGENT++), you should
modify the USM MIB content by using
     UsmUserTable *uut = new UsmUserTable();

     uut->addNewRow("unsecureUser",
                SNMP_AUTHPROTOCOL_NONE,
                SNMP_PRIVPROTOCOL_NONE, "", "");

     uut->addNewRow("MD5",
                SNMP_AUTHPROTOCOL_HMACMD5,
                SNMP_PRIVPROTOCOL_NONE,
                "MD5UserAuthPassword", "");
...
     // add the USM MIB - usm_mib MibGroup is used to
     // make user added entries persistent
     mib.add(new usm_mib(uut));

Note: You can modify "uut" after you have registered it
with "mib.add(new usm_mib(uut));". That is no problem.

Best regards,
Frank


Am 03.05.2012 13:02, schrieb Jostmeyer, Danyi:
> Hello,
>
> I am using Agent++ v3.5 for our SNMP agent and I am new to Agent++. Our agent supports the mixed SNMP versions (v1, v2c and v3).
>
> Please see my questions below.
>
> (1)    In my code, "_SNMPv3" is enabled and snmp_community_mib is added.
>
>
> First, I was using RequestList::set_read/write_community functions. But it doesn't work since _SNMPv3 is enabled.
>
>
>
> Then, I am planning to use the following sample code to change the default community strings.
>
> ......
> vacm->addNewGroup(SNMP_SECURITY_MODEL_V2, "public", "v1v2group", storageType_nonVolatile);
> vacm->addNewGroup(SNMP_SECURITY_MODEL_V1, "public", "v1v2group", storageType_nonVolatile);
> ......
> // add SNMPv1/v2c community to v3 security name mapping
> OctetStr co("public");
> MibTableRow* row = snmpCommunityEntry::instance->add_row(Oidx::from_string(co, FALSE));
> OctetStr tag("v1v2cPermittedManagers");
> snmpCommunityEntry::instance->set_row(row, co, co, reqList->get_v3mp()->get_local_engine_id(), "", tag, 3, 1);
>
>
> Can you please give me a guide on how I can distinguish which one is for the "read-community" and which one is for the "write-community"? From the above sample, there is only one community string for corresponding SNMP version. Our default read and write community strings are not the same.
>
>
> (2)    How can I set default username and password? I found that probably I can use USM::add_usm_user(). If then, how can I set auth_protocol and priv_protocol? Do you have an example for it?
>
> Thanks in advance for your help.
>
> Best Regards,
> Danyi
>
>
> _______________________________________________
> AGENTPP mailing list
> AGENTPP at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/agentpp

-- 
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax:   +49 7024 8688231



More information about the AGENTPP mailing list