Defined Type: postfix::lookup::ldap

Defined in:
vendor_modules/postfix/manifests/lookup/ldap.pp

Overview

Define an LDAP lookup table.

Examples:

Configure Postfix for virtual mailbox hosting using LDAP to provide the various lookup tables

class { 'postfix':
  virtual_mailbox_base    => '/var/mail/vhosts',
  virtual_mailbox_domains => ['ldap:/etc/postfix/virtualdomains.cf'],
  virtual_mailbox_maps    => ['ldap:/etc/postfix/virtualrecipients.cf'],
  virtual_minimum_uid     => 100,
  virtual_uid_maps        => 'static:5000',
  virtual_gid_maps        => 'static:5000',
}

# Specify connection defaults to enable sharing as per LDAP_README
Postfix::Lookup::Ldap {
  server_host => ['ldap://192.0.2.1'],
  search_base => 'dc=example,dc=com',
  bind_dn     => 'cn=Manager,dc=example,dc=com',
  bind_pw     => 'secret',
  version     => 3,
}

postfix::lookup::ldap { '/etc/postfix/virtualdomains.cf':
  query_filter     => '(associatedDomain=%s)',
  result_attribute => ['associatedDomain'],
}

postfix::lookup::ldap { '/etc/postfix/virtualrecipients.cf':
  query_filter     => '(mail=%s)',
  result_attribute => ['mail'],
}

Parameters:

  • search_base (Bodgitlib::LDAP::DN)
  • path (Stdlib::Absolutepath) (defaults to: $title)
  • ensure (Enum['present', 'absent']) (defaults to: 'present')
  • server_host (Optional[Array[Postfix::Type::Lookup::LDAP::Host, 1]]) (defaults to: undef)
  • server_port (Optional[Bodgitlib::Port]) (defaults to: undef)
  • timeout (Optional[Integer[0]]) (defaults to: undef)
  • query_filter (Optional[Bodgitlib::LDAP::Filter]) (defaults to: undef)
  • result_format (Optional[String]) (defaults to: undef)
  • domain (Optional[Array[String, 1]]) (defaults to: undef)
  • result_attribute (Optional[Array[String, 1]]) (defaults to: undef)
  • special_result_attribute (Optional[Array[String, 1]]) (defaults to: undef)
  • terminal_result_attribute (Optional[Array[String, 1]]) (defaults to: undef)
  • leaf_result_attribute (Optional[Array[String, 1]]) (defaults to: undef)
  • scope (Optional[Bodgitlib::LDAP::Scope]) (defaults to: undef)
  • bind (Optional[Variant[Boolean, Enum['sasl', 'none', 'simple']]]) (defaults to: undef)
  • bind_dn (Optional[Bodgitlib::LDAP::DN]) (defaults to: undef)
  • bind_pw (Optional[String]) (defaults to: undef)
  • recursion_limit (Optional[Integer[1]]) (defaults to: undef)
  • expansion_limit (Optional[Integer[0]]) (defaults to: undef)
  • size_limit (Optional[Integer[0]]) (defaults to: undef)
  • dereference (Optional[Integer[0, 3]]) (defaults to: undef)
  • chase_referrals (Optional[Boolean]) (defaults to: undef)
  • version (Optional[Integer[2, 3]]) (defaults to: undef)
  • debuglevel (Optional[Integer[0]]) (defaults to: undef)
  • sasl_mechs (Optional[Array[String, 1]]) (defaults to: undef)
  • sasl_realm (Optional[String]) (defaults to: undef)
  • sasl_authz_id (Optional[String]) (defaults to: undef)
  • sasl_minssf (Optional[Integer[0]]) (defaults to: undef)
  • start_tls (Optional[Boolean]) (defaults to: undef)
  • tls_ca_cert_dir (Optional[Stdlib::Absolutepath]) (defaults to: undef)
  • tls_ca_cert_file (Optional[Stdlib::Absolutepath]) (defaults to: undef)
  • tls_cert (Optional[Stdlib::Absolutepath]) (defaults to: undef)
  • tls_key (Optional[Stdlib::Absolutepath]) (defaults to: undef)
  • tls_require_cert (Optional[Boolean]) (defaults to: undef)
  • tls_random_file (Optional[Stdlib::Absolutepath]) (defaults to: undef)
  • tls_cipher_suite (Optional[String]) (defaults to: undef)

