summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
@@ -10,41 +10,41 @@
# If you're using mbox, giving a path to the INBOX file (eg. /var/mail/%u)
# isn't enough. You'll also need to tell Dovecot where the other mailboxes are
# kept. This is called the "root mail directory", and it must be the first
# path given in the mail_location setting.
#
# There are a few special variables you can use, eg.:
#
# %u - username
# %n - user part in user@domain, same as %u if there's no domain
# %d - domain part in user@domain, empty if there's no domain
# %h - home directory
#
# See doc/wiki/Variables.txt for full list. Some examples:
#
# mail_location = maildir:~/Maildir
# mail_location = mbox:~/mail:INBOX=/var/mail/%u
# mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n
#
# <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.
#
# You can have private, shared and public namespaces. Private namespaces
# are for user's personal mails. Shared namespaces are for accessing other
# users' mailboxes that have been shared. Public namespaces are for shared
# mailboxes that are managed by sysadmin. If you create any shared or public
# namespaces you'll typically want to enable ACL plugin also, otherwise all
# users can access all the shared mailboxes, assuming they have permissions
# on filesystem level to do so.
namespace inbox {
# Namespace type: private, shared or public
#type = private
# Hierarchy separator to use. You should use the same separator for all
# namespaces or some clients get confused. '/' is usually a good one.
# The default however depends on the underlying mail storage format.
separator = /
@@ -63,43 +63,43 @@ namespace inbox {
# If namespace is hidden, it's not advertised to clients via NAMESPACE
# extension. You'll most likely also want to set list=no. This is mostly
# useful when converting from another server with different namespaces which
# you want to deprecate but still keep working. For example you can create
# hidden namespaces with prefixes "~/mail/", "~%u/mail/" and "mail/".
#hidden = no
# Show the mailboxes under this namespace with LIST command. This makes the
# namespace visible for clients that don't support NAMESPACE extension.
# "children" value lists child mailboxes, but hides the namespace prefix.
#list = yes
# Namespace handles its own subscriptions. If set to "no", the parent
# namespace handles them (empty prefix should always have this as "yes")
#subscriptions = yes
}
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
#namespace {
#type = shared
#separator = /
# Mailboxes are visible under "shared/user@domain/"
# %%n, %%d and %%u are expanded to the destination user.
#prefix = shared/%%u/
# Mail location for other users' mailboxes. Note that %variables and ~/
# expands to the logged in user's data. %%n, %%d, %%u and %%h expand to the
# destination user's data.
#location = maildir:%%h/Maildir:INDEX=~/Maildir/shared/%%u
# Use the default namespace for saving subscriptions.
#subscriptions = no
# List the shared/ namespace only if there are visible shared mailboxes.
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
@@ -16,22 +16,22 @@ passdb {
# driver = prefetch
#}
#userdb {
# driver = ldap
# # This should be a different file from the passdb's, in order to perform
# # asynchronous requests.
# args = /etc/dovecot/dovecot-ldap-userdb.conf.ext
#
# # Default fields can be used to specify defaults that LDAP may override
# #default_fields = home=/home/virtual/%u
#}
# If you don't have any user-specific settings, you can avoid the userdb LDAP
# lookup by using userdb static instead of userdb ldap, for example:
# <doc/wiki/UserDatabase.Static.txt>
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
@@ -1,44 +1,63 @@
- name: Install Dovecot
apt: pkg={{ item }}
with_items:
- dovecot-core
- dovecot-ldap
- dovecot-imapd
- dovecot-lmtpd
- name: Create a user 'vmail'
user: name=vmail system=yes
home=/home/mail
shell=/bin/false
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 }}
dest=/etc/dovecot/{{ item }}
owner=root group=root
mode=0644
register: r
with_items:
- conf.d/10-auth.conf
- conf.d/10-logging.conf
- conf.d/10-mail.conf
- conf.d/10-master.conf
- conf.d/10-ssl.conf
- conf.d/15-mailboxes.conf
- conf.d/20-lmtp.conf
- conf.d/auth-ldap.conf.ext
- dovecot-ldap.conf.ext
notify:
- Restart Dovecot