Switch to using Podop in Dovecot
parent
809fe78f82
commit
b5d6b93869
@ -0,0 +1,5 @@
|
|||||||
|
uri = proxy:/tmp/podop.socket:auth
|
||||||
|
iterate_disable = yes
|
||||||
|
default_pass_scheme = plain
|
||||||
|
password_key = passdb/%u
|
||||||
|
user_key = userdb/%u
|
@ -1,18 +0,0 @@
|
|||||||
driver = sqlite
|
|
||||||
connect = /data/main.db
|
|
||||||
|
|
||||||
# Return the user hashed password
|
|
||||||
password_query = \
|
|
||||||
SELECT NULL as password, 'Y' as nopassword, '{% if POD_ADDRESS_RANGE %}{{ POD_ADDRESS_RANGE }}{% else %}{{ FRONT_ADDRESS }}{% if WEBMAIL_ADDRESS %},{{ WEBMAIL_ADDRESS }}{% endif %}{% endif %}' as allow_nets \
|
|
||||||
FROM user \
|
|
||||||
WHERE user.email = '%u'
|
|
||||||
|
|
||||||
# Mostly get the user quota
|
|
||||||
user_query = \
|
|
||||||
SELECT '*:bytes=' || user.quota_bytes AS quota_rule \
|
|
||||||
FROM user \
|
|
||||||
WHERE user.email = '%u'
|
|
||||||
|
|
||||||
# For using doveadm -A:
|
|
||||||
iterate_query = \
|
|
||||||
SELECT user.email AS user FROM user
|
|
@ -1,43 +0,0 @@
|
|||||||
connect = /data/main.db
|
|
||||||
|
|
||||||
map {
|
|
||||||
pattern = priv/spam_enabled
|
|
||||||
table = user
|
|
||||||
username_field = email
|
|
||||||
value_field = spam_enabled
|
|
||||||
}
|
|
||||||
|
|
||||||
map {
|
|
||||||
pattern = priv/spam_threshold
|
|
||||||
table = user
|
|
||||||
username_field = email
|
|
||||||
value_field = spam_threshold
|
|
||||||
}
|
|
||||||
|
|
||||||
map {
|
|
||||||
pattern = priv/reply_enabled
|
|
||||||
table = user
|
|
||||||
username_field = email
|
|
||||||
value_field = reply_enabled
|
|
||||||
}
|
|
||||||
|
|
||||||
map {
|
|
||||||
pattern = priv/reply_subject
|
|
||||||
table = user
|
|
||||||
username_field = email
|
|
||||||
value_field = reply_subject
|
|
||||||
}
|
|
||||||
|
|
||||||
map {
|
|
||||||
pattern = priv/reply_body
|
|
||||||
table = user
|
|
||||||
username_field = email
|
|
||||||
value_field = reply_body
|
|
||||||
}
|
|
||||||
|
|
||||||
map {
|
|
||||||
pattern = priv/reply_enddate
|
|
||||||
table = user
|
|
||||||
username_field = email
|
|
||||||
value_field = reply_enddate
|
|
||||||
}
|
|
@ -1,21 +1,31 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import jinja2
|
import jinja2
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
import glob
|
import glob
|
||||||
|
import multiprocessing
|
||||||
|
|
||||||
|
from podop import run_server
|
||||||
|
|
||||||
|
|
||||||
|
def start_podop():
|
||||||
|
os.setuid(8)
|
||||||
|
run_server(40, "dovecot", "/tmp/podop.socket", [
|
||||||
|
("quota", "url", "http://admin/internal/dovecot/quota/§"),
|
||||||
|
("auth", "url", "http://admin/internal/dovecot/auth/§"),
|
||||||
|
("sieve", "url", "http://admin/internal/dovecot/sieve/§"),
|
||||||
|
])
|
||||||
|
|
||||||
convert = lambda src, dst: open(dst, "w").write(jinja2.Template(open(src).read()).render(**os.environ))
|
convert = lambda src, dst: open(dst, "w").write(jinja2.Template(open(src).read()).render(**os.environ))
|
||||||
|
|
||||||
# Actual startup script
|
# Actual startup script
|
||||||
os.environ["FRONT_ADDRESS"] = socket.gethostbyname(os.environ.get("FRONT_ADDRESS", "front"))
|
os.environ["FRONT_ADDRESS"] = socket.gethostbyname(os.environ.get("FRONT_ADDRESS", "front"))
|
||||||
os.environ["REDIS_ADDRESS"] = socket.gethostbyname(os.environ.get("REDIS_ADDRESS", "redis"))
|
|
||||||
if os.environ["WEBMAIL"] != "none":
|
|
||||||
os.environ["WEBMAIL_ADDRESS"] = socket.gethostbyname(os.environ.get("WEBMAIL_ADDRESS", "webmail"))
|
|
||||||
|
|
||||||
for dovecot_file in glob.glob("/conf/*"):
|
for dovecot_file in glob.glob("/conf/*"):
|
||||||
convert(dovecot_file, os.path.join("/etc/dovecot", os.path.basename(dovecot_file)))
|
convert(dovecot_file, os.path.join("/etc/dovecot", os.path.basename(dovecot_file)))
|
||||||
|
|
||||||
# Run postfix
|
# Run Podop, then postfix
|
||||||
|
multiprocessing.Process(target=start_podop).start()
|
||||||
os.system("chown -R mail:mail /mail /var/lib/dovecot")
|
os.system("chown -R mail:mail /mail /var/lib/dovecot")
|
||||||
os.execv("/usr/sbin/dovecot", ["dovecot", "-c", "/etc/dovecot/dovecot.conf", "-F"])
|
os.execv("/usr/sbin/dovecot", ["dovecot", "-c", "/etc/dovecot/dovecot.conf", "-F"])
|
||||||
|
Loading…
Reference in New Issue