Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion manifests/ldap.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,40 @@
# auth-ldap.conf.ext
class dovecot::ldap (
$ldap_hosts = 'ldap.example.org:389',
$ldap_uris = false,
$ldap_dn = 'cn=vmail,cn=users,dc=example,dc=org',
$ldap_dnpass = 'NotPassword#1234!',
$ldap_auth_bind_userdn = 'cn=%n,cn=users,dc=example,dc=org',
$ldap_base = 'cn=users,dc=example,dc=org',
$ldap_auth_bind = 'no',
$ldap_scope = 'subtree',
$ldap_debug_level = '-1',
$ldap_userdb_static = 'uid=vmail gid=vmail home=/srv/vmail/%n mail=maildir:~/mail',
$ldap_user_filter = '(&(objectClass=user)(cn=%n))',
$ldap_user_attrs = '=home=/srv/vmail/%d/%n, =uid=vmail, =gid=vmail, =mail=maildir:~/mail',
$ldap_pass_filter = '(&(objectClass=user)(cn=%n))',
$ldap_pass_attrs = 'cn=user', #cn is ldap attribute name, user is dovecot field
$ldap_iterate_attrs = 'cn=user',
$ldap_iterate_filter = '(objectClass=user)'
$ldap_iterate_filter = '(objectClass=user)',
$ldap_tls = 'no',
$ldap_tls_ca_cert_file = false,
$ldap_tls_ca_cert_dir = false,
$ldap_tls_cipher_suite = false,
$ldap_tls_cert_file = false,
$ldap_tls_key_file = false,
$ldap_tls_require_cert = 'demand',
) {

if $ldap_uris and $ldap_hosts {
fail('uris and hosts are mutually exclusives')
}

package {'dovecot-ldap':
ensure => installed,
before => Exec['dovecot'],
notify => Service['dovecot']
}

# TODO the next two files use same template, probably should be creating symlink....
file { '/etc/dovecot/dovecot-ldap.conf.ext':
ensure => present,
Expand Down
14 changes: 9 additions & 5 deletions templates/auth-ldap.conf.ext
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ passdb {
# lookup by using userdb static instead of userdb ldap, for example:
# <doc/wiki/UserDatabase.Static.txt>
#these values for home and mail override mail_home and mail_location
<%- if @ldap_userdb_static -%>
userdb {
driver = static
#args = uid=vmail gid=vmail home=/srv/vmail/%d/%n mail=maildir:~/mail
# not using domain in mail home b/c domain is stripped by "auth_username_format = %Ln" and
# we don't know how to look up username in ldap
args = uid=vmail gid=vmail home=/srv/vmail/%n mail=maildir:~/mail
args = <%= @ldap_userdb_static %>
}
<%- else -%>
#userdb {
# driver = static
# args =
#}
<%- end -%>
#userdb {
# driver = prefetch
#}
Expand All @@ -40,4 +44,4 @@ userdb {
userdb {
driver = ldap
args = /etc/dovecot/dovecot-ldap-userdb.conf.ext
}
}
Loading