See Also:

Since:

  • 1.0.0



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'vendor_modules/postfix/manifests/lookup/ldap.pp', line 72

define postfix::lookup::ldap (
  Bodgitlib::LDAP::DN                                        $search_base,
  Stdlib::Absolutepath                                       $path                      = $title,
  Enum['present', 'absent']                                  $ensure                    = 'present',
  Optional[Array[Postfix::Type::Lookup::LDAP::Host, 1]]      $server_host               = undef,
  Optional[Bodgitlib::Port]                                  $server_port               = undef,
  Optional[Integer[0]]                                       $timeout                   = undef,
  Optional[Bodgitlib::LDAP::Filter]                          $query_filter              = undef,
  Optional[String]                                           $result_format             = undef,
  Optional[Array[String, 1]]                                 $domain                    = undef,
  Optional[Array[String, 1]]                                 $result_attribute          = undef,
  Optional[Array[String, 1]]                                 $special_result_attribute  = undef,
  Optional[Array[String, 1]]                                 $terminal_result_attribute = undef,
  Optional[Array[String, 1]]                                 $leaf_result_attribute     = undef,
  Optional[Bodgitlib::LDAP::Scope]                           $scope                     = undef,
  Optional[Variant[Boolean, Enum['sasl', 'none', 'simple']]] $bind                      = undef,
  Optional[Bodgitlib::LDAP::DN]                              $bind_dn                   = undef,
  Optional[String]                                           $bind_pw                   = undef,
  Optional[Integer[1]]                                       $recursion_limit           = undef,
  Optional[Integer[0]]                                       $expansion_limit           = undef,
  Optional[Integer[0]]                                       $size_limit                = undef,
  Optional[Integer[0, 3]]                                    $dereference               = undef,
  Optional[Boolean]                                          $chase_referrals           = undef,
  Optional[Integer[2, 3]]                                    $version                   = undef,
  Optional[Integer[0]]                                       $debuglevel                = undef,
  Optional[Array[String, 1]]                                 $sasl_mechs                = undef,
  Optional[String]                                           $sasl_realm                = undef,
  Optional[String]                                           $sasl_authz_id             = undef,
  Optional[Integer[0]]                                       $sasl_minssf               = undef,
  Optional[Boolean]                                          $start_tls                 = undef,
  Optional[Stdlib::Absolutepath]                             $tls_ca_cert_dir           = undef,
  Optional[Stdlib::Absolutepath]                             $tls_ca_cert_file          = undef,
  Optional[Stdlib::Absolutepath]                             $tls_cert                  = undef,
  Optional[Stdlib::Absolutepath]                             $tls_key                   = undef,
  Optional[Boolean]                                          $tls_require_cert          = undef,
  Optional[Stdlib::Absolutepath]                             $tls_random_file           = undef,
  Optional[String]                                           $tls_cipher_suite          = undef,
) {

  include postfix

  $_server_host = postfix::flatten_hosts($server_host)

  $_ensure = $ensure ? {
    'absent' => 'absent',
    default  => 'file',
  }

  file { $path:
    ensure  => $_ensure,
    owner   => 0,
    group   => 0,
    mode    => '0600',
    content => template("${module_name}/ldap.cf.erb"),
  }

  if $ensure != 'absent' and has_key($postfix::lookup_packages, 'ldap') {
    $ldap_package = $postfix::lookup_packages['ldap']
    ensure_packages([$ldap_package])
    Package[$ldap_package] -> File[$path]
  }
}