mirror of
https://github.com/chatmail/relay.git
synced 2026-05-11 16:34:39 +00:00
Compare commits
1 Commits
privacy-de
...
link2xt/do
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5591920cdc |
2
.github/workflows/test-and-deploy.yaml
vendored
2
.github/workflows/test-and-deploy.yaml
vendored
@@ -56,7 +56,7 @@ jobs:
|
|||||||
# restore acme & dkim state to staging.testrun.org
|
# restore acme & dkim state to staging.testrun.org
|
||||||
rsync -avz acme-restore/acme/ root@staging.testrun.org:/var/lib/acme || true
|
rsync -avz acme-restore/acme/ root@staging.testrun.org:/var/lib/acme || true
|
||||||
rsync -avz dkimkeys-restore/dkimkeys/ root@staging.testrun.org:/etc/dkimkeys || true
|
rsync -avz dkimkeys-restore/dkimkeys/ root@staging.testrun.org:/etc/dkimkeys || true
|
||||||
ssh -o StrictHostKeyChecking=accept-new -v root@staging.testrun.org chown root:root -R /var/lib/acme || true
|
ssh -o StrictHostKeyChecking=accept-new -v root@staging.testrun.org chown root:root -R /var/lib/acme
|
||||||
|
|
||||||
- name: run formatting checks
|
- name: run formatting checks
|
||||||
run: cmdeploy fmt -v
|
run: cmdeploy fmt -v
|
||||||
|
|||||||
15
CHANGELOG.md
15
CHANGELOG.md
@@ -2,21 +2,6 @@
|
|||||||
|
|
||||||
## untagged
|
## untagged
|
||||||
|
|
||||||
- Added a config option for an intro to the privacy policy
|
|
||||||
([#285](https://github.com/deltachat/chatmail/pull/285))
|
|
||||||
|
|
||||||
- Move echobot `into /var/lib/echobot`
|
|
||||||
([#281](https://github.com/deltachat/chatmail/pull/281))
|
|
||||||
|
|
||||||
- Accept Let's Encrypt's new Terms of Services
|
|
||||||
([#275](https://github.com/deltachat/chatmail/pull/276))
|
|
||||||
|
|
||||||
- Reload Dovecot and Postfix when TLS certificate updates
|
|
||||||
([#271](https://github.com/deltachat/chatmail/pull/271))
|
|
||||||
|
|
||||||
- Use forked version of dovecot without hardcoded delays
|
|
||||||
([#270](https://github.com/deltachat/chatmail/pull/270))
|
|
||||||
|
|
||||||
## 1.2.0 - 2024-04-04
|
## 1.2.0 - 2024-04-04
|
||||||
|
|
||||||
- Install dig on the server to resolve DNS records
|
- Install dig on the server to resolve DNS records
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ class Config:
|
|||||||
self.privacy_mail = params.get("privacy_mail")
|
self.privacy_mail = params.get("privacy_mail")
|
||||||
self.privacy_pdo = params.get("privacy_pdo")
|
self.privacy_pdo = params.get("privacy_pdo")
|
||||||
self.privacy_supervisor = params.get("privacy_supervisor")
|
self.privacy_supervisor = params.get("privacy_supervisor")
|
||||||
self.privacy_intro = params.get("privacy_intro")
|
|
||||||
|
|
||||||
def _getbytefile(self):
|
def _getbytefile(self):
|
||||||
return open(self._inipath, "rb")
|
return open(self._inipath, "rb")
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import time
|
|||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import crypt
|
import crypt
|
||||||
from pathlib import Path
|
|
||||||
from socketserver import (
|
from socketserver import (
|
||||||
UnixStreamServer,
|
UnixStreamServer,
|
||||||
StreamRequestHandler,
|
StreamRequestHandler,
|
||||||
@@ -46,32 +45,23 @@ def is_allowed_to_create(config: Config, user, cleartext_password) -> bool:
|
|||||||
return False
|
return False
|
||||||
localpart, domain = parts
|
localpart, domain = parts
|
||||||
|
|
||||||
if localpart == "echo":
|
|
||||||
# echobot account should not be created in the database
|
|
||||||
return False
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
len(localpart) > config.username_max_length
|
len(localpart) > config.username_max_length
|
||||||
or len(localpart) < config.username_min_length
|
or len(localpart) < config.username_min_length
|
||||||
):
|
):
|
||||||
logging.warning(
|
if localpart != "echo":
|
||||||
"localpart %s has to be between %s and %s chars long",
|
logging.warning(
|
||||||
localpart,
|
"localpart %s has to be between %s and %s chars long",
|
||||||
config.username_min_length,
|
localpart,
|
||||||
config.username_max_length,
|
config.username_min_length,
|
||||||
)
|
config.username_max_length,
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def get_user_data(db, config: Config, user):
|
def get_user_data(db, config: Config, user):
|
||||||
if user == f"echo@{config.mail_domain}":
|
|
||||||
return dict(
|
|
||||||
home=f"/home/vmail/mail/{config.mail_domain}/echo@{config.mail_domain}",
|
|
||||||
uid="vmail",
|
|
||||||
gid="vmail",
|
|
||||||
)
|
|
||||||
|
|
||||||
with db.read_connection() as conn:
|
with db.read_connection() as conn:
|
||||||
result = conn.get_user(user)
|
result = conn.get_user(user)
|
||||||
if result:
|
if result:
|
||||||
@@ -86,21 +76,6 @@ def lookup_userdb(db, config: Config, user):
|
|||||||
|
|
||||||
|
|
||||||
def lookup_passdb(db, config: Config, user, cleartext_password):
|
def lookup_passdb(db, config: Config, user, cleartext_password):
|
||||||
if user == f"echo@{config.mail_domain}":
|
|
||||||
# Echobot writes password it wants to log in with into /run/echobot/password
|
|
||||||
try:
|
|
||||||
password = Path("/run/echobot/password").read_text()
|
|
||||||
except Exception:
|
|
||||||
logging.exception("Exception when trying to read /run/echobot/password")
|
|
||||||
return None
|
|
||||||
|
|
||||||
return dict(
|
|
||||||
home=f"/home/vmail/mail/{config.mail_domain}/echo@{config.mail_domain}",
|
|
||||||
uid="vmail",
|
|
||||||
gid="vmail",
|
|
||||||
password=encrypt_password(password),
|
|
||||||
)
|
|
||||||
|
|
||||||
with db.write_transaction() as conn:
|
with db.write_transaction() as conn:
|
||||||
userdata = conn.get_user(user)
|
userdata = conn.get_user(user)
|
||||||
if userdata:
|
if userdata:
|
||||||
|
|||||||
@@ -3,17 +3,14 @@
|
|||||||
|
|
||||||
it will echo back any message that has non-empty text and also supports the /help command.
|
it will echo back any message that has non-empty text and also supports the /help command.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
|
||||||
|
|
||||||
from deltachat_rpc_client import Bot, DeltaChat, EventType, Rpc, events
|
from deltachat_rpc_client import Bot, DeltaChat, EventType, Rpc, events
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from chatmaild.config import read_config
|
|
||||||
from chatmaild.newemail import create_newemail_dict
|
from chatmaild.newemail import create_newemail_dict
|
||||||
|
from chatmaild.config import read_config
|
||||||
|
|
||||||
hooks = events.HookCollection()
|
hooks = events.HookCollection()
|
||||||
|
|
||||||
@@ -78,23 +75,9 @@ def main():
|
|||||||
account = accounts[0] if accounts else deltachat.add_account()
|
account = accounts[0] if accounts else deltachat.add_account()
|
||||||
|
|
||||||
bot = Bot(account, hooks)
|
bot = Bot(account, hooks)
|
||||||
|
|
||||||
config = read_config(sys.argv[1])
|
|
||||||
|
|
||||||
# Create password file
|
|
||||||
if bot.is_configured():
|
|
||||||
password = bot.account.get_config("mail_pw")
|
|
||||||
else:
|
|
||||||
password = create_newemail_dict(config)["password"]
|
|
||||||
Path("/run/echobot/password").write_text(password)
|
|
||||||
|
|
||||||
# Give the user which doveauth runs as access to the password file.
|
|
||||||
subprocess.run(
|
|
||||||
["/usr/bin/setfacl", "-m", "user:vmail:r", "/run/echobot/password"],
|
|
||||||
check=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
if not bot.is_configured():
|
if not bot.is_configured():
|
||||||
|
config = read_config(sys.argv[1])
|
||||||
|
password = create_newemail_dict(config).get("password")
|
||||||
email = "echo@" + config.mail_domain
|
email = "echo@" + config.mail_domain
|
||||||
bot.configure(email, password)
|
bot.configure(email, password)
|
||||||
bot.run_forever()
|
bot.run_forever()
|
||||||
|
|||||||
@@ -61,4 +61,3 @@ privacy_pdo =
|
|||||||
# postal address of the privacy supervisor
|
# postal address of the privacy supervisor
|
||||||
privacy_supervisor =
|
privacy_supervisor =
|
||||||
|
|
||||||
privacy_intro =
|
|
||||||
|
|||||||
@@ -14,7 +14,3 @@ privacy_pdo =
|
|||||||
privacy_supervisor =
|
privacy_supervisor =
|
||||||
State Commissioner for Data Protection and Freedom of Information of
|
State Commissioner for Data Protection and Freedom of Information of
|
||||||
Baden-Württemberg in 70173 Stuttgart, Germany.
|
Baden-Württemberg in 70173 Stuttgart, Germany.
|
||||||
privacy_intro =
|
|
||||||
This is the default onboarding server for Delta Chat.
|
|
||||||
If you don't choose to login to an existing email account,
|
|
||||||
you can get one on this server.
|
|
||||||
|
|||||||
@@ -477,30 +477,12 @@ def deploy_chatmail(config_path: Path) -> None:
|
|||||||
groups=["opendkim"],
|
groups=["opendkim"],
|
||||||
system=True,
|
system=True,
|
||||||
)
|
)
|
||||||
server.user(name="Create echobot user", user="echobot", system=True)
|
|
||||||
|
|
||||||
server.shell(
|
server.shell(
|
||||||
name="Fix file owner in /home/vmail",
|
name="Fix file owner in /home/vmail",
|
||||||
commands=["test -d /home/vmail && chown -R vmail:vmail /home/vmail"],
|
commands=["test -d /home/vmail && chown -R vmail:vmail /home/vmail"],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add our OBS repository for dovecot_no_delay
|
|
||||||
files.put(
|
|
||||||
name = "Add Deltachat OBS GPG key to apt keyring",
|
|
||||||
src = importlib.resources.files(__package__).joinpath("obs-home-deltachat.gpg"),
|
|
||||||
dest = "/etc/apt/keyrings/obs-home-deltachat.gpg",
|
|
||||||
user="root",
|
|
||||||
group="root",
|
|
||||||
mode="644",
|
|
||||||
)
|
|
||||||
|
|
||||||
files.line(
|
|
||||||
name = "Add DeltaChat OBS home repository to sources.list",
|
|
||||||
path = "/etc/apt/sources.list",
|
|
||||||
line = "deb [signed-by=/etc/apt/keyrings/obs-home-deltachat.gpg] https://download.opensuse.org/repositories/home:/deltachat/Debian_12/ ./",
|
|
||||||
ensure_newline = True,
|
|
||||||
)
|
|
||||||
|
|
||||||
apt.update(name="apt update", cache_time=24 * 3600)
|
apt.update(name="apt update", cache_time=24 * 3600)
|
||||||
|
|
||||||
apt.packages(
|
apt.packages(
|
||||||
@@ -531,6 +513,7 @@ def deploy_chatmail(config_path: Path) -> None:
|
|||||||
|
|
||||||
# Deploy acmetool to have TLS certificates.
|
# Deploy acmetool to have TLS certificates.
|
||||||
deploy_acmetool(
|
deploy_acmetool(
|
||||||
|
nginx_hook=True,
|
||||||
domains=[mail_domain, f"mta-sts.{mail_domain}", f"www.{mail_domain}"],
|
domains=[mail_domain, f"mta-sts.{mail_domain}", f"www.{mail_domain}"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from pyinfra import host
|
|||||||
from pyinfra.facts.systemd import SystemdStatus
|
from pyinfra.facts.systemd import SystemdStatus
|
||||||
|
|
||||||
|
|
||||||
def deploy_acmetool(email="", domains=[]):
|
def deploy_acmetool(nginx_hook=False, email="", domains=[]):
|
||||||
"""Deploy acmetool."""
|
"""Deploy acmetool."""
|
||||||
apt.packages(
|
apt.packages(
|
||||||
name="Install acmetool",
|
name="Install acmetool",
|
||||||
@@ -20,13 +20,16 @@ def deploy_acmetool(email="", domains=[]):
|
|||||||
mode="644",
|
mode="644",
|
||||||
)
|
)
|
||||||
|
|
||||||
files.put(
|
if nginx_hook:
|
||||||
src=importlib.resources.files(__package__).joinpath("acmetool.hook").open("rb"),
|
files.put(
|
||||||
dest="/usr/lib/acme/hooks/nginx",
|
src=importlib.resources.files(__package__)
|
||||||
user="root",
|
.joinpath("acmetool.hook")
|
||||||
group="root",
|
.open("rb"),
|
||||||
mode="744",
|
dest="/usr/lib/acme/hooks/nginx",
|
||||||
)
|
user="root",
|
||||||
|
group="root",
|
||||||
|
mode="744",
|
||||||
|
)
|
||||||
|
|
||||||
files.template(
|
files.template(
|
||||||
src=importlib.resources.files(__package__).joinpath("response-file.yaml.j2"),
|
src=importlib.resources.files(__package__).joinpath("response-file.yaml.j2"),
|
||||||
@@ -71,5 +74,5 @@ def deploy_acmetool(email="", domains=[]):
|
|||||||
|
|
||||||
server.shell(
|
server.shell(
|
||||||
name=f"Request certificate for: { ', '.join(domains) }",
|
name=f"Request certificate for: { ', '.join(domains) }",
|
||||||
commands=[f"acmetool want --xlog.severity=debug { ' '.join(domains)}"],
|
commands=[f"acmetool want { ' '.join(domains)}"],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,5 +3,3 @@ set -e
|
|||||||
EVENT_NAME="$1"
|
EVENT_NAME="$1"
|
||||||
[ "$EVENT_NAME" = "live-updated" ] || exit 42
|
[ "$EVENT_NAME" = "live-updated" ] || exit 42
|
||||||
systemctl restart nginx.service
|
systemctl restart nginx.service
|
||||||
systemctl reload dovecot.service
|
|
||||||
systemctl reload postfix.service
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
"acme-enter-email": "{{ email }}"
|
"acme-enter-email": "{{ email }}"
|
||||||
"acme-agreement:https://letsencrypt.org/documents/LE-SA-v1.4-April-3-2024.pdf": true
|
"acme-agreement:https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf": true
|
||||||
|
|||||||
Binary file not shown.
@@ -7,20 +7,6 @@ Environment="PATH={remote_venv_dir}:$PATH"
|
|||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=30
|
RestartSec=30
|
||||||
|
|
||||||
User=echobot
|
|
||||||
Group=echobot
|
|
||||||
|
|
||||||
# Create /var/lib/echobot
|
|
||||||
StateDirectory=echobot
|
|
||||||
|
|
||||||
# Create /run/echobot
|
|
||||||
#
|
|
||||||
# echobot stores /run/echobot/password
|
|
||||||
# with a password there, which doveauth then reads.
|
|
||||||
RuntimeDirectory=echobot
|
|
||||||
|
|
||||||
WorkingDirectory=/var/lib/echobot
|
|
||||||
|
|
||||||
# Apply security restrictions suggested by
|
# Apply security restrictions suggested by
|
||||||
# systemd-analyze security echobot.service
|
# systemd-analyze security echobot.service
|
||||||
CapabilityBoundingSet=
|
CapabilityBoundingSet=
|
||||||
@@ -30,10 +16,7 @@ NoNewPrivileges=true
|
|||||||
PrivateDevices=true
|
PrivateDevices=true
|
||||||
PrivateMounts=true
|
PrivateMounts=true
|
||||||
PrivateTmp=true
|
PrivateTmp=true
|
||||||
|
PrivateUsers=true
|
||||||
# We need to know about doveauth user to give it access to /run/echobot/password
|
|
||||||
PrivateUsers=false
|
|
||||||
|
|
||||||
ProtectClock=true
|
ProtectClock=true
|
||||||
ProtectControlGroups=true
|
ProtectControlGroups=true
|
||||||
ProtectHostname=true
|
ProtectHostname=true
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
# Privacy Policy for {{ config.mail_domain }}
|
# Privacy Policy for {{ config.mail_domain }}
|
||||||
|
|
||||||
{{ config.privacy_intro }}
|
|
||||||
|
|
||||||
We want to show you in a fair and transparent way
|
We want to show you in a fair and transparent way
|
||||||
what personal data is processed by us.
|
what personal data is processed by us.
|
||||||
We follow a strict privacy-by-design approach
|
We follow a strict privacy-by-design approach
|
||||||
|
|||||||
Reference in New Issue
Block a user