|
1 | | -# This file is opened as root, so it should be owned by root and mode 0600. |
2 | | -# |
3 | 1 | # http://wiki.dovecot.org/AuthDatabase/SQL |
4 | 2 | # |
5 | | -# For the sql passdb module, you'll need a database with a table that |
6 | | -# contains fields for at least the userid 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 userid 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 | 3 | # CREATE TABLE users ( |
19 | 4 | # userid VARCHAR(128) NOT NULL, |
20 | 5 | # password VARCHAR(64) NOT NULL, |
|
24 | 9 | # active CHAR(1) DEFAULT 'Y' NOT NULL |
25 | 10 | # ); |
26 | 11 |
|
27 | | -# Database driver: mysql, pgsql, sqlite |
28 | | -#driver = |
29 | | - |
30 | | -# Database connection string. This is driver-specific setting. |
31 | | -# |
32 | | -# pgsql: |
33 | | -# For available options, see the PostgreSQL documention for the |
34 | | -# PQconnectdb function of libpq. |
35 | | -# |
36 | | -# mysql: |
37 | | -# Basic options emulate PostgreSQL option names: |
38 | | -# host, port, user, password, dbname |
39 | | -# |
40 | | -# But also adds some new settings: |
41 | | -# client_flags - See MySQL manual |
42 | | -# ssl_ca, ssl_ca_path - Set either one or both to enable SSL |
43 | | -# ssl_cert, ssl_key - For sending client-side certificates to server |
44 | | -# ssl_cipher - Set minimum allowed cipher security (default: HIGH) |
45 | | -# |
46 | | -# You can connect to UNIX sockets by using host: host=/var/run/mysqld/mysqld.sock |
47 | | -# Note that currently you can't use spaces in parameters. |
48 | | -# |
49 | | -# sqlite: |
50 | | -# The path to the database file. |
51 | | -# |
52 | | -# Examples: |
53 | | -# connect = host=192.168.1.1 dbname=users |
54 | | -# connect = host=sql.example.com dbname=virtual user=virtual password=blarg |
55 | | -# connect = /etc/dovecot/authdb.sqlite |
56 | | -# |
57 | | -#connect = dbname=virtual user=virtual |
58 | | - |
59 | | -# Default password scheme. |
60 | | -# |
61 | | -# List of supported schemes is in |
62 | | -# http://wiki.dovecot.org/Authentication/PasswordSchemes |
63 | | -# |
64 | | -#default_pass_scheme = PLAIN-MD5 |
65 | | - |
66 | | -# Query to retrieve the password. |
67 | | -# |
68 | | -# This query must return only one row with "user" and "password" columns. |
69 | | -# The query can also return other fields which have a special meaning, see |
70 | | -# http://wiki.dovecot.org/PasswordDatabase/ExtraFields |
71 | | -# |
72 | | -# The "user" column is needed to make sure the username gets used with exactly |
73 | | -# the same casing as it's in the database. Note that if you store username and |
74 | | -# domain in separate fields, you most likely want to return a combination of |
75 | | -# them as the "user" column, otherwise the domain gets stripped. |
76 | | -# |
77 | | -# Commonly used available substitutions (see |
78 | | -# http://wiki.dovecot.org/Variables for full list): |
79 | | -# %u = entire userid |
80 | | -# %n = user part of user@domain |
81 | | -# %d = domain part of user@domain |
82 | | -# |
83 | | -# Note that these can be used only as input to SQL query. If the query outputs |
84 | | -# any of these substitutions, they're not touched. Otherwise it would be |
85 | | -# difficult to have eg. usernames containing '%' characters. |
86 | | -# |
87 | | -# Example: |
88 | | -# password_query = SELECT concat(userid, '@', domain) AS user, password FROM users WHERE userid = '%n' AND domain = '%d' |
89 | | -# password_query = SELECT pw AS password FROM users WHERE userid = '%u' AND active = 'Y' |
90 | | -# |
91 | | -#password_query = SELECT userid as user, password FROM users WHERE userid = '%u' |
92 | | - |
93 | | -# Query to retrieve the user information. |
94 | | -# |
95 | | -# The query must return only one row. Commonly returned columns are: |
96 | | -# uid - System UID |
97 | | -# gid - System GID |
98 | | -# home - Home directory |
99 | | -# mail - Mail location |
100 | | -# |
101 | | -# Either home or mail is required. uid and gid are required. If more than one |
102 | | -# row is returned or there are missing fields, the login will fail. For a list |
103 | | -# of all fields that can be returned, see |
104 | | -# http://wiki.dovecot.org/UserDatabase/ExtraFields |
105 | | -# |
106 | | -# Examples |
107 | | -# user_query = SELECT home, uid, gid FROM users WHERE userid = '%n' AND domain = '%d' |
108 | | -# user_query = SELECT dir AS home, user AS uid, group AS gid FROM users where userid = '%u' |
109 | | -# user_query = SELECT home, 501 AS uid, 501 AS gid FROM users WHERE userid = '%u' |
110 | | -# |
111 | | -#user_query = SELECT home, uid, gid FROM users WHERE userid = '%u' |
112 | | - |
113 | | -# If you wish to avoid two SQL lookups (passdb + userdb), you can use |
114 | | -# userdb prefetch instead of userdb sql in dovecot.conf. In that case you'll |
115 | | -# also have to return userdb fields in password_query prefixed with "userdb_" |
116 | | -# string. For example: |
117 | | -#password_query = SELECT userid as user, password, home as userdb_home, uid as userdb_uid, gid as userdb_gid FROM users WHERE userid = '%u' |
118 | | - |
119 | 12 | driver = mysql |
120 | 13 | connect = host={mysql_server_host} dbname={mysql_server_database} user={mysql_server_ispconfig_user} password={mysql_server_ispconfig_password} |
121 | 14 | default_pass_scheme = CRYPT |
122 | 15 |
|
123 | | -password_query = SELECT password FROM mail_user WHERE login = '%u' AND disable%Ls = 'n' |
124 | | -# user_query = SELECT email AS user, maildir AS home, CONCAT('*:storage=', quota , 'B') AS quota_rule FROM mail_user WHERE login = '%u' AND disable%Ls = 'n' |
125 | | -user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('*:storage=', floor(quota/1024), 'B') AS quota_rule, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE email = '%u' AND disable%Ls = 'n' |
| 16 | +password_query = SELECT password FROM mail_user \ |
| 17 | + WHERE login = '%u' AND disable%Ls = 'n' |
| 18 | + |
| 19 | +# Old user query quota part |
| 20 | +# CONCAT('*:storage=', quota , 'B') AS quota_rule |
| 21 | +# Old user query with email instead of login |
| 22 | +# WHERE email = '%u' AND disable%Ls = 'n' |
| 23 | + |
| 24 | +user_query = SELECT email as user, \ |
| 25 | + maildir as home, \ |
| 26 | + CONCAT('maildir:', maildir, '/Maildir') as mail, \ |
| 27 | + uid, \ |
| 28 | + gid, \ |
| 29 | + CONCAT('*:storage=', floor(quota/1024), 'B') AS quota_rule, \ |
| 30 | + CONCAT(maildir, '/.sieve') as sieve \ |
| 31 | + FROM mail_user \ |
| 32 | + WHERE email = '%u' AND disable%Ls = 'n' |
0 commit comments