mirror of
https://github.com/chatmail/relay.git
synced 2026-05-10 16:04:37 +00:00
Run chatmail-metadata and doveauth as vmail
This commit is contained in:
@@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
## untagged
|
## untagged
|
||||||
|
|
||||||
|
- Run chatmail-metadata and doveauth as vmail
|
||||||
|
([#261](https://github.com/deltachat/chatmail/pull/261))
|
||||||
|
|
||||||
- Apply systemd restrictions to echobot
|
- Apply systemd restrictions to echobot
|
||||||
([#259](https://github.com/deltachat/chatmail/pull/259))
|
([#259](https://github.com/deltachat/chatmail/pull/259))
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ from socketserver import (
|
|||||||
StreamRequestHandler,
|
StreamRequestHandler,
|
||||||
ThreadingMixIn,
|
ThreadingMixIn,
|
||||||
)
|
)
|
||||||
import pwd
|
|
||||||
|
|
||||||
from .database import Database
|
from .database import Database
|
||||||
from .config import read_config, Config
|
from .config import read_config, Config
|
||||||
@@ -191,9 +190,8 @@ class ThreadedUnixStreamServer(ThreadingMixIn, UnixStreamServer):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
socket = sys.argv[1]
|
socket = sys.argv[1]
|
||||||
passwd_entry = pwd.getpwnam(sys.argv[2])
|
db = Database(sys.argv[2])
|
||||||
db = Database(sys.argv[3])
|
config = read_config(sys.argv[3])
|
||||||
config = read_config(sys.argv[4])
|
|
||||||
|
|
||||||
class Handler(StreamRequestHandler):
|
class Handler(StreamRequestHandler):
|
||||||
def handle(self):
|
def handle(self):
|
||||||
@@ -209,7 +207,6 @@ def main():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
with ThreadedUnixStreamServer(socket, Handler) as server:
|
with ThreadedUnixStreamServer(socket, Handler) as server:
|
||||||
os.chown(socket, uid=passwd_entry.pw_uid, gid=passwd_entry.pw_gid)
|
|
||||||
try:
|
try:
|
||||||
server.serve_forever()
|
server.serve_forever()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import pwd
|
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from threading import Thread, Event
|
from threading import Thread, Event
|
||||||
from socketserver import (
|
from socketserver import (
|
||||||
@@ -158,8 +156,7 @@ class ThreadedUnixStreamServer(ThreadingMixIn, UnixStreamServer):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
socket, username, vmail_dir = sys.argv[1:]
|
socket, vmail_dir = sys.argv[1:]
|
||||||
passwd_entry = pwd.getpwnam(username)
|
|
||||||
|
|
||||||
vmail_dir = Path(vmail_dir)
|
vmail_dir = Path(vmail_dir)
|
||||||
|
|
||||||
@@ -192,7 +189,6 @@ def main():
|
|||||||
notifier.message_arrived_event.set()
|
notifier.message_arrived_event.set()
|
||||||
|
|
||||||
with ThreadedUnixStreamServer(socket, Handler) as server:
|
with ThreadedUnixStreamServer(socket, Handler) as server:
|
||||||
os.chown(socket, uid=passwd_entry.pw_uid, gid=passwd_entry.pw_gid)
|
|
||||||
try:
|
try:
|
||||||
server.serve_forever()
|
server.serve_forever()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|||||||
@@ -478,6 +478,11 @@ def deploy_chatmail(config_path: Path) -> None:
|
|||||||
system=True,
|
system=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
server.shell(
|
||||||
|
name="Fix file owner in /home/vmail",
|
||||||
|
commands=["test -d /home/vmail && chown -R vmail:vmail /home/vmail"],
|
||||||
|
)
|
||||||
|
|
||||||
apt.update(name="apt update", cache_time=24 * 3600)
|
apt.update(name="apt update", cache_time=24 * 3600)
|
||||||
|
|
||||||
apt.packages(
|
apt.packages(
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
uri = proxy:/run/dovecot/doveauth.socket:auth
|
uri = proxy:/run/doveauth/doveauth.socket:auth
|
||||||
iterate_disable = yes
|
iterate_disable = yes
|
||||||
default_pass_scheme = plain
|
default_pass_scheme = plain
|
||||||
# %E escapes characters " (double quote), ' (single quote) and \ (backslash) with \ (backslash).
|
# %E escapes characters " (double quote), ' (single quote) and \ (backslash) with \ (backslash).
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ mail_privileged_group = vmail
|
|||||||
##
|
##
|
||||||
|
|
||||||
# Pass all IMAP METADATA requests to the server implementing Dovecot's dict protocol.
|
# Pass all IMAP METADATA requests to the server implementing Dovecot's dict protocol.
|
||||||
mail_attribute_dict = proxy:/run/dovecot/metadata.socket:metadata
|
mail_attribute_dict = proxy:/run/chatmail-metadata/metadata.socket:metadata
|
||||||
|
|
||||||
# Enable IMAP COMPRESS (RFC 4978).
|
# Enable IMAP COMPRESS (RFC 4978).
|
||||||
# <https://datatracker.ietf.org/doc/html/rfc4978.html>
|
# <https://datatracker.ietf.org/doc/html/rfc4978.html>
|
||||||
|
|||||||
@@ -2,9 +2,11 @@
|
|||||||
Description=Chatmail dict proxy for IMAP METADATA
|
Description=Chatmail dict proxy for IMAP METADATA
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart={execpath} /run/dovecot/metadata.socket vmail /home/vmail/mail/{mail_domain}
|
ExecStart={execpath} /run/chatmail-metadata/metadata.socket /home/vmail/mail/{mail_domain}
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=30
|
RestartSec=30
|
||||||
|
User=vmail
|
||||||
|
RuntimeDirectory=chatmail-metadata
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|||||||
@@ -2,9 +2,11 @@
|
|||||||
Description=Chatmail dict authentication proxy for dovecot
|
Description=Chatmail dict authentication proxy for dovecot
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart={execpath} /run/dovecot/doveauth.socket vmail /home/vmail/passdb.sqlite {config_path}
|
ExecStart={execpath} /run/doveauth/doveauth.socket /home/vmail/passdb.sqlite {config_path}
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=30
|
RestartSec=30
|
||||||
|
User=vmail
|
||||||
|
RuntimeDirectory=doveauth
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|||||||
Reference in New Issue
Block a user