wesupport

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

Need help?

Our experts have had an average response time of 11.43 minutes in March 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

SNMP Trap Hardening in Nagios – Let us see how to do it

by | May 2, 2021

Wondering about SNMP Trap Hardening in Nagios? We can help you.

By default, the Nagios XI server will accept inbound SNMP v2 traps from any device. Nagios XI will not accept SNMP v3 traps unless the server specifically configures for SNMP v3 traps.

As part of our Server Management Services, we assist our customers with several Nagios queries.

Today, let us see how to harden the Nagios XI server to only accept SNMP traps from authorized sources.

 

SNMP Trap Hardening in Nagios

SNMP Trap Hardening in Nagios

Send Test Trap

In order to send a test trap, we run the below command:

snmptrap -v <snmp_version> -c <community> <destination_host> <uptime> <OID_or_MIB> <object> <value_type> <value>

When the Nagios XI server receives a test trap, it logs in the /var/log/snmptt/snmpttunknown.log file.

Default Configuration

The default SNMP Trap configuration is in the /etc/snmp/snmptrapd.conf file and contains just two lines:

disableAuthorization yes
traphandle default /usr/sbin/snmptthandler

The disableAuthorization directive allows SNMP traps from any device to be sent to Nagios XI.

Hence, the first step is to comment out the disableAuthorization directive by adding a # to the beginning of the line:

#disableAuthorization yes
traphandle default /usr/sbin/snmptthandler

There are different authorization methods that we can use. This will be defined in the config file.

  • Restrict To SNMP v2 Community

A simple hardening method is to accept traps from any devices that supply a specific community string.

For example, this shows how to allow traps for the Sup3rStr0ng community string:

#disableAuthorization yes
authCommunity execute Sup3rStr0ng
traphandle default /usr/sbin/snmptthandler

Once we make the change, we need to restart the snmptrapd service for the settings to become effective.

In addition, we can send a test trap to confirm the settings are correct.

  • Restrict To SNMP v2 Community AND Network Address

A more advanced hardening method is to accept traps from specific devices that supply a specific community string.

For example, let us see how to allow traps for the M3g@Str0ng community string which come from the 10.25.5.15 network address:

#disableAuthorization yes
authCommunity execute Sup3rStr0ng
authCommunity execute M3g@Str0ng 10.25.5.15
traphandle default /usr/sbin/snmptthandler

Once we make the changes, we restart the snmptrapd service for the settings to become effective. Eventually, we can send a test trap to confirm the settings are correct.

  • Restrict To SNMP v2 Community AND Network Subnet

Another hardening method is to accept traps from devices in a network subnet that supply a specific community string.

This example shows how to allow traps for the Ultr@Str0ng community string which come from the 10.25.0.0/16 network subnet:

#disableAuthorization yes
authCommunity execute Sup3rStr0ng
authCommunity execute M3g@Str0ng 10.25.5.15
authCommunity execute Ultr@Str0ng 10.25.0.0/16
traphandle default /usr/sbin/snmptthandler

Once done, we restart the snmptrapd service for the settings to become effective.

Restart SNMPTRAPD Service

Whenever we make a change to the /etc/snmp/snmptrapd.conf file, we have to restart the snmptrapd service with the following command:

RHEL 7+|CentOS 7+|Debian|Ubuntu 16/18/20

systemctl restart snmptrapd.service

[Need help to harden Nagios XI server? We’d be happy to assist]

 

Conclusion

In short, we saw how our Support Techs go about SNMP Trap Hardening in Nagios.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags