Skip to content

Disable snmpd Service

An XCCDF Rule

Description

The snmpd service can be disabled with the following command:
$ sudo systemctl mask --now snmpd.service

Rationale

Running SNMP software provides a network-based avenue of attack, and should be disabled if not needed.

ID
xccdf_org.ssgproject.content_rule_service_snmpd_disabled
Severity
Low
References
Updated

Remediation Templates

A Shell Script

# Remediation is applicable only in certain platforms
if ( rpm --quiet -q net-snmp && rpm --quiet -q kernel ); then
SYSTEMCTL_EXEC='/usr/bin/systemctl'
"$SYSTEMCTL_EXEC" stop 'snmpd.service'
"$SYSTEMCTL_EXEC" disable 'snmpd.service'
"$SYSTEMCTL_EXEC" mask 'snmpd.service'

A Puppet Snippet

include disable_snmpd
class disable_snmpd {
  service {'snmpd':
    enable => false,
    ensure => 'stopped',
  }
}

An Ansible Snippet

- name: Gather the package facts
  package_facts:
    manager: auto
  tags:
  - CCE-82758-4
  - disable_strategy

script:kickstart

service disable snmpd

OS Build Blueprint

[customizations.services]
masked = ["snmpd"]

A Kubernetes Patch

apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
spec:
  config:
    ignition:
      version: 3.1.0