PageRenderTime 21ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/iRedMail/conf/openldap

https://bitbucket.org/dineshkummarc/iredmail
#! | 263 lines | 213 code | 50 blank | 0 comment | 0 complexity | 297876a8e32fbc86880c7ccb60ff21c5 MD5 | raw file
  1. #!/usr/bin/env bash
  2. # Author: Zhang Huangbin (zhb _at_ iredmail.org)
  3. #---------------------------------------------------------------------
  4. # This file is part of iRedMail, which is an open source mail server
  5. # solution for Red Hat(R) Enterprise Linux, CentOS, Debian and Ubuntu.
  6. #
  7. # iRedMail is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # iRedMail is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with iRedMail. If not, see <http://www.gnu.org/licenses/>.
  19. #---------------------------------------------------------------------
  20. # Variables for OpenLDAP and related. Refer to 'dialog/ldap_config.sh'.
  21. # LDAP service info.
  22. # LDAP_SERVER_HOST is configured in conf/global
  23. export LDAP_SERVER_PORT='389'
  24. export LDAP_USE_TLS='NO'
  25. export LDAP_BIND='yes'
  26. export LDAP_BIND_VERSION='3'
  27. # OpenLDAP daemon user and group name.
  28. export OPENLDAP_DAEMON_USER='ldap'
  29. export OPENLDAP_DAEMON_GROUP='ldap'
  30. export LDAP_RC_SCRIPT_NAME='slapd'
  31. # Configuration files.
  32. export OPENLDAP_CONF_ROOT='/etc/openldap'
  33. # Database backend type.
  34. # Note:
  35. # * We use the same database type on all distributions to reduce our
  36. # workflow, and users migrate their mail server between supported
  37. # OS will be more comfortable.
  38. # * Performance of bdb backend is good enough. but Debian/Ubuntu can
  39. # also use 'hdb' for OpenLDAP-2.4.x.
  40. export OPENLDAP_DEFAULT_DBTYPE='bdb'
  41. # Default LDAP data directory.
  42. export OPENLDAP_DATA_DIR='/var/lib/ldap' # Do *NOT* end with '/'.
  43. export OPENLDAP_PID_FILE='/var/run/openldap/slapd.pid'
  44. export OPENLDAP_ARGS_FILE='/var/run/openldap/slapd.args'
  45. # Configure.
  46. if [ X"${DISTRO}" == X"RHEL" ]; then
  47. # OpenLDAP version.
  48. if [ X"${DISTRO_VERSION}" == X"5" ]; then
  49. export OPENLDAP_VERSION='2.3'
  50. export LDAP_RC_SCRIPT_NAME='ldap'
  51. else
  52. export OPENLDAP_VERSION='2.4'
  53. fi
  54. export OPENLDAP_DB_CONFIG_SAMPLE="${OPENLDAP_CONF_ROOT}/DB_CONFIG.example"
  55. export OPENLDAP_SYSCONFIG_CONF="${ETC_SYSCONFIG_DIR}/ldap"
  56. # Module related.
  57. export OPENLDAP_MODULE_PATH='/usr/lib/openldap'
  58. if [ X"${ARCH}" == X'x86_64' ]; then
  59. export OPENLDAP_MODULE_PATH='/usr/lib64/openldap'
  60. fi
  61. elif [ X"${DISTRO}" == X"SUSE" ]; then
  62. # OpenLDAP version.
  63. export OPENLDAP_VERSION='2.4'
  64. export OPENLDAP_DB_CONFIG_SAMPLE='/var/lib/ldap/DB_CONFIG.example'
  65. export OPENLDAP_PID_FILE='/var/run/slapd/slapd.pid'
  66. export OPENLDAP_ARGS_FILE='/var/run/slapd/slapd.args'
  67. export OPENLDAP_SYSCONFIG_CONF="${ETC_SYSCONFIG_DIR}/openldap"
  68. # RC script
  69. export LDAP_RC_SCRIPT_NAME='ldap'
  70. elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
  71. # OpenLDAP version.
  72. export OPENLDAP_VERSION='2.4'
  73. # LDAP daemon user & group.
  74. export OPENLDAP_DAEMON_USER='openldap'
  75. export OPENLDAP_DAEMON_GROUP='openldap'
  76. # Configuration files.
  77. export OPENLDAP_CONF_ROOT="/etc/ldap"
  78. export OPENLDAP_DB_CONFIG_SAMPLE="/usr/share/slapd/DB_CONFIG"
  79. export OPENLDAP_PID_FILE='/var/run/slapd/slapd.pid'
  80. export OPENLDAP_ARGS_FILE='/var/run/slapd/slapd.args'
  81. export OPENLDAP_SYSCONFIG_CONF="${ETC_SYSCONFIG_DIR}/slapd"
  82. # Module related.
  83. export OPENLDAP_MODULE_PATH='/usr/lib/ldap'
  84. elif [ X"${DISTRO}" == X"GENTOO" ]; then
  85. # OpenLDAP version.
  86. export OPENLDAP_VERSION='2.4'
  87. export OPENLDAP_DB_CONFIG_SAMPLE="${OPENLDAP_CONF_ROOT}/DB_CONFIG.example"
  88. export OPENLDAP_SYSCONFIG_CONF="${ETC_SYSCONFIG_DIR}/slapd"
  89. # Module related.
  90. export OPENLDAP_MODULE_PATH='/usr/lib/openldap/openldap'
  91. # Override default path
  92. export OPENLDAP_DATA_DIR='/var/lib/openldap-data'
  93. elif [ X"${DISTRO}" == X"FREEBSD" ]; then
  94. # OpenLDAP version.
  95. export OPENLDAP_VERSION='2.4'
  96. # Configuration files.
  97. export OPENLDAP_CONF_ROOT='/usr/local/etc/openldap'
  98. export OPENLDAP_DB_CONFIG_SAMPLE="${OPENLDAP_CONF_ROOT}/DB_CONFIG.example"
  99. # Module related.
  100. export OPENLDAP_MODULE_PATH='/usr/local/libexec/openldap'
  101. # Override default setting.
  102. export OPENLDAP_DATA_DIR='/var/db/openldap-data' # Do *NOT* end with '/'.
  103. elif [ X"${DISTRO}" == X'OPENBSD' ]; then
  104. # OpenLDAP version.
  105. export OPENLDAP_VERSION='2.4'
  106. # LDAP daemon user & group.
  107. export OPENLDAP_DAEMON_USER='_openldap'
  108. export OPENLDAP_DAEMON_GROUP='_openldap'
  109. export OPENLDAP_DB_CONFIG_SAMPLE="/usr/local/share/examples/openldap/DB_CONFIG"
  110. # Module related.
  111. export OPENLDAP_MODULE_PATH='/usr/local/libexec/openldap'
  112. else
  113. :
  114. fi
  115. # RC script.
  116. export LDAP_RC_SCRIPT="${DIR_RC_SCRIPTS}/${LDAP_RC_SCRIPT_NAME}"
  117. export OPENLDAP_SCHEMA_DIR="${OPENLDAP_CONF_ROOT}/schema"
  118. export OPENLDAP_SLAPD_CONF="${OPENLDAP_CONF_ROOT}/slapd.conf"
  119. export OPENLDAP_LDAP_CONF="${OPENLDAP_CONF_ROOT}/ldap.conf"
  120. export OPENLDAP_LOGFILE='/var/log/openldap.log'
  121. export OPENLDAP_LOGROTATE_FILE="${LOGROTATE_DIR}/openldap"
  122. # LDAP data directory.
  123. export LDAP_DATA_DIR="${OPENLDAP_DATA_DIR}/${dn2dnsname}"
  124. # Setting for one instance. You can edit ${OPENLDAP_SLAPD_CONF} manually to hold
  125. # multi instances.
  126. export LDAP_INIT_LDIF="${CONF_DIR}/ldap_init.ldif"
  127. ##################################################
  128. # iRedMail LDAP schema related
  129. #
  130. # objectClass
  131. export LDAP_OBJECTCLASS_OU='organizationalUnit'
  132. export LDAP_OBJECTCLASS_MAILDOMAIN='mailDomain'
  133. export LDAP_OBJECTCLASS_MAILUSER='mailUser'
  134. export LDAP_OBJECTCLASS_MAILALIAS='mailAlias'
  135. export LDAP_OBJECTCLASS_MAILGROUP='mailList'
  136. export LDAP_OBJECTCLASS_MAILADMIN='mailAdmin'
  137. export LDAP_OBJECTCLASS_MAIL_EXTERNAL_USER='mailExternalUser'
  138. # Common attribute.
  139. export LDAP_ENABLED_SERVICE='enabledService'
  140. # Values of service name.
  141. export LDAP_SERVICE_DOMAIN_ALIAS='domainalias'
  142. export LDAP_SERVICE_MAIL='mail'
  143. export LDAP_SERVICE_INTERNAL='internal'
  144. export LDAP_SERVICE_DOVEADM='doveadm'
  145. export LDAP_SERVICE_SMTP='smtp'
  146. export LDAP_SERVICE_SMTPS='smtpsecured'
  147. export LDAP_SERVICE_POP3='pop3'
  148. export LDAP_SERVICE_POP3S='pop3secured'
  149. export LDAP_SERVICE_IMAP='imap'
  150. export LDAP_SERVICE_IMAPS='imapsecured'
  151. export LDAP_SERVICE_DELIVER='deliver'
  152. export LDAP_SERVICE_LDA='lda'
  153. export LDAP_SERVICE_FORWARD='forward'
  154. export LDAP_SERVICE_SENDER_BCC='senderbcc'
  155. export LDAP_SERVICE_RECIPIENT_BCC='recipientbcc'
  156. export LDAP_SERVICE_MANAGESIEVE='managesieve'
  157. export LDAP_SERVICE_MANAGESIEVES='managesievesecured'
  158. export LDAP_SERVICE_SIEVE='sieve'
  159. export LDAP_SERVICE_SIEVES='sievesecured'
  160. export LDAP_SERVICE_WEBMAIL='webmail'
  161. export LDAP_SERVICE_AWSTATS='awstats'
  162. export LDAP_SERVICE_SHADOW_ADDRESS='shadowaddress'
  163. export LDAP_SERVICE_DISPLAYED_IN_ADDRBOOK='displayedInGlobalAddressBook'
  164. export LDAP_SERVICE_LIB_STORAGE='lib-storage'
  165. export LDAP_SERVICE_DOMAIN_ADMIN='domainadmin'
  166. # Shared attributes.
  167. export LDAP_ATTR_ACCOUNT_STATUS='accountStatus'
  168. export LDAP_ATTR_MTA_TRANSPORT='mtaTransport'
  169. # Domain admin related.
  170. export LDAP_ATTR_DOMAINADMIN_DN_NAME='domainAdmins'
  171. # Domain related attributes.
  172. export LDAP_ATTR_DOMAIN_RDN='domainName'
  173. export LDAP_ATTR_DOMAIN_ALIAS_NAME='domainAliasName'
  174. export LDAP_ATTR_DOMAIN_ADMIN='domainAdmin'
  175. export LDAP_ATTR_DOMAIN_GLOBALADMIN='domainGlobalAdmin'
  176. export LDAP_ATTR_DOMAIN_BACKUPMX='domainBackupMX'
  177. export LDAP_ATTR_DOMAIN_MAX_QUOTA_SIZE='domainMaxQuotaSize'
  178. export LDAP_ATTR_DOMAIN_MAX_USER_NUMBER='domainMaxUserNumber'
  179. export LDAP_ATTR_DOMAIN_SENDER_BCC_ADDRESS='domainSenderBccAddress'
  180. export LDAP_ATTR_DOMAIN_RECIPIENT_BCC_ADDRESS='domainRecipientBccAddress'
  181. # Values of domain related attributes.
  182. export LDAP_VALUE_DOMAIN_GLOBALADMIN='yes'
  183. export LDAP_VALUE_DOMAIN_BACKUPMX='yes'
  184. # Group related.
  185. export LDAP_ATTR_GROUP_RDN='ou'
  186. export LDAP_ATTR_GROUP_USERS='Users'
  187. export LDAP_ATTR_GROUP_GROUPS='Groups'
  188. export LDAP_ATTR_GROUP_ALIASES='Aliases'
  189. export LDAP_ATTR_GROUP_EXTERNALS='Externals'
  190. # Attributes of group object.
  191. export LDAP_ATTR_GROUP_ACCESSPOLICY='accessPolicy'
  192. export LDAP_ATTR_GROUP_HASMEMBER='hasMember'
  193. export LDAP_ATTR_GROUP_MEMBER='mailForwardingAddress'
  194. export LDAP_ATTR_GROUP_ALLOWED_USER='listAllowedUser'
  195. # Values of group related attributes.
  196. export LDAP_VALUE_GROUP_HASMEMBER='yes'
  197. # Attributes of user object.
  198. export LDAP_ATTR_USER_RDN='mail'
  199. export LDAP_ATTR_USER_PASSWD='userPassword'
  200. export LDAP_ATTR_USER_HOME_DIRECTORY='homeDirectory'
  201. export LDAP_ATTR_USER_STORAGE_BASE_DIRECTORY='storageBaseDirectory'
  202. export LDAP_ATTR_USER_SENDER_BCC_ADDRESS='userSenderBccAddress'
  203. export LDAP_ATTR_USER_RECIPIENT_BCC_ADDRESS='userRecipientBccAddress'
  204. export LDAP_ATTR_USER_BACKUP_MAIL_ADDRESS='backupMailAddress'
  205. export LDAP_ATTR_USER_QUOTA='mailQuota'
  206. export LDAP_ATTR_USER_FORWARD='mailForwardingAddress'
  207. export LDAP_ATTR_USER_RESTRICTION_CLASS='restrictionClass'
  208. export LDAP_ATTR_USER_RESTRICTED_DOMAIN='restrictedDomain'
  209. export LDAP_ATTR_USER_MEMBER_OF_GROUP='memberOfGroup'
  210. export LDAP_ATTR_USER_SHADOW_ADDRESS='shadowAddress'
  211. # Values of user related attributes.
  212. export LDAP_STATUS_ACTIVE='active'
  213. #### END LDAP schema ####