Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

dovecot-sql.conf.ext.j2 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. # This file is commonly accessed via passdb {} or userdb {} section in
  2. # conf.d/auth-sql.conf.ext
  3. # This file is opened as root, so it should be owned by root and mode 0600.
  4. #
  5. # http://wiki2.dovecot.org/AuthDatabase/SQL
  6. #
  7. # For the sql passdb module, you'll need a database with a table that
  8. # contains fields for at least the username and password. If you want to
  9. # use the user@domain syntax, you might want to have a separate domain
  10. # field as well.
  11. #
  12. # If your users all have the same uig/gid, and have predictable home
  13. # directories, you can use the static userdb module to generate the home
  14. # dir based on the username and domain. In this case, you won't need fields
  15. # for home, uid, or gid in the database.
  16. #
  17. # If you prefer to use the sql userdb module, you'll want to add fields
  18. # for home, uid, and gid. Here is an example table:
  19. #
  20. # CREATE TABLE users (
  21. # username VARCHAR(128) NOT NULL,
  22. # domain VARCHAR(128) NOT NULL,
  23. # password VARCHAR(64) NOT NULL,
  24. # home VARCHAR(255) NOT NULL,
  25. # uid INTEGER NOT NULL,
  26. # gid INTEGER NOT NULL,
  27. # active CHAR(1) DEFAULT 'Y' NOT NULL
  28. # );
  29. # Database driver: mysql, pgsql, sqlite
  30. driver = mysql
  31. # Database connection string. This is driver-specific setting.
  32. #
  33. # HA / round-robin load-balancing is supported by giving multiple host
  34. # settings, like: host=sql1.host.org host=sql2.host.org
  35. #
  36. # pgsql:
  37. # For available options, see the PostgreSQL documention for the
  38. # PQconnectdb function of libpq.
  39. # Use maxconns=n (default 5) to change how many connections Dovecot can
  40. # create to pgsql.
  41. #
  42. # mysql:
  43. # Basic options emulate PostgreSQL option names:
  44. # host, port, user, password, dbname
  45. #
  46. # But also adds some new settings:
  47. # client_flags - See MySQL manual
  48. # ssl_ca, ssl_ca_path - Set either one or both to enable SSL
  49. # ssl_cert, ssl_key - For sending client-side certificates to server
  50. # ssl_cipher - Set minimum allowed cipher security (default: HIGH)
  51. # ssl_verify_server_cert - Verify that the name in the server SSL certificate
  52. # matches the host (default: no)
  53. # option_file - Read options from the given file instead of
  54. # the default my.cnf location
  55. # option_group - Read options from the given group (default: client)
  56. #
  57. # You can connect to UNIX sockets by using host: host=/var/run/mysql.sock
  58. # Note that currently you can't use spaces in parameters.
  59. #
  60. # sqlite:
  61. # The path to the database file.
  62. #
  63. # Examples:
  64. # connect = host=192.168.1.1 dbname=users
  65. # connect = host=sql.example.com dbname=virtual user=virtual password=blarg
  66. # connect = /etc/dovecot/authdb.sqlite
  67. #
  68. connect = host={{dovecot_postfixadmin_mysql_host}} dbname={{dovecot_postfixadmin_mysql_database}} user={{dovecot_postfixadmin_mysql_username}} password={{dovecot_postfixadmin_mysql_password}}
  69. # Default password scheme.
  70. #
  71. # List of supported schemes is in
  72. # http://wiki2.dovecot.org/Authentication/PasswordSchemes
  73. #
  74. default_pass_scheme = MD5-CRYPT
  75. # passdb query to retrieve the password. It can return fields:
  76. # password - The user's password. This field must be returned.
  77. # user - user@domain from the database. Needed with case-insensitive lookups.
  78. # username and domain - An alternative way to represent the "user" field.
  79. #
  80. # The "user" field is often necessary with case-insensitive lookups to avoid
  81. # e.g. "name" and "nAme" logins creating two different mail directories. If
  82. # your user and domain names are in separate fields, you can return "username"
  83. # and "domain" fields instead of "user".
  84. #
  85. # The query can also return other fields which have a special meaning, see
  86. # http://wiki2.dovecot.org/PasswordDatabase/ExtraFields
  87. #
  88. # Commonly used available substitutions (see http://wiki2.dovecot.org/Variables
  89. # for full list):
  90. # %u = entire user@domain
  91. # %n = user part of user@domain
  92. # %d = domain part of user@domain
  93. #
  94. # Note that these can be used only as input to SQL query. If the query outputs
  95. # any of these substitutions, they're not touched. Otherwise it would be
  96. # difficult to have eg. usernames containing '%' characters.
  97. #
  98. # Example:
  99. # password_query = SELECT userid AS user, pw AS password \
  100. # FROM users WHERE userid = '%u' AND active = 'Y'
  101. #
  102. #password_query = \
  103. # SELECT username, domain, password \
  104. # FROM users WHERE username = '%n' AND domain = '%d'
  105. password_query = SELECT username AS user,password FROM mailbox WHERE username = '%u' AND active='1'
  106. # userdb query to retrieve the user information. It can return fields:
  107. # uid - System UID (overrides mail_uid setting)
  108. # gid - System GID (overrides mail_gid setting)
  109. # home - Home directory
  110. # mail - Mail location (overrides mail_location setting)
  111. #
  112. # None of these are strictly required. If you use a single UID and GID, and
  113. # home or mail directory fits to a template string, you could use userdb static
  114. # instead. For a list of all fields that can be returned, see
  115. # http://wiki2.dovecot.org/UserDatabase/ExtraFields
  116. #
  117. # Examples:
  118. # user_query = SELECT home, uid, gid FROM users WHERE userid = '%u'
  119. # user_query = SELECT dir AS home, user AS uid, group AS gid FROM users where userid = '%u'
  120. # user_query = SELECT home, 501 AS uid, 501 AS gid FROM users WHERE userid = '%u'
  121. #
  122. #user_query = \
  123. # SELECT home, uid, gid \
  124. # FROM users WHERE username = '%n' AND domain = '%d'
  125. #
  126. # postfixadmin: Query to retrieve user information, note uid matches dovecot.conf AND Postfix virtual_uid_maps parameter.
  127. user_query = SELECT CONCAT('/home/vmail/', maildir) AS home, \
  128. {{vmail_uid}} AS uid, {{vmail_gid}} AS gid \
  129. FROM mailbox WHERE username = '%u' AND active='1'
  130. # If you wish to avoid two SQL lookups (passdb + userdb), you can use
  131. # userdb prefetch instead of userdb sql in dovecot.conf. In that case you'll
  132. # also have to return userdb fields in password_query prefixed with "userdb_"
  133. # string. For example:
  134. #password_query = \
  135. # SELECT userid AS user, password, \
  136. # home AS userdb_home, uid AS userdb_uid, gid AS userdb_gid \
  137. # FROM users WHERE userid = '%u'
  138. # Query to get a list of all usernames.
  139. #iterate_query = SELECT username AS user FROM users