Move to Docker Compose and multiple containers
This commit is contained in:
17
dovecot/Dockerfile
Normal file
17
dovecot/Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
||||
FROM alpine
|
||||
|
||||
RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
|
||||
&& echo "@community http://dl-3.alpinelinux.org/alpine/edge/community/" >> /etc/apk/repositories \
|
||||
&& apk add --update \
|
||||
dovecot \
|
||||
dovecot-sqlite \
|
||||
dovecot-pigeonhole-plugin@community \
|
||||
dovecot-antispam-plugin@testing \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
COPY conf /etc/dovecot
|
||||
COPY sieve /var/lib/dovecot
|
||||
|
||||
COPY start.sh /start.sh
|
||||
|
||||
CMD ["/start.sh"]
|
||||
5
dovecot/conf/after.sieve
Normal file
5
dovecot/conf/after.sieve
Normal file
@@ -0,0 +1,5 @@
|
||||
require ["fileinto", "envelope", "mailbox"];
|
||||
|
||||
if header :contains "X-Spam-Flag" "YES" {
|
||||
fileinto :create "Junk";
|
||||
}
|
||||
0
dovecot/conf/default.sieve
Normal file
0
dovecot/conf/default.sieve
Normal file
16
dovecot/conf/dovecot-sql.conf.ext
Normal file
16
dovecot/conf/dovecot-sql.conf.ext
Normal file
@@ -0,0 +1,16 @@
|
||||
driver = sqlite
|
||||
connect = /data/freeposte.db
|
||||
|
||||
# Return the user hashed password
|
||||
password_query = \
|
||||
SELECT password \
|
||||
FROM user INNER JOIN domain ON user.domain_id = domain.id \
|
||||
WHERE domain.name = '%d' \
|
||||
AND user.username = '%n'
|
||||
|
||||
# Mostly get the user quota
|
||||
user_query = \
|
||||
SELECT '*:bytes=' || user.quota_bytes AS quota_rule \
|
||||
FROM user INNER JOIN domain ON user.domain_id = domain.id \
|
||||
WHERE domain.name = '%d' \
|
||||
AND user.username = '%n'
|
||||
143
dovecot/conf/dovecot.conf
Normal file
143
dovecot/conf/dovecot.conf
Normal file
@@ -0,0 +1,143 @@
|
||||
###############
|
||||
# General
|
||||
###############
|
||||
log_path = /dev/stderr
|
||||
protocols = imap lmtp sieve
|
||||
postmaster_address = %{env:POSTMASTER_ADDRESS}
|
||||
hostname = %{env:MAIL_HOSTNAME}
|
||||
mail_plugins = $mail_plugins quota
|
||||
|
||||
service dict {
|
||||
unix_listener dict {
|
||||
group = mail
|
||||
mode = 0660
|
||||
}
|
||||
}
|
||||
|
||||
###############
|
||||
# Mailboxes
|
||||
###############
|
||||
first_valid_gid = 8
|
||||
first_valid_uid = 8
|
||||
mail_location = maildir:/mail/%u
|
||||
mail_home = /mail/%u
|
||||
mail_uid = mail
|
||||
mail_gid = mail
|
||||
mail_privileged_group = mail
|
||||
mail_access_groups = mail
|
||||
|
||||
namespace inbox {
|
||||
inbox = yes
|
||||
mailbox Trash {
|
||||
auto = subscribe
|
||||
special_use = \Trash
|
||||
}
|
||||
mailbox Drafts {
|
||||
auto = subscribe
|
||||
special_use = \Drafts
|
||||
}
|
||||
mailbox Sent {
|
||||
auto = subscribe
|
||||
special_use = \Sent
|
||||
}
|
||||
mailbox Junk {
|
||||
auto = subscribe
|
||||
special_use = \Junk
|
||||
}
|
||||
}
|
||||
|
||||
###############
|
||||
# TLS
|
||||
###############
|
||||
ssl = yes
|
||||
ssl_cert = </certs/cert.pem
|
||||
ssl_key = </certs/key.pem
|
||||
|
||||
###############
|
||||
# Authentication
|
||||
###############
|
||||
auth_mechanisms = plain login
|
||||
|
||||
passdb {
|
||||
driver = sql
|
||||
args = /etc/dovecot/dovecot-sql.conf.ext
|
||||
}
|
||||
|
||||
userdb {
|
||||
driver = sql
|
||||
args = /etc/dovecot/dovecot-sql.conf.ext
|
||||
}
|
||||
|
||||
service auth {
|
||||
user = dovecot
|
||||
unix_listener auth-userdb {
|
||||
}
|
||||
|
||||
inet_listener {
|
||||
port = 2102
|
||||
}
|
||||
}
|
||||
|
||||
service auth-worker {
|
||||
unix_listener auth-worker {
|
||||
user = mail
|
||||
group = $default_internal_user
|
||||
mode = 0660
|
||||
}
|
||||
user = mail
|
||||
}
|
||||
|
||||
###############
|
||||
# IMAP
|
||||
###############
|
||||
|
||||
protocol imap {
|
||||
mail_plugins = $mail_plugins imap_quota
|
||||
}
|
||||
|
||||
service imap-login {
|
||||
inet_listener imap {
|
||||
port = 143
|
||||
}
|
||||
inet_listener imaps {
|
||||
port = 993
|
||||
}
|
||||
}
|
||||
|
||||
###############
|
||||
# Delivery
|
||||
###############
|
||||
|
||||
protocol lmtp {
|
||||
mail_plugins = $mail_plugins sieve
|
||||
recipient_delimiter = +
|
||||
}
|
||||
|
||||
service lmtp {
|
||||
inet_listener lmtp {
|
||||
port = 2525
|
||||
}
|
||||
}
|
||||
|
||||
plugin {
|
||||
quota = maildir:User quota
|
||||
}
|
||||
|
||||
|
||||
###############
|
||||
# Filtering
|
||||
###############
|
||||
|
||||
service managesieve-login {
|
||||
inet_listener sieve {
|
||||
port = 4190
|
||||
}
|
||||
}
|
||||
|
||||
plugin {
|
||||
sieve = ~/.sieve
|
||||
sieve_dir = ~/sieve
|
||||
sieve_before = /var/lib/dovecot/before.sieve
|
||||
sieve_default = /var/lib/dovecot/default.sieve
|
||||
sieve_after = /var/lib/dovecot/after.sieve
|
||||
}
|
||||
0
dovecot/sieve/before.sieve
Normal file
0
dovecot/sieve/before.sieve
Normal file
8
dovecot/start.sh
Executable file
8
dovecot/start.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Fix permissions
|
||||
chown -R mail:mail /mail
|
||||
chown -R mail:mail /var/lib/dovecot
|
||||
|
||||
# Run dovecot
|
||||
exec /usr/sbin/dovecot -c /etc/dovecot/dovecot.conf -F
|
||||
Reference in New Issue
Block a user