summaryrefslogtreecommitdiffstats
path: root/roles/IMAP
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2013-12-10 20:45:22 +0100
committerGuilhem Moulin <guilhem@fripost.org>2015-06-07 02:51:19 +0200
commit50df1556816e118b4bc449aaa7dfbab7a2ead626 (patch)
tree48139c6e2e38b1e6ca769d93b2d38b2498256906 /roles/IMAP
parent5eedb4087bda5b16697e02f494c928dac1179364 (diff)
Enable IMAP virtual mailboxes.
Using dovecot's 'virtual' plugin, cf. http://wiki2.dovecot.org/Plugins/Virtual The 'virtual/' namespace is visible in the NAMESPACE command (hidden=no), but not in LIST (list=no). This should ensure that the namespace isn't automatically synced by offlineimap, but nevertheless visible by roundcube, cf. http://trac.roundcube.net/ticket/1486796 http://mailman2.u.washington.edu/pipermail/imap-protocol/2010-May/001076.html
Diffstat (limited to 'roles/IMAP')
-rw-r--r--roles/IMAP/files/etc/dovecot/conf.d/10-mail.conf6
-rw-r--r--roles/IMAP/files/etc/dovecot/conf.d/auth-ldap.conf.ext2
-rw-r--r--roles/IMAP/files/etc/dovecot/virtual/all/dovecot-virtual8
-rw-r--r--roles/IMAP/files/etc/dovecot/virtual/flagged/dovecot-virtual2
-rw-r--r--roles/IMAP/files/etc/dovecot/virtual/recent/dovecot-virtual7
-rw-r--r--roles/IMAP/files/etc/dovecot/virtual/unseen/dovecot-virtual8
-rw-r--r--roles/IMAP/tasks/imap.yml29
7 files changed, 53 insertions, 9 deletions
diff --git a/roles/IMAP/files/etc/dovecot/conf.d/10-mail.conf b/roles/IMAP/files/etc/dovecot/conf.d/10-mail.conf
index 48e2c46..2c5f34f 100644
--- a/roles/IMAP/files/etc/dovecot/conf.d/10-mail.conf
+++ b/roles/IMAP/files/etc/dovecot/conf.d/10-mail.conf
@@ -27,7 +27,7 @@
#
# <doc/wiki/MailLocation.txt>
#
-mail_location = mdbox:/home/mail/mailboxes/%d/%n
+mail_location = mdbox:~/mail
# If you need to set multiple mailbox locations or want to change default
# namespace settings, you can do it by defining namespace sections.
@@ -80,9 +80,9 @@ namespace inbox {
namespace virtual {
prefix = virtual/
separator = /
- location = virtual:/home/mail/virtual/%d/%n
+ location = virtual:/etc/dovecot/virtual:INDEX=~/virtual
list = no
- hidden = yes
+ hidden = no
}
# Example shared namespace configuration
diff --git a/roles/IMAP/files/etc/dovecot/conf.d/auth-ldap.conf.ext b/roles/IMAP/files/etc/dovecot/conf.d/auth-ldap.conf.ext
index 542353b..8e88b27 100644
--- a/roles/IMAP/files/etc/dovecot/conf.d/auth-ldap.conf.ext
+++ b/roles/IMAP/files/etc/dovecot/conf.d/auth-ldap.conf.ext
@@ -33,5 +33,5 @@ userdb {
driver = static
# The MTA has already verified the existence of users when doing alias resolution,
# so we can skip the passdb lookup here.
- args = home=/home/mail/mailboxes/%d/%n allow_all_users=yes
+ args = home=/home/mail/%d/%n allow_all_users=yes
}
diff --git a/roles/IMAP/files/etc/dovecot/virtual/all/dovecot-virtual b/roles/IMAP/files/etc/dovecot/virtual/all/dovecot-virtual
new file mode 100644
index 0000000..98e5192
--- /dev/null
+++ b/roles/IMAP/files/etc/dovecot/virtual/all/dovecot-virtual
@@ -0,0 +1,8 @@
+!INBOX
+-JUNK
+-JUNK/*
+-SPAM
+-SPAM/*
+-TRASH
+*
+ all
diff --git a/roles/IMAP/files/etc/dovecot/virtual/flagged/dovecot-virtual b/roles/IMAP/files/etc/dovecot/virtual/flagged/dovecot-virtual
new file mode 100644
index 0000000..883f49e
--- /dev/null
+++ b/roles/IMAP/files/etc/dovecot/virtual/flagged/dovecot-virtual
@@ -0,0 +1,2 @@
+*
+ flagged
diff --git a/roles/IMAP/files/etc/dovecot/virtual/recent/dovecot-virtual b/roles/IMAP/files/etc/dovecot/virtual/recent/dovecot-virtual
new file mode 100644
index 0000000..9c9a7e8
--- /dev/null
+++ b/roles/IMAP/files/etc/dovecot/virtual/recent/dovecot-virtual
@@ -0,0 +1,7 @@
+-JUNK
+-JUNK/*
+-SPAM
+-SPAM/*
+-TRASH
+*
+ YOUNGER 2592000
diff --git a/roles/IMAP/files/etc/dovecot/virtual/unseen/dovecot-virtual b/roles/IMAP/files/etc/dovecot/virtual/unseen/dovecot-virtual
new file mode 100644
index 0000000..c5c09fc
--- /dev/null
+++ b/roles/IMAP/files/etc/dovecot/virtual/unseen/dovecot-virtual
@@ -0,0 +1,8 @@
+-DRAFTS
+-JUNK
+-JUNK/*
+-SPAM
+-SPAM/*
+-TRASH
+*
+ unseen
diff --git a/roles/IMAP/tasks/imap.yml b/roles/IMAP/tasks/imap.yml
index 554bc67..d8bb352 100644
--- a/roles/IMAP/tasks/imap.yml
+++ b/roles/IMAP/tasks/imap.yml
@@ -13,15 +13,34 @@
password=!
state=present
-- name: Create directories for user 'vmail'
- file: path=/home/mail{{ item }}
- owner=vmail group=vmail
+- name: Create a home directory for user 'vmail'
+ file: path=/home/mail
state=directory
+ owner=vmail group=vmail
mode=0700
+
+- name: Create virtual mailbox directories
+ file: path=/etc/dovecot/virtual{{ item }}
+ state=directory
+ owner=root group=root
+ mode=0755
with_items:
- /
- - /mailboxes
- - /sieve
+ - /all
+ - /flagged
+ - /recent
+ - /unseen
+
+- name: Create virtual mailboxes
+ copy: src=etc/dovecot/virtual/{{ item }}/dovecot-virtual
+ dest=/etc/dovecot/virtual/{{ item }}/dovecot-virtual
+ owner=root group=root
+ mode=0644
+ with_items:
+ - all
+ - flagged
+ - recent
+ - unseen
- name: Configure Dovecot
copy: src=etc/dovecot/{{ item }}