Puppet Class: postfix::config

Defined in:
manifests/config.pp

Overview

Class: postfix::config

Configures postfix. Not intended to be called directly

Authors

Copyright 2013 EvenUp.

Parameters:

  • mydomain (Any) (defaults to: $::postfix::mydomain)
  • smtp_relay (Any) (defaults to: $::postfix::smtp_relay)
  • tls (Any) (defaults to: $::postfix::tls)
  • tls_bundle (Any) (defaults to: $::postfix::tls_bundle)
  • tls_package (Any) (defaults to: $::postfix::tls_package)
  • relay_networks (Any) (defaults to: $::postfix::relay_networks)
  • relay_domains (Any) (defaults to: $::postfix::relay_domains)
  • relay_host (Any) (defaults to: $::postfix::relay_host)
  • relay_port (Any) (defaults to: $::postfix::relay_port)
  • relay_username (Any) (defaults to: $::postfix::relay_username)
  • relay_password (Any) (defaults to: $::postfix::relay_password)
  • master_config_services (Any) (defaults to: $::postfix::master_config_services)
  • main_options_hash (Any) (defaults to: $::postfix::main_options_hash)
  • smtpd_client_restrictions (Any) (defaults to: $::postfix::smtpd_client_restrictions)
  • smtpd_helo_restrictions (Any) (defaults to: $::postfix::smtpd_helo_restrictions)
  • smtpd_sender_restrictions (Any) (defaults to: $::postfix::smtpd_sender_restrictions)
  • smtpd_recipient_restrictions (Any) (defaults to: $::postfix::smtpd_recipient_restrictions)
  • smtpd_data_restrictions (Any) (defaults to: $::postfix::smtpd_data_restrictions)


15
16
17
18
19
20
21
22
23
24
25
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
# File 'manifests/config.pp', line 15

class postfix::config (
  $mydomain                     = $::postfix::mydomain,
  $smtp_relay                   = $::postfix::smtp_relay,
  $tls                          = $::postfix::tls,
  $tls_bundle                   = $::postfix::tls_bundle,
  $tls_package                  = $::postfix::tls_package,
  $relay_networks               = $::postfix::relay_networks,
  $relay_domains                = $::postfix::relay_domains,
  $relay_host                   = $::postfix::relay_host,
  $relay_port                   = $::postfix::relay_port,
  $relay_username               = $::postfix::relay_username,
  $relay_password               = $::postfix::relay_password,
  $master_config_services       = $::postfix::master_config_services,
  $main_options_hash            = $::postfix::main_options_hash,
  $smtpd_client_restrictions    = $::postfix::smtpd_client_restrictions,
  $smtpd_helo_restrictions      = $::postfix::smtpd_helo_restrictions,
  $smtpd_sender_restrictions    = $::postfix::smtpd_sender_restrictions,
  $smtpd_recipient_restrictions = $::postfix::smtpd_recipient_restrictions,
  $smtpd_data_restrictions      = $::postfix::smtpd_data_restrictions,
) {

  file { '/etc/postfix/master.cf':
    owner   => root,
    group   => root,
    mode    => '0444',
    content => template('postfix/master.cf.erb'),
    notify  => Class['postfix::service'],
  }

  file { '/etc/postfix/main.cf':
    owner   => root,
    group   => root,
    mode    => '0444',
    content => template('postfix/main.cf.erb'),
    notify  => Class['postfix::service'],
  }

  if ( $relay_username and $relay_password ) {
    file { '/etc/postfix/relay_password':
      owner   => root,
      group   => root,
      mode    => '0440',
      content => template('postfix/relay_password.erb'),
      notify  => Exec['postmap-relay_password'],
    }

    exec { 'postmap-relay_password':
      path        => '/usr/bin:/usr/sbin:/bin:/sbin',
      command     => 'postmap hash:/etc/postfix/relay_password',
      refreshonly => true,
      logoutput   => 'on_failure',
      require     => File['/etc/postfix/relay_password'],
      notify      => Class['postfix::service'],
    }
  }
}