From 125280b0416767ede7665e9f12e5451b9306cfb8 Mon Sep 17 00:00:00 2001 From: Markus Katharina Brechtel Date: Fri, 15 Sep 2017 11:02:08 +0000 Subject: [PATCH] vmail user and group --- defaults/main.yml | 2 ++ tasks/main.yml | 14 ++++++++++++++ templates/dovecot-sql.conf.ext.j2 | 9 +++------ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 536d64d..b15ef9c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -2,3 +2,5 @@ dovecot_postfixadmin_mysql_host: localhost dovecot_postfixadmin_mysql_database: postfixadmin dovecot_postfixadmin_mysql_username: dovecot dovecot_postfixadmin_mysql_password: koof5DeNgi5aeR2ewoh9iz1u +vmail_uid: 500 +vmail_gid: 500 diff --git a/tasks/main.yml b/tasks/main.yml index c6a24c8..71d163b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -10,6 +10,20 @@ notify: - reload dovecot +- name: vmail group + group: + name: vmail + gid: "{{vmail_gid}}" + system: yes + +- name: vmail user + user: + name: vmail + uid: "{{vmail_uid}}" + group: vmail + system: yes + home: /var/vmail + - name: dovecot configuration files template: src: "{{ item }}.j2" diff --git a/templates/dovecot-sql.conf.ext.j2 b/templates/dovecot-sql.conf.ext.j2 index bb240ba..ed08f6b 100644 --- a/templates/dovecot-sql.conf.ext.j2 +++ b/templates/dovecot-sql.conf.ext.j2 @@ -130,12 +130,9 @@ password_query = SELECT username AS user,password FROM mailbox WHERE username = # FROM users WHERE username = '%n' AND domain = '%d' # # postfixadmin: Query to retrieve user information, note uid matches dovecot.conf AND Postfix virtual_uid_maps parameter. -user_query = SELECT CONCAT('*:bytes=', \ - IF(mailbox.quota = 0, domain.maxquota*1024000, mailbox.quota)) \ - as quota_rule \ - FROM mailbox, domain \ - WHERE username = '%u' AND mailbox.active = '1' AND \ - domain.domain = '%d' AND domain.active = '1' +user_query = SELECT CONCAT('/var/vmail/', maildir) AS home, \ + {{vmail_uid}} AS uid, {{vmail_gid}} AS gid \ + FROM mailbox WHERE username = '%u' AND active='1' # If you wish to avoid two SQL lookups (passdb + userdb), you can use # userdb prefetch instead of userdb sql in dovecot.conf. In that case you'll