net-snmp Access Control

This should work on any linux distribution using the net-snmp packages.

Install net-snmp and the net-snmp-utils packages.

Edit "/etc/snmp/snmpd.conf" and find the following lines:

# First, map the community name "public" into a "security name"

# sec.name source community

and add a line for each host you will be polling from. i.e.
com2sec notConfigUser 127.0.0.1 <a really, really secure community>
com2sec notConfigUser <some other host> <a really, really secure community>

If you only changed the "source" and "community" columns the following lines should not need to be modified.
# Second, map the security name into a group name:

# groupName securityModel securityName
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser

Add a view named "all" in the following section.
####
# Third, create a view for us to let the group have rights to:

# Make at least snmpwalk -v 1 localhost -c public system fast again.
# name incl/excl subtree mask(optional)
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
view all included .1

The following section should not need modifying.
####
# Finally, grant the group read-only access to the systemview view.

# group context sec.model sec.level prefix read write notif
access notConfigGroup "" any noauth exact all none none
Test by running the following command from one of the allowed hosts in the first section and ensuring that you see much more output that the system mib.
snmpwalk -v 2c -c system

Comments

Popular posts from this blog

YumRepo Error: All mirror URLs are not using ftp, http[s] or file

Linux: Permanent CIFS/SMB mount

Plesk - Decrypt FTP Passwords