We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
dovecot: support for zstd/lz4 compression is not compiled in
## Environment & Versions
### Environment
 - [x] docker-compose
 - [ ] kubernetes
 - [ ] docker swarm

### Versions
1.9

## Description
When `COMPRESSION` in `mailu.env` is set to `zstd` or `lz4` and a new mail arrives, the imap container logs something like this:
```
Jan 04 23:32:46 lmtp(mymailaddress@mydomain.com)<32616><kRbzEw7L1GFofwAADGH2HQ>: Error: zlib_save: Support not compiled in for handler: zstd
Jan 04 23:32:46 indexer-worker(mymailaddress@mydomain.com)<32619><D5ZaIcXUkKDAqMsD:Z6zPGQ7L1GFrfwAADGH2HQ>: Error: zlib_save: Support not compiled in for handler: zstd
```

```
Jan 04 23:43:03 imap(mymailaddress@mydomain.com)<178><2CwwXMnUwMXAqMsE>: Error: zlib_save: Support not compiled in for handler: lz4
Jan 04 23:43:03 indexer-worker(mymailaddress@mydomain.com)<180><B4qhJXfN1GGvAAAAflj66Q:/8frM3fN1GG0AAAAflj66Q>: Error: zlib_save: Support not compiled in for handler: lz4
```

As far as I can tell the Dovecot package from Alpine is probably not compiled with zstd/lz4 support, but I'm not sure since the build log of the last Alpine package returns 404 :roll_eyes:

This is __not__ breaking anything, mails will be received, but they won't be compressed.

## Replication Steps
1. in `mailu.env` set `COMPRESSION=zstd` or `COMPRESSION=lz4`
2. `docker-compose down && docker-compose up`
3. send yourself a mail
4. watch the logs of the imap container

## Expected behaviour
With `COMPRESSION=zstd`/`COMPRESSION=lz4` set, mails should be compressed with zstd/lz4 and then stored.

