Advertisement
Guest User

Untitled

a guest
Dec 10th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Puppet 2.06 KB | None | 0 0
  1. class profile::postfix {
  2.   if $::fqdn == lookup('postfix::master'){
  3.     $relayhost   = lookup('postfix::external_relay')
  4.     $mynetworks  = lookup('postfix::allowed_networks')
  5.     $smtp_listen = '0.0.0.0'
  6.   } else {
  7.     $relayhost = lookup('postfix::master')
  8.   }
  9.   $mta                 = true
  10.   $root_mail_recipient = lookup('postfix::admin')
  11.   $virtual_maps        = lookup('postfix::virtual_maps')
  12.   $gmail_account       = lookup('postfix::gmail_account')
  13.   $gmail_password      = lookup('postfix::gmail_password')
  14.   $sasl_packages       = [ 'cyrus-sasl', 'cyrus-sasl-lib', 'cyrus-sasl-plain' ]
  15.   if $::fqdn == lookup('postfix::master') {
  16.     package { $sasl_packages: ensure =>  'installed' }
  17.     postfix::config {
  18.       'smtp_sasl_auth_enable':        ensure => present, value => 'yes';
  19.       'smtp_sasl_password_maps':      ensure => present, value => 'hash:/etc/postfix/sasl_password';
  20.       'smtp_sasl_security_options':   ensure => present, value => 'noanonymous';
  21.       'smtp_tls_security_level':      ensure => present, value => 'secure';
  22.       'smtp_tls_mandatory_protocols': ensure => present, value => 'TLSv1';
  23.       'smtp_tls_mandatory_ciphers':   ensure => present, value => 'high';
  24.       'smtp_tls_secure_cert_match':   ensure => present, value => 'nexthop';
  25.       'smtp_tls_CAfile':              ensure => present, value => '/etc/pki/tls/certs/ca-bundle.crt';
  26.       'header_checks':                ensure => present, value => 'regexp:/etc/postfix/header_checks';
  27.     }
  28.     postfix::hash { '/etc/postfix/sasl_password':
  29.       ensure  => 'present',
  30.       content => "$relayhost    ${gmail_account}:${gmail_password}"
  31.     }
  32.     postfix::hash { '/etc/postfix/header_checks':
  33.       ensure  => 'present',
  34.       source  => 'puppet:///modules/postfix/header_checks',
  35.     }
  36.   }
  37.   class { 'postfix':
  38.      relayhost           => $relayhost,
  39.      smtp_listen         => $smtp_listen,
  40.      mta                 => $mta,
  41.      mynetworks          => $mynetworks,
  42.      virtual_maps        => $virtual_maps,
  43.      root_mail_recipient => $root_mail_recipient,
  44.   }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement