Skip to content

Disable httpd Service

An XCCDF Rule

Description

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

Rationale

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

ID
xccdf_org.ssgproject.content_rule_service_httpd_disabled
Severity
Unknown
References
Updated

Remediation Templates

A Puppet Snippet

include disable_httpd
class disable_httpd {
  service {'httpd':
    enable => false,
    ensure => 'stopped',
  }
}

An Ansible Snippet

- name: Gather the package facts
  package_facts:
    manager: auto
  tags:
  - CCE-82761-8
  - NIST-800-53-CM-6(a)

script:kickstart

service disable httpd

OS Build Blueprint

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

A Kubernetes Patch

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

A Shell Script

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