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 - OS Build Blueprint


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

Remediation - Ansible

- name: Block Disable service httpd
  block:

  - name: Disable service httpd
    block:


Remediation - Puppet

include disable_httpd

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

Remediation - Shell Script

# Remediation is applicable only in certain platforms
if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then

SYSTEMCTL_EXEC='/usr/bin/systemctl'
"$SYSTEMCTL_EXEC" stop 'httpd.service'
"$SYSTEMCTL_EXEC" disable 'httpd.service'