Puppet Class: lsys::postfix::client

Inherits:
lsys::params
Defined in:
manifests/postfix/client.pp

Summary

Postfix mail client installation

Overview

Postfix mail client installation

Examples:

include lsys::postfix::client

Parameters:

  • relayhost (Optional[Variant[Stdlib::Fqdn, Stdlib::IP::Address]]) (defaults to: undef)

    The next-hop destination(s) for non-local mail; overrides non-local domains in recipient addresses www.postfix.org/postconf.5.html#relayhost

  • postdrop_nosgid (Boolean) (defaults to: false)

    Whether to set ip proper permissions for Postfix runtime directories in case if SGID removed from /usr/sbin/postdrop and /usr/sbin/postqueue (e.g. in scope of security hardening)

  • custom_master_config (Boolean) (defaults to: true)

    Whether to use master.cf configuration templates defined in this module. See templates/postfix folder and lsys::params::postfix_master_os_template

  • master_os_template (Optional[String]) (defaults to: $lsys::params::postfix_master_os_template)

    Custom template for master.cf

  • maillog_file (Optional[Stdlib::Unixpath]) (defaults to: undef)

    If defined full path to log file, then set it into main.cf as maillog_file parameter



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'manifests/postfix/client.pp', line 26

class lsys::postfix::client (
  Boolean $postdrop_nosgid = false,
  Boolean $custom_master_config = true,
  Optional[String] $master_os_template = $lsys::params::postfix_master_os_template,
  Optional[Variant[Stdlib::Fqdn, Stdlib::IP::Address]] $relayhost = undef,
  Optional[Stdlib::Unixpath] $maillog_file = undef,
) inherits lsys::params {
  if $relayhost {
    $enable_mta = true
  }
  else {
    $enable_mta = false
  }

  if $custom_master_config and $master_os_template {
    class { 'postfix::params':
      master_os_template => $master_os_template,
    }
  }

  class { 'postfix':
    manage_mailx   => false,
    manage_aliases => false,
    mta            => $enable_mta,
    relayhost      => $relayhost,
  }
  contain postfix

  if $maillog_file {
    postfix::config { 'maillog_file':
      ensure => 'present',
      value  => $maillog_file,
    }
  }

  group { 'postfix':
    ensure => present,
    gid    => $lsys::params::postfix_gid,
  }
  user { 'postfix':
    ensure     => present,
    uid        => $lsys::params::postfix_uid,
    gid        => 'postfix',
    home       => '/var/spool/postfix',
    managehome => false,
    shell      => $lsys::params::postfix_shell,
  }
  group { 'postdrop':
    ensure => present,
    gid    => $lsys::params::postdrop_gid,
  }

  if $postdrop_nosgid {
    file { '/var/spool/postfix/maildrop':
      ensure  => directory,
      group   => 'postdrop',
      owner   => 'postfix',
      mode    => '1733',
      require => Class['postfix'],
    }
    file { '/var/spool/postfix/public':
      ensure  => directory,
      group   => 'postdrop',
      owner   => 'postfix',
      mode    => '0711',
      require => Class['postfix'],
    }
  }
}