Skip to content

Disable Dovecot Service

An XCCDF Rule

Description

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

Rationale

Running an IMAP or POP3 server provides a network-based avenue of attack, and should be disabled if not needed.

ID
xccdf_org.ssgproject.content_rule_service_dovecot_disabled
Severity
Unknown
References
Updated

Remediation Templates

OS Build Blueprint

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

A Puppet Snippet

include disable_dovecot
class disable_dovecot {
  service {'dovecot':
    enable => false,
    ensure => 'stopped',
  }
}

An Ansible Snippet

- name: Gather the package facts
  package_facts:
    manager: auto
  tags:
  - CCE-91368-1
  - disable_strategy

A Shell Script

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