]> id.pley.net Git - postfix.git/commitdiff
Add dovecot support
authorJer (on server) <jer@pley.net>
Wed, 30 Nov 2016 22:40:07 +0000 (22:40 +0000)
committerJer (on server) <jer@pley.net>
Wed, 30 Nov 2016 22:40:07 +0000 (22:40 +0000)
Makefile
dovecot/Makefile [new file with mode: 0644]
dovecot/dovecot-sql.conf.ext [new file with mode: 0644]
dovecot/local.conf [new file with mode: 0644]

index 6183414beeeb5231550a3fc5c2c12b7ae052aec2..7022faedfca0c3ee6d74abfc363bd69a0efdda1a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-SUBDIRS := postfix postfixadmin 
+SUBDIRS := postfix postfixadmin dovecot
 
 all: $(SUBDIRS)
 .PHONY: $(SUBDIRS)
 
 all: $(SUBDIRS)
 .PHONY: $(SUBDIRS)
diff --git a/dovecot/Makefile b/dovecot/Makefile
new file mode 100644 (file)
index 0000000..ba757e7
--- /dev/null
@@ -0,0 +1,11 @@
+DST := /etc/dovecot
+
+INPUTS := dovecot-sql.conf.ext local.conf
+
+OUTPUTS := $(INPUTS:%=$(DST)/%)
+
+all: $(OUTPUTS)
+
+$(DST)/%: configuration/%
+       @mkdir -p $(@D)
+       cp $^ $@
diff --git a/dovecot/dovecot-sql.conf.ext b/dovecot/dovecot-sql.conf.ext
new file mode 100644 (file)
index 0000000..8ef9ae7
--- /dev/null
@@ -0,0 +1,4 @@
+driver = mysql
+connect = host=localhost dbname=postfix user=dovecot password=dovecot
+user_query = SELECT concat('/var/spool/vmail/', maildir) as home, concat('maildir:/var/spool/vmail/', maildir) as mail, 101 AS uid, 12 AS gid, concat('maildir:storage=', quota) AS quota, concat('/var/spool/vmail/', maildir) as sieve_dir, concat('/var/spool/vmail/', maildir, 'dovecot.sieve') as sieve FROM mailbox WHERE username = '%u' AND active = '1'
+password_query = SELECT username as user, password, concat('/var/spool/vmail/', maildir) as userdb_home, concat('maildir:/var/spool/vmail/', maildir) as userdb_mail, 101 as userdb_uid, 12 as userdb_gid FROM mailbox WHERE username = '%u' AND active = '1'
diff --git a/dovecot/local.conf b/dovecot/local.conf
new file mode 100644 (file)
index 0000000..d10ccfa
--- /dev/null
@@ -0,0 +1,45 @@
+auth_mechanisms        = plain
+mail_location          = maildir:/var/spool/vmail/%d/%n
+mbox_write_locks       = fcntl
+ssl                    = required
+disable_plaintext_auth = yes
+syslog_facility        = local1
+verbose_proctitle      = yes
+protocols              = imap sieve pop3
+listen                 = *
+
+mail_max_userip_connections = 50
+
+protocol lda {
+  info_log_path      = /var/log/dovecot-lda.log
+  mail_plugins       = quota sieve
+  postmaster_address = postmaster@pley.net
+}
+protocol imap {
+  mail_plugins = quota
+}
+service auth {
+  unix_listener auth-master {
+    mode  = 0660
+    user  = vmail
+    group = mail
+  }
+  unix_listener auth-client {
+    mode  = 0660
+    user  = postfix
+    group = mail
+  }
+  unix_listener auth-userdb {
+    mode  = 0660
+    user  = vmail
+    group = mail
+  }
+}
+passdb {
+  args   = /etc/dovecot/dovecot-sql.conf.ext
+  driver = sql
+}
+userdb {
+  args   = /etc/dovecot/dovecot-sql.conf.ext
+  driver = sql
+}