## Workaround
Set `COMPRESSION=gz` if you need compressed mail storage.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `core/postfix/start.py`
Content:
```
1 #!/usr/bin/env python3
2 
3 import os
4 import glob
5 import shutil
6 import multiprocessing
7 import sys
8 import re
9 
10 from podop import run_server
11 from socrate import system, conf
12 
13 system.set_env(log_filters=[
14     r'the Postfix mail system is running\: \d+$',
15     r'(dis)?connect from localhost\[(\:\:1|127\.0\.0\.1)\]( quit=1 commands=1)?$',
16     r'haproxy read\: short protocol header\: QUIT$',
17     r'discarding EHLO keywords\: PIPELINING$',
18     ], log_file=os.environ.get('POSTFIX_LOG_FILE'))
19 
20 os.system("flock -n /queue/pid/master.pid rm /queue/pid/master.pid")
21 
22 def start_podop():
23     system.drop_privs_to('postfix')
24     os.makedirs('/dev/shm/postfix',mode=0o700, exist_ok=True)
25     url = "http://" + os.environ["ADMIN_ADDRESS"] + "/internal/postfix/"
26     # TODO: Remove verbosity setting from Podop?
27     run_server(0, "postfix", "/tmp/podop.socket", [
28         ("transport", "url", url + "transport/§"),
29         ("alias", "url", url + "alias/§"),
30         ("dane", "url", url + "dane/§"),
31         ("domain", "url", url + "domain/§"),
32         ("mailbox", "url", url + "mailbox/§"),
33         ("recipientmap", "url", url + "recipient/map/§"),
34         ("sendermap", "url", url + "sender/map/§"),
35         ("senderlogin", "url", url + "sender/login/§"),
36         ("senderrate", "url", url + "sender/rate/§")
37     ])
38 
39 def start_mta_sts_daemon():
40     os.chmod("/root/", 0o755) # read access to /root/.netrc required
41     system.drop_privs_to('postfix')
42     from postfix_mta_sts_resolver import daemon
43     daemon.main()
44 
45 def is_valid_postconf_line(line):
46     return not line.startswith("#") \
47             and not line == ''
48 
49 # Actual startup script
50 os.environ['DEFER_ON_TLS_ERROR'] = os.environ['DEFER_ON_TLS_ERROR'] if 'DEFER_ON_TLS_ERROR' in os.environ else 'True'
51 
52 # Postfix requires IPv6 addresses to be wrapped in square brackets
53 if 'RELAYNETS' in os.environ:
54     os.environ["RELAYNETS"] = re.sub(r'([0-9a-fA-F]+:[0-9a-fA-F:]+)/', '[\\1]/', os.environ["RELAYNETS"])
55 
56 for postfix_file in glob.glob("/conf/*.cf"):
57     conf.jinja(postfix_file, os.environ, os.path.join("/etc/postfix", os.path.basename(postfix_file)))
58 
59 if os.path.exists("/overrides/postfix.cf"):
60     for line in open("/overrides/postfix.cf").read().strip().split("\n"):
61         if is_valid_postconf_line(line):
62             os.system('postconf -e "{}"'.format(line))
63 
64 if os.path.exists("/overrides/postfix.master"):
65     for line in open("/overrides/postfix.master").read().strip().split("\n"):
66         if is_valid_postconf_line(line):
67             os.system('postconf -Me "{}"'.format(line))
68 
69 for map_file in glob.glob("/overrides/*.map"):
70     destination = os.path.join("/etc/postfix", os.path.basename(map_file))
71     shutil.copyfile(map_file, destination)
72     os.system("postmap {}".format(destination))
73     os.remove(destination)
74 
75 if os.path.exists("/overrides/mta-sts-daemon.yml"):
76     shutil.copyfile("/overrides/mta-sts-daemon.yml", "/etc/mta-sts-daemon.yml")
77 else:
78     conf.jinja("/conf/mta-sts-daemon.yml", os.environ, "/etc/mta-sts-daemon.yml")
79 
80 for policy in ['tls_policy', 'transport']:
81     if not os.path.exists(f'/etc/postfix/{policy}.map.lmdb'):
82         open(f'/etc/postfix/{policy}.map', 'a').close()
83         os.system(f'postmap /etc/postfix/{policy}.map')
84 
85 if "RELAYUSER" in os.environ:
86     path = "/etc/postfix/sasl_passwd"
87     conf.jinja("/conf/sasl_passwd", os.environ, path)
88     os.system("postmap {}".format(path))
89 
90 # Configure logrotate and start crond
91 if os.environ.get('POSTFIX_LOG_FILE'):
92     conf.jinja("/conf/logrotate.conf", os.environ, "/etc/logrotate.d/postfix.conf")
93     os.system("/usr/sbin/crond")
94     if os.path.exists("/overrides/logrotate.conf"):
95         shutil.copyfile("/overrides/logrotate.conf", "/etc/logrotate.d/postfix.conf")
96 
97 # Run Podop and Postfix
98 multiprocessing.Process(target=start_podop).start()
99 multiprocessing.Process(target=start_mta_sts_daemon).start()
100 os.system("/usr/libexec/postfix/post-install meta_directory=/etc/postfix create-missing")
101 # Before starting postfix, we need to check permissions on /queue
102 # in the event that postfix,postdrop id have changed
103 os.system("postfix set-permissions")
104 os.system("postfix start-fg")
105
```

