Forge Home

postfix

Installs, configures and manages postfix configuration and tables

6,041 downloads

2,128 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.2.2 (latest)
  • 0.2.1
  • 0.2.0
  • 0.1.1
  • 0.1.0
released Jul 24th 2020
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2016.4.x
  • Puppet >= 4.10.0 < 7.0.0
  • , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'benningm-postfix', '0.2.2'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add benningm-postfix
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install benningm-postfix --version 0.2.2

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

benningm/postfix — version 0.2.2 Jul 24th 2020

Puppet Forge version Puppet Forge – PDK version Puppet Forge downloads

postfix

Table of Contents

  1. Description
  2. Setup - The basics of getting started with postfix
  3. Usage - Configuration options and additional functionality
  4. Reference - An under-the-hood peek at what the module is doing and how
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module

Description

This module will install, configure and manage the postfix MTA and its tables.

It also provides helpers and abstaction for common use cases:

  • postfix::content_filter - configure a smtp content filter
  • postfix::dovecot_lda - configure local delivery to dovecot mailboxes
  • postfix::nullmailer - configure a local MTA for delivery to smart hosts
  • postfix::sasl - configure SASL authentication
  • postfix::smtpd_proxy_filter - configure a before-queue smtp content filter
  • postfix::submission - configure a submission service
  • postfix::virtual_hosting - configure virtual domain/mailbox hosting
  • postfix::smtp_tls_parameters - configure TLS, DANE

Setup

What postfix affects

The module will configure and install postfix.

In the default configuration it will:

  • manage the postfix packages
  • manage the postfix services
  • postfix configuration files
  • main.cf
  • master.cf

Setup Requirements

Nothing special.

Beginning with postfix

The module class postfix is used in all use case configuration and can be used to start with an basic postfix configuration.

Usage

Install, configure and start postfix.

class { 'postfix': }

The core class contains parameters for basic main.cf settings:

class { 'postfix':
  smtpd_banner = 'mymta',
}

Additional parameters can be set using postfix::maincf::param:

class { 'postfix': }
postfix::maincf::param { 'message_size_limit':
  value => '10240',
  # optional comment...
  # comment => 'small is beautiful'
}

Or additional entries for the master.cf configuration:

class { 'postfix': }
postfix::maincf::param { 'custom_smtpd_syslog_name':
  value => 'custom_mta',
}
postfix::mastercf::process { '127.0.0.1:10025':
  type    => 'inet',
  private => false,
  unpriv  => true,
  chroot  => false,
  wakeup  => undef,
  maxproc => undef,
    comment => "custom smtpd service",
  command => "smtpd
    -o syslog_name=\$custom_smtpd_syslog_name",
}

The module provides generic classes for generating postmap tables:

$postmap = '/etc/postfix/mytable'
postfix::postmap { $postmap:
  # optional description
  description => 'my custom map'
}
postfix::postmap::row { 'example-mytable':
  postmap = $postmap,
  key => 'mykey',
  value => 'myvalue',
  # optional comment
  comment => 'just an example',
}
# or a complete fragment of entries
postfix::postmap::fragment { 'example-mytable':
  postmap => $postmap,
  content => template('mytemplate.postmap.erb'),
}

But it also provide specialized resources for common tables:

  • postfix::access
  • postfix::mynetworks
  • postfix::sender_login_map
  • postfix::virtual_alias_domains
  • postfix::virtual_aliases
  • postfix::virtual_mailbox_domains
  • postfix::virtual_mailboxes

Example for using postfix::mynetworks:

class { 'postfix::mynetworks': }
postfix::maincf::param { 'mynetworks':
  value => "127.0.0.0/8 [::1]/128 ${postfix::mynetworks::type}:${postfix::mynetworks::path}",
}
postfix::mynetworks::row { '192.168.3.32': }
postfix::mynetworks::row { '192.168.5.35': }

Use cases

The module provides classes for specific use cases which will provide the required parameters for main.cf and master.cf and also setup the required tables with common presets.

Read the individual documentation of these classes on how they work.

Both the core module and the use case configurations can be extended with additional resources.

This module provides predefined resources for additional settings, to create common or individual tables, etc.

Use case: Basic local MTA

class { 'postfix': }

class { 'postfix::access': }
postfix::access::row { 'root':
  value => 'bob@mydomain.tld',
}

postfix::maincf::param { 'relayhost':
  value => '[relayhost.mydomain.com]'
}

Use case example: nullmailer

An local MTA for relaying all mail to a smart host can be configured using the postfix::nullmailer class:

classe { 'postfix::nullmailer':
  relayhost => '[relay.example.com]'
}

Use case example: virtual_hosting

To setup a mailserver with virtual_hosting:

class { 'postfix::virtual_hosting': }
# create domain in virtual_mailbox_domains
postfix::virtual_hosting::domain { 'mydomain.tld': }
postfix::virtual_hosting::user { 'bob@mydomain.tld':
  comment => 'This is bob',
  aliases => [ 'webmaster@mydomain.tld' ],
  # By default:
  #
  # * incoming => true,
  #   create entry in virtual_mailboxes
  #   create aliases in virtual_aliases
  # * outgoing => true,
  #   create sender_login_map entries for $name and aliases
}

Reference

See REFERENCE.md

Limitations

The module is currently only tested on Debian systems.

No full coverage of documentation and automated tests yet.

Development

This module is developed as an open source project. Everyone is welcome to provide improvements.

The prefered way to contribute things is:

  • Create an Issue to describe your problem, feature, bug
  • Fork the repository to a private repository
  • Create a feature branch to contain your changes
  • If done create a Pull Request for integration of your changes