Skip to content

Enable Postfix Service

An XCCDF Rule

Description

The Postfix mail transfer agent is used for local mail delivery within the system. The default configuration only listens for connections to the default SMTP port (port 25) on the loopback interface (127.0.0.1). It is recommended to leave this service enabled for local mail delivery. The postfix service can be enabled with the following command:
$ sudo systemctl enable postfix.service

Rationale

Local mail delivery is essential to some system maintenance and notification tasks.

ID
xccdf_org.ssgproject.content_rule_service_postfix_enabled
Severity
Unknown
Updated

Remediation Templates

OS Build Blueprint

[customizations.services]
enabled = ["postfix"]

A Puppet Snippet

include enable_postfix
class enable_postfix {
  service {'postfix':
    enable => true,
    ensure => 'running',
  }
}

A Shell Script

# Remediation is applicable only in certain platforms
if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
SYSTEMCTL_EXEC='/usr/bin/systemctl'
"$SYSTEMCTL_EXEC" unmask 'postfix.service'
"$SYSTEMCTL_EXEC" start 'postfix.service'
"$SYSTEMCTL_EXEC" enable 'postfix.service'

An Ansible Snippet

- name: Enable service postfix
  block:
  - name: Gather the package facts
    package_facts:
      manager: auto