Path: `core/dovecot/start.py`
Content:
```
1 #!/usr/bin/env python3
2 
3 import os
4 import glob
5 import multiprocessing
6 import logging as log
7 import sys
8 
9 from podop import run_server
10 from socrate import system, conf
11 
12 system.set_env(log_filters=r'waitpid\(\) returned unknown PID \d+$')
13 
14 def start_podop():
15     system.drop_privs_to('mail')
16     url = "http://" + os.environ["ADMIN_ADDRESS"] + "/internal/dovecot/§"
17     run_server(0, "dovecot", "/tmp/podop.socket", [
18 		("quota", "url", url ),
19 		("auth", "url", url),
20 		("sieve", "url", url),
21     ])
22 
23 # Actual startup script
24 for dovecot_file in glob.glob("/conf/*.conf"):
25     conf.jinja(dovecot_file, os.environ, os.path.join("/etc/dovecot", os.path.basename(dovecot_file)))
26 
27 os.makedirs("/conf/bin", exist_ok=True)
28 for script_file in glob.glob("/conf/*.script"):
29     out_file = os.path.join("/conf/bin/", os.path.basename(script_file).replace('.script',''))
30     conf.jinja(script_file, os.environ, out_file)
31     os.chmod(out_file, 0o555)
32 
33 # Run Podop, then postfix
34 os.system("chown mail:mail /mail")
35 os.system("chown -R mail:mail /var/lib/dovecot /conf")
36 
37 multiprocessing.Process(target=start_podop).start()
38 os.system("dovecot -c /etc/dovecot/dovecot.conf -F")
39
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/core/dovecot/start.py b/core/dovecot/start.py
--- a/core/dovecot/start.py
+++ b/core/dovecot/start.py
@@ -9,7 +9,7 @@
 from podop import run_server
 from socrate import system, conf
 
-system.set_env(log_filters=r'waitpid\(\) returned unknown PID \d+$')
+system.set_env(log_filters=r'Error\: SSL context initialization failed, disabling SSL\: Can\'t load SSL certificate \(ssl_cert setting\)\: The certificate is empty$')
 
 def start_podop():
     system.drop_privs_to('mail')
diff --git a/core/postfix/start.py b/core/postfix/start.py
--- a/core/postfix/start.py
+++ b/core/postfix/start.py
@@ -11,7 +11,6 @@
 from socrate import system, conf
 
 system.set_env(log_filters=[
-    r'the Postfix mail system is running\: \d+$',
     r'(dis)?connect from localhost\[(\:\:1|127\.0\.0\.1)\]( quit=1 commands=1)?$',
     r'haproxy read\: short protocol header\: QUIT$',
     r'discarding EHLO keywords\: PIPELINING$',

{"golden_diff": "diff --git a/core/dovecot/start.py b/core/dovecot/start.py\n--- a/core/dovecot/start.py\n+++ b/core/dovecot/start.py\n@@ -9,7 +9,7 @@\n from podop import run_server\n from socrate import system, conf\n \n-system.set_env(log_filters=r'waitpid\\(\\) returned unknown PID \\d+$')\n+system.set_env(log_filters=r'Error\\: SSL context initialization failed, disabling SSL\\: Can\\'t load SSL certificate \\(ssl_cert setting\\)\\: The certificate is empty$')\n \n def start_podop():\n     system.drop_privs_to('mail')\ndiff --git a/core/postfix/start.py b/core/postfix/start.py\n--- a/core/postfix/start.py\n+++ b/core/postfix/start.py\n@@ -11,7 +11,6 @@\n from socrate import system, conf\n \n system.set_env(log_filters=[\n-    r'the Postfix mail system is running\\: \\d+$',\n     r'(dis)?connect from localhost\\[(\\:\\:1|127\\.0\\.0\\.1)\\]( quit=1 commands=1)?$',\n     r'haproxy read\\: short protocol header\\: QUIT$',\n     r'discarding EHLO keywords\\: PIPELINING$',\n", "issue": "dovecot: support for zstd/lz4 compression is not compiled in\n## Environment & Versions\r\n### Environment\r\n - [x] docker-compose\r\n - [ ] kubernetes\r\n - [ ] docker swarm\r\n\r\n### Versions\r\n1.9\r\n\r\n## Description\r\nWhen `COMPRESSION` in `mailu.env` is set to `zstd` or `lz4` and a new mail arrives, the imap container logs something like this:\r\n```\r\nJan 04 23:32:46 lmtp(mymailaddress@mydomain.com)<32616><kRbzEw7L1GFofwAADGH2HQ>: Error: zlib_save: Support not compiled in for handler: zstd\r\nJan 04 23:32:46 indexer-worker(mymailaddress@mydomain.com)<32619><D5ZaIcXUkKDAqMsD:Z6zPGQ7L1GFrfwAADGH2HQ>: Error: zlib_save: Support not compiled in for handler: zstd\r\n```\r\n\r\n```\r\nJan 04 23:43:03 imap(mymailaddress@mydomain.com)<178><2CwwXMnUwMXAqMsE>: Error: zlib_save: Support not compiled in for handler: lz4\r\nJan 04 23:43:03 indexer-worker(mymailaddress@mydomain.com)<180><B4qhJXfN1GGvAAAAflj66Q:/8frM3fN1GG0AAAAflj66Q>: Error: zlib_save: Support not compiled in for handler: lz4\r\n```\r\n\r\nAs far as I can tell the Dovecot package from Alpine is probably not compiled with zstd/lz4 support, but I'm not sure since the build log of the last Alpine package returns 404 :roll_eyes:\r\n\r\nThis is __not__ breaking anything, mails will be received, but they won't be compressed.\r\n\r\n## Replication Steps\r\n1. in `mailu.env` set `COMPRESSION=zstd` or `COMPRESSION=lz4`\r\n2. `docker-compose down && docker-compose up`\r\n3. send yourself a mail\r\n4. watch the logs of the imap container\r\n\r\n## Expected behaviour\r\nWith `COMPRESSION=zstd`/`COMPRESSION=lz4` set, mails should be compressed with zstd/lz4 and then stored.\r\n\r\n## Workaround\r\nSet `COMPRESSION=gz` if you need compressed mail storage.\n", "before_files": [{"content": "#!/usr/bin/env python3\n\nimport os\nimport glob\nimport shutil\nimport multiprocessing\nimport sys\nimport re\n\nfrom podop import run_server\nfrom socrate import system, conf\n\nsystem.set_env(log_filters=[\n    r'the Postfix mail system is running\\: \\d+$',\n    r'(dis)?connect from localhost\\[(\\:\\:1|127\\.0\\.0\\.1)\\]( quit=1 commands=1)?$',\n    r'haproxy read\\: short protocol header\\: QUIT$',\n    r'discarding EHLO keywords\\: PIPELINING$',\n    ], log_file=os.environ.get('POSTFIX_LOG_FILE'))\n\nos.system(\"flock -n /queue/pid/master.pid rm /queue/pid/master.pid\")\n\ndef start_podop():\n    system.drop_privs_to('postfix')\n    os.makedirs('/dev/shm/postfix',mode=0o700, exist_ok=True)\n    url = \"http://\" + os.environ[\"ADMIN_ADDRESS\"] + \"/internal/postfix/\"\n    # TODO: Remove verbosity setting from Podop?\n    run_server(0, \"postfix\", \"/tmp/podop.socket\", [\n        (\"transport\", \"url\", url + \"transport/\u00a7\"),\n        (\"alias\", \"url\", url + \"alias/\u00a7\"),\n        (\"dane\", \"url\", url + \"dane/\u00a7\"),\n        (\"domain\", \"url\", url + \"domain/\u00a7\"),\n        (\"mailbox\", \"url\", url + \"mailbox/\u00a7\"),\n        (\"recipientmap\", \"url\", url + \"recipient/map/\u00a7\"),\n        (\"sendermap\", \"url\", url + \"sender/map/\u00a7\"),\n        (\"senderlogin\", \"url\", url + \"sender/login/\u00a7\"),\n        (\"senderrate\", \"url\", url + \"sender/rate/\u00a7\")\n    ])\n\ndef start_mta_sts_daemon():\n    os.chmod(\"/root/\", 0o755) # read access to /root/.netrc required\n    system.drop_privs_to('postfix')\n    from postfix_mta_sts_resolver import daemon\n    daemon.main()\n\ndef is_valid_postconf_line(line):\n    return not line.startswith(\"#\") \\\n            and not line == ''\n\n# Actual startup script\nos.environ['DEFER_ON_TLS_ERROR'] = os.environ['DEFER_ON_TLS_ERROR'] if 'DEFER_ON_TLS_ERROR' in os.environ else 'True'\n\n# Postfix requires IPv6 addresses to be wrapped in square brackets\nif 'RELAYNETS' in os.environ:\n    os.environ[\"RELAYNETS\"] = re.sub(r'([0-9a-fA-F]+:[0-9a-fA-F:]+)/', '[\\\\1]/', os.environ[\"RELAYNETS\"])\n\nfor postfix_file in glob.glob(\"/conf/*.cf\"):\n    conf.jinja(postfix_file, os.environ, os.path.join(\"/etc/postfix\", os.path.basename(postfix_file)))\n\nif os.path.exists(\"/overrides/postfix.cf\"):\n    for line in open(\"/overrides/postfix.cf\").read().strip().split(\"\\n\"):\n        if is_valid_postconf_line(line):\n            os.system('postconf -e \"{}\"'.format(line))\n\nif os.path.exists(\"/overrides/postfix.master\"):\n    for line in open(\"/overrides/postfix.master\").read().strip().split(\"\\n\"):\n        if is_valid_postconf_line(line):\n            os.system('postconf -Me \"{}\"'.format(line))\n\nfor map_file in glob.glob(\"/overrides/*.map\"):\n    destination = os.path.join(\"/etc/postfix\", os.path.basename(map_file))\n    shutil.copyfile(map_file, destination)\n    os.system(\"postmap {}\".format(destination))\n    os.remove(destination)\n\nif os.path.exists(\"/overrides/mta-sts-daemon.yml\"):\n    shutil.copyfile(\"/overrides/mta-sts-daemon.yml\", \"/etc/mta-sts-daemon.yml\")\nelse:\n    conf.jinja(\"/conf/mta-sts-daemon.yml\", os.environ, \"/etc/mta-sts-daemon.yml\")\n\nfor policy in ['tls_policy', 'transport']:\n    if not os.path.exists(f'/etc/postfix/{policy}.map.lmdb'):\n        open(f'/etc/postfix/{policy}.map', 'a').close()\n        os.system(f'postmap /etc/postfix/{policy}.map')\n\nif \"RELAYUSER\" in os.environ:\n    path = \"/etc/postfix/sasl_passwd\"\n    conf.jinja(\"/conf/sasl_passwd\", os.environ, path)\n    os.system(\"postmap {}\".format(path))\n\n# Configure logrotate and start crond\nif os.environ.get('POSTFIX_LOG_FILE'):\n    conf.jinja(\"/conf/logrotate.conf\", os.environ, \"/etc/logrotate.d/postfix.conf\")\n    os.system(\"/usr/sbin/crond\")\n    if os.path.exists(\"/overrides/logrotate.conf\"):\n        shutil.copyfile(\"/overrides/logrotate.conf\", \"/etc/logrotate.d/postfix.conf\")\n\n# Run Podop and Postfix\nmultiprocessing.Process(target=start_podop).start()\nmultiprocessing.Process(target=start_mta_sts_daemon).start()\nos.system(\"/usr/libexec/postfix/post-install meta_directory=/etc/postfix create-missing\")\n# Before starting postfix, we need to check permissions on /queue\n# in the event that postfix,postdrop id have changed\nos.system(\"postfix set-permissions\")\nos.system(\"postfix start-fg\")\n", "path": "core/postfix/start.py"}, {"content": "#!/usr/bin/env python3\n\nimport os\nimport glob\nimport multiprocessing\nimport logging as log\nimport sys\n\nfrom podop import run_server\nfrom socrate import system, conf\n\nsystem.set_env(log_filters=r'waitpid\\(\\) returned unknown PID \\d+$')\n\ndef start_podop():\n    system.drop_privs_to('mail')\n    url = \"http://\" + os.environ[\"ADMIN_ADDRESS\"] + \"/internal/dovecot/\u00a7\"\n    run_server(0, \"dovecot\", \"/tmp/podop.socket\", [\n\t\t(\"quota\", \"url\", url ),\n\t\t(\"auth\", \"url\", url),\n\t\t(\"sieve\", \"url\", url),\n    ])\n\n# Actual startup script\nfor dovecot_file in glob.glob(\"/conf/*.conf\"):\n    conf.jinja(dovecot_file, os.environ, os.path.join(\"/etc/dovecot\", os.path.basename(dovecot_file)))\n\nos.makedirs(\"/conf/bin\", exist_ok=True)\nfor script_file in glob.glob(\"/conf/*.script\"):\n    out_file = os.path.join(\"/conf/bin/\", os.path.basename(script_file).replace('.script',''))\n    conf.jinja(script_file, os.environ, out_file)\n    os.chmod(out_file, 0o555)\n\n# Run Podop, then postfix\nos.system(\"chown mail:mail /mail\")\nos.system(\"chown -R mail:mail /var/lib/dovecot /conf\")\n\nmultiprocessing.Process(target=start_podop).start()\nos.system(\"dovecot -c /etc/dovecot/dovecot.conf -F\")\n", "path": "core/dovecot/start.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n\nimport os\nimport glob\nimport shutil\nimport multiprocessing\nimport sys\nimport re\n\nfrom podop import run_server\nfrom socrate import system, conf\n\nsystem.set_env(log_filters=[\n    r'(dis)?connect from localhost\\[(\\:\\:1|127\\.0\\.0\\.1)\\]( quit=1 commands=1)?$',\n    r'haproxy read\\: short protocol header\\: QUIT$',\n    r'discarding EHLO keywords\\: PIPELINING$',\n    ], log_file=os.environ.get('POSTFIX_LOG_FILE'))\n\nos.system(\"flock -n /queue/pid/master.pid rm /queue/pid/master.pid\")\n\ndef start_podop():\n    system.drop_privs_to('postfix')\n    os.makedirs('/dev/shm/postfix',mode=0o700, exist_ok=True)\n    url = \"http://\" + os.environ[\"ADMIN_ADDRESS\"] + \"/internal/postfix/\"\n    # TODO: Remove verbosity setting from Podop?\n    run_server(0, \"postfix\", \"/tmp/podop.socket\", [\n        (\"transport\", \"url\", url + \"transport/\u00a7\"),\n        (\"alias\", \"url\", url + \"alias/\u00a7\"),\n        (\"dane\", \"url\", url + \"dane/\u00a7\"),\n        (\"domain\", \"url\", url + \"domain/\u00a7\"),\n        (\"mailbox\", \"url\", url + \"mailbox/\u00a7\"),\n        (\"recipientmap\", \"url\", url + \"recipient/map/\u00a7\"),\n        (\"sendermap\", \"url\", url + \"sender/map/\u00a7\"),\n        (\"senderlogin\", \"url\", url + \"sender/login/\u00a7\"),\n        (\"senderrate\", \"url\", url + \"sender/rate/\u00a7\")\n    ])\n\ndef start_mta_sts_daemon():\n    os.chmod(\"/root/\", 0o755) # read access to /root/.netrc required\n    system.drop_privs_to('postfix')\n    from postfix_mta_sts_resolver import daemon\n    daemon.main()\n\ndef is_valid_postconf_line(line):\n    return not line.startswith(\"#\") \\\n            and not line == ''\n\n# Actual startup script\nos.environ['DEFER_ON_TLS_ERROR'] = os.environ['DEFER_ON_TLS_ERROR'] if 'DEFER_ON_TLS_ERROR' in os.environ else 'True'\n\n# Postfix requires IPv6 addresses to be wrapped in square brackets\nif 'RELAYNETS' in os.environ:\n    os.environ[\"RELAYNETS\"] = re.sub(r'([0-9a-fA-F]+:[0-9a-fA-F:]+)/', '[\\\\1]/', os.environ[\"RELAYNETS\"])\n\nfor postfix_file in glob.glob(\"/conf/*.cf\"):\n    conf.jinja(postfix_file, os.environ, os.path.join(\"/etc/postfix\", os.path.basename(postfix_file)))\n\nif os.path.exists(\"/overrides/postfix.cf\"):\n    for line in open(\"/overrides/postfix.cf\").read().strip().split(\"\\n\"):\n        if is_valid_postconf_line(line):\n            os.system('postconf -e \"{}\"'.format(line))\n\nif os.path.exists(\"/overrides/postfix.master\"):\n    for line in open(\"/overrides/postfix.master\").read().strip().split(\"\\n\"):\n        if is_valid_postconf_line(line):\n            os.system('postconf -Me \"{}\"'.format(line))\n\nfor map_file in glob.glob(\"/overrides/*.map\"):\n    destination = os.path.join(\"/etc/postfix\", os.path.basename(map_file))\n    shutil.copyfile(map_file, destination)\n    os.system(\"postmap {}\".format(destination))\n    os.remove(destination)\n\nif os.path.exists(\"/overrides/mta-sts-daemon.yml\"):\n    shutil.copyfile(\"/overrides/mta-sts-daemon.yml\", \"/etc/mta-sts-daemon.yml\")\nelse:\n    conf.jinja(\"/conf/mta-sts-daemon.yml\", os.environ, \"/etc/mta-sts-daemon.yml\")\n\nfor policy in ['tls_policy', 'transport']:\n    if not os.path.exists(f'/etc/postfix/{policy}.map.lmdb'):\n        open(f'/etc/postfix/{policy}.map', 'a').close()\n        os.system(f'postmap /etc/postfix/{policy}.map')\n\nif \"RELAYUSER\" in os.environ:\n    path = \"/etc/postfix/sasl_passwd\"\n    conf.jinja(\"/conf/sasl_passwd\", os.environ, path)\n    os.system(\"postmap {}\".format(path))\n\n# Configure logrotate and start crond\nif os.environ.get('POSTFIX_LOG_FILE'):\n    conf.jinja(\"/conf/logrotate.conf\", os.environ, \"/etc/logrotate.d/postfix.conf\")\n    os.system(\"/usr/sbin/crond\")\n    if os.path.exists(\"/overrides/logrotate.conf\"):\n        shutil.copyfile(\"/overrides/logrotate.conf\", \"/etc/logrotate.d/postfix.conf\")\n\n# Run Podop and Postfix\nmultiprocessing.Process(target=start_podop).start()\nmultiprocessing.Process(target=start_mta_sts_daemon).start()\nos.system(\"/usr/libexec/postfix/post-install meta_directory=/etc/postfix create-missing\")\n# Before starting postfix, we need to check permissions on /queue\n# in the event that postfix,postdrop id have changed\nos.system(\"postfix set-permissions\")\nos.system(\"postfix start-fg\")\n", "path": "core/postfix/start.py"}, {"content": "#!/usr/bin/env python3\n\nimport os\nimport glob\nimport multiprocessing\nimport logging as log\nimport sys\n\nfrom podop import run_server\nfrom socrate import system, conf\n\nsystem.set_env(log_filters=r'Error\\: SSL context initialization failed, disabling SSL\\: Can\\'t load SSL certificate \\(ssl_cert setting\\)\\: The certificate is empty$')\n\ndef start_podop():\n    system.drop_privs_to('mail')\n    url = \"http://\" + os.environ[\"ADMIN_ADDRESS\"] + \"/internal/dovecot/\u00a7\"\n    run_server(0, \"dovecot\", \"/tmp/podop.socket\", [\n\t\t(\"quota\", \"url\", url ),\n\t\t(\"auth\", \"url\", url),\n\t\t(\"sieve\", \"url\", url),\n    ])\n\n# Actual startup script\nfor dovecot_file in glob.glob(\"/conf/*.conf\"):\n    conf.jinja(dovecot_file, os.environ, os.path.join(\"/etc/dovecot\", os.path.basename(dovecot_file)))\n\nos.makedirs(\"/conf/bin\", exist_ok=True)\nfor script_file in glob.glob(\"/conf/*.script\"):\n    out_file = os.path.join(\"/conf/bin/\", os.path.basename(script_file).replace('.script',''))\n    conf.jinja(script_file, os.environ, out_file)\n    os.chmod(out_file, 0o555)\n\n# Run Podop, then postfix\nos.system(\"chown mail:mail /mail\")\nos.system(\"chown -R mail:mail /var/lib/dovecot /conf\")\n\nmultiprocessing.Process(target=start_podop).start()\nos.system(\"dovecot -c /etc/dovecot/dovecot.conf -F\")\n", "path": "core/dovecot/start.py"}]}