Brak opisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

etc_dovecot_dovecot-sql.conf.ext.j2 5.4KB

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