Advertisement
Guest User

dovecot-sql.conf.ext

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