Re: SNMPD antwortet nicht
Andreas Tille schrieb:
On Tue, 12 Jun 2007, Aleks wrote:
Relativ weit oben vom man steht auch:
PLEASE READ FIRST
Sagen wir mal so: Ich habe auch diese ganzen docs gefunden und nach so
einer
Aufforderung konnte natürlich auch ich nicht widerstehen, snmpconf
aufzurufen.
Ich hab's sogar mehrfach probiert, aber für jemanden, der nur eine vage
Vorstellung hat, was SNMP überhaupt macht sind die Begriffe die dort
abgefragt werden einfach teilweise sehr undurchsichtig.
okay, kann ich verstehen.
Daher noch einmal die Frage: Mit welchem einfachen Tool
kann ich von einem anderen Rechner aus schnell und sicher herausfinden,
ob mein Rechner auf SNMP-Anfragen reagiert.
Da gibt es snmpwalk und und snmpget um Werte abzufragen.
Mit snmpset kann man die dann setzten, sofern man die richtige community
hat.. Alle diese Tools findest Du im Paket 'snmp'.
Ich will nicht immer
nach jeder Konfigurationsänderung meinen Kollegen fragen müssen, ob er
was sieht - sonst sagt der irgendwann: "Nimm SuSE und es geht sofort."
Das kann ich noch viel besser verstehen ;-)
Also, ich habe mir hier mal eine miniconfig erstellt, welche den Zugriff
(auch von extern) erlaubt.
-----
deb:/# cat /etc/snmp/snmpd.conf
###########################################################################
#
# snmpd.conf
#
# - created by the snmpconf configuration program
#
###########################################################################
# SECTION: System Information Setup
#
# This section defines some of the information reported in
# the "system" mib group in the mibII tree.
# syslocation: The [typically physical] location of the system.
# Note that setting this value here means that when trying to
# perform an snmp SET operation to the sysLocation.0 variable will make
# the agent return the "notWritable" error code. IE, including
# this token in the snmpd.conf file will disable write access to
# the variable.
# arguments: location_string
syslocation wohnzimmer
# syscontact: The contact information for the administrator
# Note that setting this value here means that when trying to
# perform an snmp SET operation to the sysContact.0 variable will make
# the agent return the "notWritable" error code. IE, including
# this token in the snmpd.conf file will disable write access to
# the variable.
# arguments: contact_string
syscontact elvis
###########################################################################
# SECTION: Access Control Setup
#
# This section defines who is allowed to talk to your running
# snmp agent.
# rocommunity: a SNMPv1/SNMPv2c read-only access community name
# arguments: community [default|hostname|network/bits] [oid]
rocommunity rotest
# rwcommunity: a SNMPv1/SNMPv2c read-write access community name
# arguments: community [default|hostname|network/bits] [oid]
rwcommunity rwtest
agentaddress 1.1.1.22:161
----
Dannach einmal /etc/init.d/snmpd stop und /etc/init.d/snmpd start
eingeben und es läuft:
deb:~$ snmpget -v 1 -c rotest 1.1.1.22 system.sysLocation.0
SNMPv2-MIB::sysLocation.0 = STRING: wohnzimmer
deb:~$ snmpget -v 1 -c rotest 1.1.1.22 system.sysDescr.0
SNMPv2-MIB::sysDescr.0 = STRING: Linux sektor 2.6.18-4-k7 #1 SMP Wed May
9 23:42:01 UTC 2007 i686
deb:~$ snmpget -v 1 -c rotest 1.1.1.22 system.sysContact.0
SNMPv2-MIB::sysContact.0 = STRING: elvis
deb:~$ snmpget -v 1 -c rwtest 1.1.1.22 system.sysContact.0
SNMPv2-MIB::sysContact.0 = STRING: elvis
deb:~$ snmpget -v 1 -c rwtest localhost system.sysContact.0
SNMPv2-MIB::sysContact.0 = STRING: elvis
deb:~$ snmpwalk -v 1 -c rwtest localhost system.sysContact
SNMPv2-MIB::sysContact.0 = STRING: elvis
Ich möchte aber ausdrücklich sagen, dass diese Konfiguration totaler
Mist ist! Du solltest überhaupt keine read-write community vergeben,
wenn es dafür keinen guten Grund gibt. Außerdem solltest Du den Zugriff
(Netzwerke) unbedingt einschränken. Zusätzlich solltest Du fragen welche
OID's Dein Kollege denn überhaupt abfragen will und die
Abfragemöglichkeiten auch auf diese Begrenzen. Das Problem ist, dass
snmp in Version 1 und 2c ein klartextprotokoll ist. Das heißt, wenn Du
keine Begrenzungen setzt kann jeder per tcpdump die Community
"erschnüffeln" und damit Daten von Deiner Maschine abfragen, die eine
Kompromittierung erleichtern können. Wenn ihr wirklich rw Zugriff haben
müsst und keine Eingrenzungen machen wollt, lohnt es sich, sich in
snmpV3 einzulesen..
Bitte lese die Kommentare im oberen Konfigfile und die entsprechenden
Passagen der man um weitere Infos zu bekommen.
Gruß,
Aleks
Reply to: