Configuring encryption of SNMP connections

December 13, 2023

ID 184759

Third-party programs can access data sent over SNMP or replace those data with their own data. To ensure secure communication over SNMP, we recommend to configure encryption of SNMP connections.

Prior to configuration, make sure that the snmpd and snmptrapd services are installed on all servers that have Kaspersky Web Traffic Security installed.

To configure encryption of SNMP connections:

  1. Add the following line to the /etc/snmp/snmpd.conf file:

    view systemview included .1

  2. Receive an EngineID, which is necessary to process SNMP traps. To do so, on the Master server, run the command:

    snmpget -v2c -cpublic localhost SNMP-FRAMEWORK-MIB::snmpEngineID.0 2>/dev/null | sed -ne 's/ //g; s/.*:/0x/p'

  3. Configure the snmpd service on each server that is part of the cluster. To do so:
    1. Stop the snmpd service. To do so, execute the command:

      service snmpd stop

    2. Create a new user. To do so, execute the command:

      net-snmp-create-v3-user -ro -a SHA -A <password> -x <password> -X AES kwts-snmp-user

    3. Create the /etc/snmp/snmpd.conf configuration file with the following content:

      # accept KWTS statistics over unix socket

      agentXSocket unix:/var/run/agentx-master.socket

      agentXPerms 770 770 kluser klusers

      master agentx

      # accept incoming SNMP requests over UDP and TCP

      agentAddress udp:localhost:161,tcp:localhost:161

      rouser kwts-snmp-user priv .1.3.6.1

      # comment the following line if you don't need SNMP traps forwarding over SNMPv3 connection

      trapsess -e <EngineID> -v3 -l authPriv -u kwts-snmp-user -a SHA -A <password> -x AES -X <password> udp:localhost:162

    4. Add the following strings to the configuration file /etc/snmp/snmp.conf:

      mibdirs +/opt/kaspersky/kwts/share/snmp-mibs/

      mibs all

    5. Start the snmpd service. To do so, execute the command:

      service snmpd start

    6. Check the SNMP connection. To do so, run the following commands:

      snmpwalk -mALL -v3 -l authPriv -u kwts-snmp-user -a SHA -A <password> -x AES -X <password> udp:localhost:161 .1.3.6.1.4.1.23668

      snmpget -v3 -l authPriv -u kwts-snmp-user -a SHA -A <password> -x AES -X <password> udp:localhost:161 .1.3.6.1.4.1.23668.2022.2.8.1.0

  4. Configure the snmptrapd service on the server where you want to receive SNMP traps. To do so:
    1. Stop the snmptrapd service. To do so, execute the command:

      service snmptrapd stop

    2. Depending on your operating system, open the following configuration file for editing:
      • Ubuntu or Debian.

        /var/lib/snmpd/snmptrapd.conf

      • CentOS, SUSE Linux Enterprise Server, ALT Server, or Red Hat Enterprise Linux.

        /var/lib/net-snmp/snmptrapd.conf

      If a configuration file does not exist in the specified directory, create it.

    3. Add the following line to the configuration file:

      createUser -e <EngineID> kwts-snmp-user SHA "<password>" AES "<password>"

    4. Create the /etc/snmp/snmptrapd.conf configuration file with the following content:

      snmpTrapdAddr udp:<IP-address>:162,tcp:127.0.0.1:162

      authUser log kwts-snmp-user priv

      disableAuthorization no

      As the <IP-address>, specify the IP address that is used by the snmptrapd service to receive network connections.

    5. Start the snmptrapd service. To do so, execute the command:

      service snmptrapd start

    6. Check the SNMP connection with the following command:

      snmptrap -e <EngineID> -v3 -l authPriv -u kwts-snmp-user -a SHA -A <password> -x AES -X <password> udp:localhost:162 0 .1.3.6.1.4.1.23668.2022.1.411

Encryption of SNMP connections is configured.

Did you find this article helpful?
What can we do better?
Thank you for your feedback! You're helping us improve.
Thank you for your feedback! You're helping us improve.