Re: Can I override the defVersion in host specific conf files?

Ari Rabinowitz <[email protected]> Tue, 22 Apr 2025 08:28:17 -0400
Newsgroups gmane.network.net-snmp.user
Message-ID <CAECnTpMNXwZ-1n7DM=1sbzfFVtFoz9gtwWe6CpuSLS8UXGVALw@mail.gmail.com>
--===============5207612155555845774==
Content-Type: multipart/alternative; boundary="0000000000002df59e06335d1f51"

--0000000000002df59e06335d1f51
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi Lee,

Thanks for the confirmation of what I've been seeing. I've even tried
adding "disableSNMPv3 yes" to the host.conf files for the hosts which don't
do SNMPv3, but it still doesn't work.
This is a sample of the host.conf files I've been trying:
defVersion 2c
defCommunity REDACTED
disableSNMPv3 yes
disableSNMPv2c no

I have the feeling that once the configuration code sees any SNMPv3
parameters it can't reset them all and stop looking for SNMPv3, but I
haven't looked at the source code to see. I'm afraid that this will end up
being a large change for the developers, if anyone has the time to look
into it and try to fix it.

Thanks,
Ari

On Mon, Apr 21, 2025 at 5:57=E2=80=AFPM Lee <[email protected]> wrote:

> On Mon, Apr 21, 2025 at 4: 09 PM Ari Rabinowitz wrote: > > Hi, > > I'm
> trying to set up SNMP monitoring of many of our devices. Since most of th=
em
> support SNMPv3 I've set up the following in my /etc/snmp/snmp. conf: >
> defVersion
> ZjQcmQRYFpfptBannerStart
> This Message Is From an External Sender
> This message came from outside your organization.
>
> ZjQcmQRYFpfptBannerEnd
>
> On Mon, Apr 21, 2025 at 4:09=E2=80=AFPM Ari Rabinowitz wrote:
> >
> > Hi,
> >
> > I'm trying to set up SNMP monitoring of many of our devices. Since most=
 of them support SNMPv3 I've set up the following in my /etc/snmp/snmp.conf=
:
> > defVersion 3
> > defSecurityLevel authPriv
> > defAuthType SHA
> > defPrivType AES
> > defAuthPassphrase REDACTED
> > defPrivPassphrase  REDACTED
> > defSecurityName USER
> >
> > I'm able to override the Version 3 parameters such as defSecurityLevel,=
 defAuthType and the passphrases for the devices which support SNMPv3 in ho=
st specific configuration files in /etc/snmp/hosts/, but I can't find any w=
ay to specify in a host-specific configuration that the host uses version 2=
c or version 1. Is there any way to do that, if the general default is vers=
ion 3?
>
> There's supposed to be a way - man snmp.conf says
>        For example, if you wanted a particular host to use SNMPv2c  by  d=
efault
>        you could create a =CB=9C/.snmp/hosts/NAME.conf file and in it put=
:
>
>               defVersion 2c
>
> but it doesn't work for me
>
> $ cat ~/.snmp/librarysw.conf
> defVersion 2c
>
> $ head -1 ~/.snmp/snmp.conf
> defVersion 3
>
> $ snmpwalk  librarysw system
> snmpwalk: Unknown user name (Sub-id not found: (top) -> system)
>
> $ snmpwalk -v 2c librarysw system
> RFC1213-MIB::sysDescr.0 =3D STRING: "JetStream 24-Port Gigabit L2+
> Managed Switch with 4 SFP Slots"
> RFC1213-MIB::sysObjectID.0 =3D OID: TPLINK-MIB::tplinkProducts.122
> RFC1213-MIB::sysUpTime.0 =3D Timeticks: (1501667371) 173 days, 19:17:53.7=
1
> RFC1213-MIB::sysContact.0 =3D STRING: "https://urldefense.proofpoint.com/=
v2/url?u=3Dhttp-3A__www.tp-2Dlink.com&d=3DDwIFaQ&c=3D009klHSCxuh5AI1vNQzSO0=
KGjl4nbi2Q0M1QLJX9BeE&r=3D7VDP4N-fj98QvYr9AY4iLJh3GBO-d7Oa-o-8TLGIA7c&m=3DM=
YTKeSiGnacxnJ8w3AdGzcCgA2JLnsgcQuQPMWbIKhdCvra1_bSjV7RkureXLW2s&s=3DvK-iWeK=
K8GncVMQdwBeD57n_nPEBXBcsmJztBro84so&e=3D"
> RFC1213-MIB::sysName.0 =3D STRING: "librarysw"
> RFC1213-MIB::sysLocation.0 =3D STRING: "Hong Kong"
> RFC1213-MIB::sysServices.0 =3D INTEGER: 3
>
> hrmmm..  the man page says =CB=9C/.snmp/hosts/NAME.conf so let's move the
> librarysw.conf file to .snmp/hosts/ and try again
>
> $ cat ~/.snmp/hosts/librarysw.conf
> defVersion 2c
>
> $ snmpwalk librarysw system
> snmpwalk: Unknown user name (Sub-id not found: (top) -> system)
>
> still no :(
>
> Regards
> Lee
>
>

--0000000000002df59e06335d1f51
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Lee,<div><br></div><div>Thanks for the confirmation of =
what I&#39;ve been seeing. I&#39;ve even tried adding &quot;disableSNMPv3 y=
es&quot; to the host.conf files for the hosts which don&#39;t do SNMPv3, bu=
t it still doesn&#39;t work.</div><div>This is a sample of the host.conf fi=
les I&#39;ve been trying:<br>defVersion 2c<br>defCommunity REDACTED<br>disa=
bleSNMPv3 yes<br>disableSNMPv2c no</div><div><br></div><div>I have the feel=
ing that once the configuration code sees any SNMPv3 parameters it can&#39;=
t reset them all and stop looking for SNMPv3, but I haven&#39;t looked at t=
he source code to see. I&#39;m afraid that this will end up being a large c=
hange for the developers, if anyone has the time to look into it and try to=
 fix it.</div><div><br></div><div>Thanks,</div><div>Ari</div></div><br><div=
 class=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" class=3D"gmai=
l_attr">On Mon, Apr 21, 2025 at 5:57=E2=80=AFPM Lee &lt;<a href=3D"mailto:l=
[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex"><div class=3D"msg5302831843334388927"><u><=
/u>


<div style=3D"font-size:1px;color:rgb(255,255,255);line-height:1px;height:0=
px;max-height:0px;opacity:0;overflow:hidden;display:none">
On Mon, Apr 21, 2025 at 4:=E2=80=8A09 PM Ari Rabinowitz wrote: &gt; &gt; Hi=
, &gt; &gt; I&#39;m trying to set up SNMP monitoring of many of our devices=
. Since most of them support SNMPv3 I&#39;ve set up the following in my /et=
c/snmp/snmp.=E2=80=8Aconf: &gt; defVersion</div>



<div style=3D"font-size:1px;color:rgb(255,255,255);line-height:1px;max-heig=
ht:0px;opacity:0;overflow:hidden;display:none">ZjQcmQRYFpfptBannerStart</di=
v>



<u></u>
  <div dir=3D"ltr" lang=3D"en" id=3D"m_5302831843334388927pfptBanner85hau56=
" style=3D"display:block;text-align:left;margin:16px 0px;padding:8px 16px;b=
order-radius:4px;min-width:200px;background-color:rgb(208,216,220);border-t=
op:4px solid rgb(144,164,174)">
    <div id=3D"m_5302831843334388927pfptBanner85hau56" style=3D"float:left;=
display:block;margin:0px 0px 1px;max-width:600px">
      <div id=3D"m_5302831843334388927pfptBanner85hau56" style=3D"display:b=
lock;background-color:rgb(208,216,220);color:rgb(0,0,0);font-family:Arial,s=
ans-serif;font-weight:bold;font-size:14px;line-height:18px">
	This Message Is From an External Sender
      </div>
      <div id=3D"m_5302831843334388927pfptBanner85hau56" style=3D"font-weig=
ht:normal;display:block;background-color:rgb(208,216,220);color:rgb(0,0,0);=
font-family:Arial,sans-serif;font-size:12px;line-height:18px;margin-top:2px=
">
This message came from outside your organization.
      </div>

    </div>

    <div style=3D"height:0px;clear:both;display:block;line-height:0;font-si=
ze:0.01px">=C2=A0</div>
  </div>
<u></u>

<div style=3D"font-size:1px;color:rgb(255,255,255);line-height:1px;max-heig=
ht:0px;opacity:0;overflow:hidden;display:none">ZjQcmQRYFpfptBannerEnd</div>








<div><pre style=3D"font-family:sans-serif;font-size:100%;white-space:pre-wr=
ap">On Mon, Apr 21, 2025 at 4:09=E2=80=AFPM Ari Rabinowitz wrote:
&gt;
&gt; Hi,
&gt;
&gt; I&#39;m trying to set up SNMP monitoring of many of our devices. Since=
 most of them support SNMPv3 I&#39;ve set up the following in my /etc/snmp/=
snmp.conf:
&gt; defVersion 3
&gt; defSecurityLevel authPriv
&gt; defAuthType SHA
&gt; defPrivType AES
&gt; defAuthPassphrase REDACTED
&gt; defPrivPassphrase  REDACTED
&gt; defSecurityName USER
&gt;
&gt; I&#39;m able to override the Version 3 parameters such as defSecurityL=
evel, defAuthType and the passphrases for the devices which support SNMPv3 =
in host specific configuration files in /etc/snmp/hosts/, but I can&#39;t f=
ind any way to specify in a host-specific configuration that the host uses =
version 2c or version 1. Is there any way to do that, if the general defaul=
t is version 3?

There&#39;s supposed to be a way - man snmp.conf says
       For example, if you wanted a particular host to use SNMPv2c  by  def=
ault
       you could create a =CB=9C/.snmp/hosts/NAME.conf file and in it put:

              defVersion 2c

but it doesn&#39;t work for me

$ cat ~/.snmp/librarysw.conf
defVersion 2c

$ head -1 ~/.snmp/snmp.conf
defVersion 3

$ snmpwalk  librarysw system
snmpwalk: Unknown user name (Sub-id not found: (top) -&gt; system)

$ snmpwalk -v 2c librarysw system
RFC1213-MIB::sysDescr.0 =3D STRING: &quot;JetStream 24-Port Gigabit L2+
Managed Switch with 4 SFP Slots&quot;
RFC1213-MIB::sysObjectID.0 =3D OID: TPLINK-MIB::tplinkProducts.122
RFC1213-MIB::sysUpTime.0 =3D Timeticks: (1501667371) 173 days, 19:17:53.71
RFC1213-MIB::sysContact.0 =3D STRING: &quot;<a href=3D"https://urldefense.p=
roofpoint.com/v2/url?u=3Dhttp-3A__www.tp-2Dlink.com&amp;d=3DDwIFaQ&amp;c=3D=
009klHSCxuh5AI1vNQzSO0KGjl4nbi2Q0M1QLJX9BeE&amp;r=3D7VDP4N-fj98QvYr9AY4iLJh=
3GBO-d7Oa-o-8TLGIA7c&amp;m=3DMYTKeSiGnacxnJ8w3AdGzcCgA2JLnsgcQuQPMWbIKhdCvr=
a1_bSjV7RkureXLW2s&amp;s=3DvK-iWeKK8GncVMQdwBeD57n_nPEBXBcsmJztBro84so&amp;=
e=3D" target=3D"_blank">https://urldefense.proofpoint.com/v2/url?u=3Dhttp-3=
A__www.tp-2Dlink.com&amp;d=3DDwIFaQ&amp;c=3D009klHSCxuh5AI1vNQzSO0KGjl4nbi2=
Q0M1QLJX9BeE&amp;r=3D7VDP4N-fj98QvYr9AY4iLJh3GBO-d7Oa-o-8TLGIA7c&amp;m=3DMY=
TKeSiGnacxnJ8w3AdGzcCgA2JLnsgcQuQPMWbIKhdCvra1_bSjV7RkureXLW2s&amp;s=3DvK-i=
WeKK8GncVMQdwBeD57n_nPEBXBcsmJztBro84so&amp;e=3D</a>&quot;
RFC1213-MIB::sysName.0 =3D STRING: &quot;librarysw&quot;
RFC1213-MIB::sysLocation.0 =3D STRING: &quot;Hong Kong&quot;
RFC1213-MIB::sysServices.0 =3D INTEGER: 3

hrmmm..  the man page says =CB=9C/.snmp/hosts/NAME.conf so let&#39;s move t=
he
librarysw.conf file to .snmp/hosts/ and try again

$ cat ~/.snmp/hosts/librarysw.conf
defVersion 2c

$ snmpwalk librarysw system
snmpwalk: Unknown user name (Sub-id not found: (top) -&gt; system)

still no :(

Regards
Lee
</pre></div>
</div></blockquote></div>

--0000000000002df59e06335d1f51--


--===============5207612155555845774==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============5207612155555845774==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

--===============5207612155555845774==--