1 | How to setup SNMPv3, a very brief document |
---|
2 | |
---|
3 | Note: SHA authentication and DES/AES encryption support is only available |
---|
4 | if you have OpenSSL installed. |
---|
5 | |
---|
6 | apt-get installment |
---|
7 | |
---|
8 | Note: encryption support now *is* enabled in the binary releases downloadable |
---|
9 | from the net-snmp web site. |
---|
10 | |
---|
11 | Note: this description assumes you're using the software compiled from |
---|
12 | source, and so installed using the default prefix location (/usr/local). |
---|
13 | If you're working with a vendor-provided system, or have configured |
---|
14 | things with a different prefix, you'll need to adjust locations accordingly. |
---|
15 | |
---|
16 | CREATING THE FIRST USER: |
---|
17 | ------------------------ |
---|
18 | First, you need to create a new snmpv3 user and give them rights to |
---|
19 | do things. You need to stop snmpd temporarily to do this: |
---|
20 | |
---|
21 | # /etc/init.d/snmpd stop |
---|
22 | # net-snmp-config --create-snmpv3-user -a "my_password" myuser |
---|
23 | |
---|
24 | WARNING: SNMPv3 pass phrases must be at least 8 characters long! |
---|
25 | |
---|
26 | The above line creates the user "myuser" with a password of |
---|
27 | "my_password" (and uses MD5 and DES for protection). (Note that |
---|
28 | encryption support isn't enabled in the binary releases downloadable |
---|
29 | from the net-snmp web site.) net-snmp-config will also add a line |
---|
30 | to your snmpd.conf file to let that user have read/write access to |
---|
31 | your agent. You may want to change this in your snmpd.conf file |
---|
32 | (see the snmpd.conf manual page). Run net-snmp-config --help for |
---|
33 | more information about it. |
---|
34 | |
---|
35 | Start the agent and test your setup: |
---|
36 | /etc/init.d/snmpd start |
---|
37 | |
---|
38 | snmpget -v 3 -u myuser -l authNoPriv -a MD5 -A my_password localhost sysUpTime.0 |
---|
39 | [ this should return information about how long your agent has been up] |
---|
40 | |
---|
41 | snmpget -v 3 -u myuser -l authPriv -a MD5 -A my_password -x DES -X my_password localhost sysUpTime.0 |
---|
42 | [ this should return similar information, but encrypts the transmission ] |
---|
43 | |
---|
44 | CREATING A SECOND USER: |
---|
45 | ----------------------- |
---|
46 | Start the agent (if you didn't do so above). |
---|
47 | |
---|
48 | You can create as many users as you like using the above method, but |
---|
49 | this details another way of doing it while the agent is running by |
---|
50 | modifying the user database using the snmp protocol itself: |
---|
51 | |
---|
52 | Now, lets create a second user using the first user (just for fun) |
---|
53 | for both authentication purposes and as a template (or "cloning |
---|
54 | source"): |
---|
55 | |
---|
56 | snmpusm -v 3 -u myuser -l authNoPriv -a MD5 -A my_password localhost create nsrc myuser |
---|
57 | |
---|
58 | The above should have created the user "nsrc" with the same password as |
---|
59 | the "myuser" user. |
---|
60 | |
---|
61 | See, wasn't that easy? You can now create users. Wheeee.... |
---|
62 | |
---|
63 | But, you'll have to add a configuration line that allows them access |
---|
64 | to do things. Do this with another "rwuser" line in your |
---|
65 | /etc/snmp/snmpd.conf file (you'll need to stop and start |
---|
66 | the agent again, or send the agent a SIGHUP signal): |
---|
67 | |
---|
68 | rwuser nsrc |
---|
69 | |
---|
70 | So then, you need to change his password using: |
---|
71 | |
---|
72 | snmpusm -v 3 -u nsrc -l authNoPriv -a MD5 -A my_password localhost passwd my_password new_passphrase |
---|
73 | |
---|
74 | |
---|
75 | Now, test your new user: |
---|
76 | |
---|
77 | snmpget -v 3 -u nsrc -l authNoPriv -a MD5 -A new_passphrase localhost sysUpTime.0 |
---|
78 | |
---|
79 | |
---|
80 | FURTHER STUDIES: |
---|
81 | --------------- |
---|
82 | |
---|
83 | Tired of all those command line authentication options? |
---|
84 | ---------------------------------------- |
---|
85 | put something like this in your $HOME/.snmp/snmp.conf file (make it |
---|
86 | readable only by you!!!): |
---|
87 | |
---|
88 | defSecurityName nsrc |
---|
89 | defContext "" |
---|
90 | defAuthType MD5 |
---|
91 | defSecurityLevel authNoPriv |
---|
92 | defAuthPassphrase new_passphrase |
---|
93 | defVersion 3 |
---|
94 | |
---|
95 | And this is in place the last of the above example lines boils down to: |
---|
96 | |
---|
97 | snmpget localhost sysUpTime.0 |
---|
98 | |
---|
99 | Which is about as simple as I can make it for you |
---|
100 | |
---|