dovecot-ldap.conf.ext.erb 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. # This file is opened as root, so it should be owned by root and mode 0600.
  2. #
  3. # http://wiki2.dovecot.org/AuthDatabase/LDAP
  4. #
  5. # NOTE: If you're not using authentication binds, you'll need to give
  6. # dovecot-auth read access to userPassword field in the LDAP server.
  7. # With OpenLDAP this is done by modifying /etc/ldap/slapd.conf. There should
  8. # already be something like this:
  9. # access to attribute=userPassword
  10. # by dn="<dovecot's dn>" read # add this
  11. # by anonymous auth
  12. # by self write
  13. # by * none
  14. # Space separated list of LDAP hosts to use. host:port is allowed too.
  15. <%= Dovecot::Conf.attribute(@conf['ldap'], 'hosts') %>
  16. # LDAP URIs to use. You can use this instead of hosts list. Note that this
  17. # setting isn't supported by all LDAP libraries.
  18. <%= Dovecot::Conf.attribute(@conf['ldap'], 'uris') %>
  19. # Distinguished Name - the username used to login to the LDAP server.
  20. # Leave it commented out to bind anonymously (useful with auth_bind=yes).
  21. <%= Dovecot::Conf.attribute(@conf['ldap'], 'dn') %>
  22. # Password for LDAP server, if dn is specified.
  23. <%= Dovecot::Conf.attribute(@conf['ldap'], 'dnpass') %>
  24. # Use SASL binding instead of the simple binding. Note that this changes
  25. # ldap_version automatically to be 3 if it's lower. Also note that SASL binds
  26. # and auth_bind=yes don't work together.
  27. <%= Dovecot::Conf.attribute(@conf['ldap'], 'sasl_bind', false) %>
  28. # SASL mechanism name to use.
  29. <%= Dovecot::Conf.attribute(@conf['ldap'], 'sasl_mech') %>
  30. # SASL realm to use.
  31. <%= Dovecot::Conf.attribute(@conf['ldap'], 'sasl_realm') %>
  32. # SASL authorization ID, ie. the dnpass is for this "master user", but the
  33. # dn is still the logged in user. Normally you want to keep this empty.
  34. <%= Dovecot::Conf.attribute(@conf['ldap'], 'sasl_authz_id') %>
  35. # Use TLS to connect to the LDAP server.
  36. <%= Dovecot::Conf.attribute(@conf['ldap'], 'tls', false) %>
  37. # TLS options, currently supported only with OpenLDAP:
  38. <%= Dovecot::Conf.attribute(@conf['ldap'], 'tls_ca_cert_file') %>
  39. <%= Dovecot::Conf.attribute(@conf['ldap'], 'tls_ca_cert_file') %>
  40. <%= Dovecot::Conf.attribute(@conf['ldap'], 'tls_ca_cert_dir') %>
  41. <%= Dovecot::Conf.attribute(@conf['ldap'], 'tls_cipher_suite') %>
  42. # TLS cert/key is used only if LDAP server requires a client certificate.
  43. <%= Dovecot::Conf.attribute(@conf['ldap'], 'tls_cert_file') %>
  44. <%= Dovecot::Conf.attribute(@conf['ldap'], 'tls_key_file') %>
  45. # Valid values: never, hard, demand, allow, try
  46. <%= Dovecot::Conf.attribute(@conf['ldap'], 'tls_require_cert') %>
  47. # Use the given ldaprc path.
  48. <%= Dovecot::Conf.attribute(@conf['ldap'], 'ldaprc_path') %>
  49. # LDAP library debug level as specified by LDAP_DEBUG_* in ldap_log.h.
  50. # -1 = everything. You may need to recompile OpenLDAP with debugging enabled
  51. # to get enough output.
  52. <%= Dovecot::Conf.attribute(@conf['ldap'], 'debug_level', 0) %>
  53. # Use authentication binding for verifying password's validity. This works by
  54. # logging into LDAP server using the username and password given by client.
  55. # The pass_filter is used to find the DN for the user. Note that the pass_attrs
  56. # is still used, only the password field is ignored in it. Before doing any
  57. # search, the binding is switched back to the default DN.
  58. <%= Dovecot::Conf.attribute(@conf['ldap'], 'auth_bind', false) %>
  59. # If authentication binding is used, you can save one LDAP request per login
  60. # if users' DN can be specified with a common template. The template can use
  61. # the standard %variables (see user_filter). Note that you can't
  62. # use any pass_attrs if you use this setting.
  63. #
  64. # If you use this setting, it's a good idea to use a different
  65. # dovecot-ldap.conf.ext for userdb (it can even be a symlink, just as long as
  66. # the filename is different in userdb's args). That way one connection is used
  67. # only for LDAP binds and another connection is used for user lookups.
  68. # Otherwise the binding is changed to the default DN before each user lookup.
  69. #
  70. # For example:
  71. # auth_bind_userdn = cn=%u,ou=people,o=org
  72. #
  73. <%= Dovecot::Conf.attribute(@conf['ldap'], 'auth_bind_userdn') %>
  74. # LDAP protocol version to use. Likely 2 or 3.
  75. <%= Dovecot::Conf.attribute(@conf['ldap'], 'ldap_version', 3) %>
  76. # LDAP base. %variables can be used here.
  77. # For example: dc=mail, dc=example, dc=org
  78. base =
  79. # Dereference: never, searching, finding, always
  80. <%= Dovecot::Conf.attribute(@conf['ldap'], 'deref', 'never') %>
  81. # Search scope: base, onelevel, subtree
  82. <%= Dovecot::Conf.attribute(@conf['ldap'], 'scope', 'subtree') %>
  83. # User attributes are given in LDAP-name=dovecot-internal-name list. The
  84. # internal names are:
  85. # uid - System UID
  86. # gid - System GID
  87. # home - Home directory
  88. # mail - Mail location
  89. #
  90. # There are also other special fields which can be returned, see
  91. # http://wiki2.dovecot.org/UserDatabase/ExtraFields
  92. <%= Dovecot::Conf.attribute(@conf['ldap'], 'user_attrs', 'homeDirectory=home,uidNumber=uid,gidNumber=gid') %>
  93. # Filter for user lookup. Some variables can be used (see
  94. # http://wiki2.dovecot.org/Variables for full list):
  95. # %u - username
  96. # %n - user part in user@domain, same as %u if there's no domain
  97. # %d - domain part in user@domain, empty if user there's no domain
  98. <%= Dovecot::Conf.attribute(@conf['ldap'], 'user_filter', '(&(objectClass=posixAccount)(uid=%u))') %>
  99. # Password checking attributes:
  100. # user: Virtual user name (user@domain), if you wish to change the
  101. # user-given username to something else
  102. # password: Password, may optionally start with {type}, eg. {crypt}
  103. # There are also other special fields which can be returned, see
  104. # http://wiki2.dovecot.org/PasswordDatabase/ExtraFields
  105. <%= Dovecot::Conf.attribute(@conf['ldap'], 'pass_attrs', 'uid=user,userPassword=password') %>
  106. # If you wish to avoid two LDAP lookups (passdb + userdb), you can use
  107. # userdb prefetch instead of userdb ldap in dovecot.conf. In that case you'll
  108. # also have to include user_attrs in pass_attrs field prefixed with "userdb_"
  109. # string. For example:
  110. <%= Dovecot::Conf.attribute(@conf['ldap'], 'pass_attrs', 'uid=user,userPassword=password,\') %>
  111. # homeDirectory=userdb_home,uidNumber=userdb_uid,gidNumber=userdb_gid
  112. # Filter for password lookups
  113. <%= Dovecot::Conf.attribute(@conf['ldap'], 'pass_filter', '(&(objectClass=posixAccount)(uid=%u))') %>
  114. # Attributes and filter to get a list of all users
  115. <%= Dovecot::Conf.attribute(@conf['ldap'], 'iterate_attrs', 'uid=user') %>
  116. <%= Dovecot::Conf.attribute(@conf['ldap'], 'iterate_filter', '(objectClass=posixAccount)') %>
  117. # Default password scheme. "{scheme}" before password overrides this.
  118. # List of supported schemes is in: http://wiki2.dovecot.org/Authentication
  119. <%= Dovecot::Conf.attribute(@conf['ldap'], 'default_pass_scheme', 'CRYPT') %>