Skip to content

Disable DHCP Service

An XCCDF Rule

Description

The dhcpd service should be disabled on any system that does not need to act as a DHCP server. The dhcpd service can be disabled with the following command:
$ sudo systemctl mask --now dhcpd.service

Rationale

Unmanaged or unintentionally activated DHCP servers may provide faulty information to clients, interfering with the operation of a legitimate site DHCP server if there is one.

ID
xccdf_org.ssgproject.content_rule_service_dhcpd_disabled
Severity
Medium
References
Updated

Remediation Templates

OS Build Blueprint

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

An Ansible Snippet

- name: Disable DHCP Service - Collect systemd Services Present in the System
  ansible.builtin.command: systemctl -q list-unit-files --type service
  register: service_exists
  changed_when: false
  failed_when: service_exists.rc not in [0, 1]
  check_mode: false

A Puppet Snippet

include disable_dhcpd
class disable_dhcpd {
  service {'dhcpd':
    enable => false,
    ensure => 'stopped',
  }
}