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
Updated



Remediation - Puppet

include disable_dovecot

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

Remediation - OS Build Blueprint


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

Remediation - script:kickstart


service disable dovecot

Remediation - Kubernetes Patch

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

Remediation - Ansible

- name: Disable Dovecot 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

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 'dovecot.service'
"$SYSTEMCTL_EXEC" disable 'dovecot.service'