On 28/10/2023 07:31, James Cloos wrote:
Also I'd like to use imap-specific passwds for each user. My tests so
far have used the login passwds for each user. Not necessarily virtual
users, just imap-specific passwds. There is already a pgsql server
handy; I take it that would be the way to go for passdb and userdb
lookups, yes?
Yes! If you have the DB already you have done most of the work. I use
postgresql for dovecot. I would urge you to use virtual users with the
user name of the email address. All my users are uid:gid vmail:vmail.
My mail database is used for other functions as well as dovecot but this
cut down listing has the columns used by dovecot (excepting typos...
keep asking).
I have a table for 'mailbox'. It references table 'domain' but as it
uses a text key the mailbox table will stand alone and no join on lookup.
mail=# \d mailbox
Table "public.mailbox"
Column | Type | Collation | Nullable | Default
-------------+------------------------+-----------+----------+---------
username | character varying(255) | | not null |
allow_nets | character varying(255) | | |
imap | boolean | | |
password | character varying(255) | | |
pop3 | boolean | | |
maxstorage | integer | | |
realname | character varying(255) | | |
sieve | boolean | | |
smtp | boolean | | |
domain | character varying(255) | | not null |
maxcount | integer | | |
Indexes:
"mailbox_pkey" PRIMARY KEY, btree (username, domain)
Foreign-key constraints:
"fk_mailbox_domain" FOREIGN KEY (domain) REFERENCES domain(name)
/etc/opt/.../dovecot-sql.conf has lines:
user_query = "SELECT 'vmail' AS uid, 'vmail' AS gid, allow_nets,
'*:storage=' || maxstorage || 'M' AS quota_rule, '*:messages=' ||
maxcount AS quota_rule2 FROM mailbox WHERE username = '%n' AND domain =
'%d' AND smtp = true;"
password_query = "SELECT password, allow_nets, '*:storage=' ||
maxstorage || 'M' AS userdb_quota_rule, '*:messages=' || maxcount AS
userdb_quota_rule2 FROM mailbox WHERE username = '%n' AND domain = '%d'
AND %Ls = true;"
Take this as hints; consult the documentation.
James.
_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org