mirror of
https://github.com/chatmail/relay.git
synced 2026-05-11 16:34:39 +00:00
Compare commits
2 Commits
metrics
...
link2xt/sc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbf88ff2dd | ||
|
|
507bbd51d3 |
4
.github/CODE_OF_CONDUCT.md
vendored
4
.github/CODE_OF_CONDUCT.md
vendored
@@ -1,4 +0,0 @@
|
|||||||
|
|
||||||
Please refer to
|
|
||||||
[Delta Chat community standards and practices](https://delta.chat/en/community-standards)
|
|
||||||
which also apply for all chatmail developments.
|
|
||||||
21
LICENSE
21
LICENSE
@@ -1,21 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2023, chatmail and delta chat teams
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
178
README.md
178
README.md
@@ -18,7 +18,14 @@ after which the initially specified password is required for using them.
|
|||||||
We subsequently use `CHATMAIL_DOMAIN` as a placeholder for your fully qualified
|
We subsequently use `CHATMAIL_DOMAIN` as a placeholder for your fully qualified
|
||||||
DNS domain name (FQDN), for example `chat.example.org`.
|
DNS domain name (FQDN), for example `chat.example.org`.
|
||||||
|
|
||||||
1. Install the `cmdeploy` command in a virtualenv
|
1. Setup DNS `A` and `AAAA` records for your `CHATMAIL_DOMAIN`.
|
||||||
|
Verify that DNS is set and SSH root login works:
|
||||||
|
|
||||||
|
```
|
||||||
|
ssh root@CHATMAIL_DOMAIN
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Install the `cmdeploy` command in a virtualenv
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/deltachat/chatmail
|
git clone https://github.com/deltachat/chatmail
|
||||||
@@ -26,20 +33,12 @@ DNS domain name (FQDN), for example `chat.example.org`.
|
|||||||
scripts/initenv.sh
|
scripts/initenv.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Create chatmail configuration file `chatmail.ini`:
|
3. Create chatmail configuration file `chatmail.ini`:
|
||||||
|
|
||||||
```
|
```
|
||||||
scripts/cmdeploy init CHATMAIL_DOMAIN
|
scripts/cmdeploy init CHATMAIL_DOMAIN
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Setup first DNS records for your `CHATMAIL_DOMAIN`,
|
|
||||||
according to the hints provided by `cmdeploy init`.
|
|
||||||
Verify that SSH root login works:
|
|
||||||
|
|
||||||
```
|
|
||||||
ssh root@CHATMAIL_DOMAIN
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Deploy to the remote chatmail server:
|
4. Deploy to the remote chatmail server:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -53,106 +52,111 @@ DNS domain name (FQDN), for example `chat.example.org`.
|
|||||||
scripts/cmdeploy dns
|
scripts/cmdeploy dns
|
||||||
```
|
```
|
||||||
|
|
||||||
### Other helpful commands:
|
6. To check status of your remotely running chatmail service:
|
||||||
|
|
||||||
To check the status of your remotely running chatmail service:
|
```
|
||||||
|
scripts/cmdeploy status
|
||||||
|
```
|
||||||
|
|
||||||
```
|
7. To test your chatmail service:
|
||||||
scripts/cmdeploy status
|
|
||||||
|
```
|
||||||
|
scripts/cmdeploy test
|
||||||
|
```
|
||||||
|
|
||||||
|
8. To benchmark your chatmail service:
|
||||||
|
|
||||||
|
```
|
||||||
|
scripts/cmdeploy bench
|
||||||
|
```
|
||||||
|
|
||||||
|
### Refining the web pages
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
scripts/cmdeploy webdev
|
||||||
```
|
```
|
||||||
|
|
||||||
To test whether your chatmail service is working correctly:
|
This starts a local live development cycle for chatmail Web pages:
|
||||||
|
|
||||||
```
|
- uses the `www/src/page-layout.html` file for producing static
|
||||||
scripts/cmdeploy test
|
HTML pages from `www/src/*.md` files
|
||||||
```
|
|
||||||
|
|
||||||
To measure the performance of your chatmail service:
|
- continously builds the web presence reading files from `www/src` directory
|
||||||
|
and generating html files and copying assets to the `www/build` directory.
|
||||||
|
|
||||||
```
|
- Starts a browser window automatically where you can "refresh" as needed.
|
||||||
scripts/cmdeploy bench
|
|
||||||
```
|
|
||||||
|
|
||||||
## Overview of this repository
|
|
||||||
|
|
||||||
This repository drives the development of "chatmail instances",
|
|
||||||
comprised of minimal setups of
|
|
||||||
|
|
||||||
- [postfix smtp server](https://www.postfix.org)
|
|
||||||
- [dovecot imap server](https://www.dovecot.org)
|
|
||||||
|
|
||||||
as well as custom services that are integrated with these two:
|
|
||||||
|
|
||||||
- `chatmaild/src/chatmaild/doveauth.py` implements
|
|
||||||
create-on-login account creation semantics and is used
|
|
||||||
by Dovecot during login authentication and by Postfix
|
|
||||||
which in turn uses [Dovecot SASL](https://doc.dovecot.org/configuration_manual/authentication/dict/#complete-example-for-authenticating-via-a-unix-socket)
|
|
||||||
to authenticate users
|
|
||||||
to send mails for them.
|
|
||||||
|
|
||||||
- `chatmaild/src/chatmaild/filtermail.py` prevents
|
|
||||||
unencrypted e-mail from leaving the chatmail instance
|
|
||||||
and is integrated into postfix's outbound mail pipelines.
|
|
||||||
|
|
||||||
There is also the `cmdeploy/src/cmdeploy/cmdeploy.py` command line tool
|
|
||||||
which helps with setting up and managing the chatmail service.
|
|
||||||
`cmdeploy run` uses [pyinfra-based scripting](https://pyinfra.com/)
|
|
||||||
in `cmdeploy/src/cmdeploy/__init__.py`
|
|
||||||
to automatically install all chatmail components on a server.
|
|
||||||
|
|
||||||
|
|
||||||
### Home page and getting started for users
|
### Home page and getting started for users
|
||||||
|
|
||||||
`cmdeploy run` also creates default static Web pages and deploys them
|
`cmdeploy run` sets up mail services,
|
||||||
to an nginx web server under `https://CHATMAIL_DOMAIN`.
|
and also creates default static Web pages and deploys them:
|
||||||
|
|
||||||
- a default `index.html` along with a QR code that users can click to
|
- a default `index.html` along with a QR code that users can click to
|
||||||
create accounts on your chatmail provider,
|
create accounts on your chatmail provider,
|
||||||
|
|
||||||
- a default `info.html` that is linked from the home page,
|
- a default `info.html` that is linked from the home page,
|
||||||
|
|
||||||
- a default `policy.html` that is linked from the home page.
|
- a default `policy.html` that is linked from the home page.
|
||||||
|
|
||||||
All `.html` files are generated
|
All `.html` files are generated
|
||||||
by the according markdown `.md` file in the `www/src` directory.
|
by the according markdown `.md` file in the `www/src` directory.
|
||||||
|
|
||||||
|
|
||||||
### Refining the web pages
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
scripts/cmdeploy webdev
|
|
||||||
```
|
|
||||||
|
|
||||||
This starts a local live development cycle for chatmail Web pages:
|
|
||||||
|
|
||||||
- uses the `www/src/page-layout.html` file for producing static
|
|
||||||
HTML pages from `www/src/*.md` files
|
|
||||||
|
|
||||||
- continously builds the web presence reading files from `www/src` directory
|
|
||||||
and generating html files and copying assets to the `www/build` directory.
|
|
||||||
|
|
||||||
- Starts a browser window automatically where you can "refresh" as needed.
|
|
||||||
|
|
||||||
|
|
||||||
## Emergency Commands to disable automatic account creation
|
|
||||||
|
|
||||||
If you need to stop account creation,
|
|
||||||
e.g. because some script is wildly creating accounts,
|
|
||||||
login to the server with ssh and run:
|
|
||||||
|
|
||||||
```
|
|
||||||
touch /etc/chatmail-nocreate
|
|
||||||
```
|
|
||||||
|
|
||||||
While this file is present, account creation will be blocked.
|
|
||||||
|
|
||||||
### Ports
|
### Ports
|
||||||
|
|
||||||
Postfix listens on ports 25 (smtp) and 587 (submission) and 465 (submissions).
|
Postfix listens on ports 25 (smtp) and 587 (submission) and 465 (submissions).
|
||||||
Dovecot listens on ports 143(imap) and 993 (imaps).
|
Dovecot listens on ports 143(imap) and 993 (imaps).
|
||||||
|
|
||||||
Delta Chat apps will, however, discover all ports and configurations
|
Delta Chat will, however, discover all ports and configurations
|
||||||
automatically by reading the `autoconfig.xml` file from the chatmail service.
|
automatically by reading the `autoconfig.xml` file from the chatmail instance.
|
||||||
|
|
||||||
|
|
||||||
|
## Emergency Commands to disable automatic account creation
|
||||||
|
|
||||||
|
If you need to stop account creation,
|
||||||
|
e.g. because some script is wildly creating accounts, run:
|
||||||
|
|
||||||
|
touch /etc/chatmail-nocreate
|
||||||
|
|
||||||
|
While this file is present, account creation will be blocked.
|
||||||
|
|
||||||
|
|
||||||
|
## Running tests and benchmarks (offline and online)
|
||||||
|
|
||||||
|
1. Set `CHATMAIL_SSH` so that `ssh root@$CHATMAIL_SSH` allows
|
||||||
|
to login to the chatmail instance server.
|
||||||
|
|
||||||
|
2. To run local and online tests:
|
||||||
|
|
||||||
|
scripts/test.sh
|
||||||
|
|
||||||
|
3. To run benchmarks against your chatmail instance:
|
||||||
|
|
||||||
|
scripts/bench.sh
|
||||||
|
|
||||||
|
|
||||||
|
## Development Background for chatmail instances
|
||||||
|
|
||||||
|
This repository drives the development of "chatmail instances",
|
||||||
|
comprised of minimal setups of
|
||||||
|
|
||||||
|
- [postfix smtp server](https://www.postfix.org)
|
||||||
|
- [dovecot imap server](https://www.dovecot.org)
|
||||||
|
|
||||||
|
as well as two custom services that are integrated with these two:
|
||||||
|
|
||||||
|
- `chatmaild/src/chatmaild/doveauth.py` implements
|
||||||
|
create-on-login account creation semantics and is used
|
||||||
|
by Dovecot during login authentication and by Postfix
|
||||||
|
which in turn uses [Dovecot SASL](https://doc.dovecot.org/configuration_manual/authentication/dict/#complete-example-for-authenticating-via-a-unix-socket)
|
||||||
|
to authenticate users
|
||||||
|
to send mails for them.
|
||||||
|
|
||||||
|
- `chatmaild/src/chatmaild/filtermail.py` prevents
|
||||||
|
unencrypted e-mail from leaving the chatmail instance
|
||||||
|
and is integrated into postfix's outbound mail pipelines.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ version = "0.2"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"aiosmtpd",
|
"aiosmtpd",
|
||||||
"iniconfig",
|
"iniconfig",
|
||||||
"deltachat-rpc-server",
|
|
||||||
"deltachat-rpc-client",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.setuptools]
|
[tool.setuptools]
|
||||||
@@ -21,8 +19,6 @@ where = ['src']
|
|||||||
[project.scripts]
|
[project.scripts]
|
||||||
doveauth = "chatmaild.doveauth:main"
|
doveauth = "chatmaild.doveauth:main"
|
||||||
filtermail = "chatmaild.filtermail:main"
|
filtermail = "chatmaild.filtermail:main"
|
||||||
echobot = "chatmaild.echo:main"
|
|
||||||
chatmail-metrics = "chatmaild.metrics:main"
|
|
||||||
|
|
||||||
[project.entry-points.pytest11]
|
[project.entry-points.pytest11]
|
||||||
"chatmaild.testplugin" = "chatmaild.tests.plugin"
|
"chatmaild.testplugin" = "chatmaild.tests.plugin"
|
||||||
|
|||||||
@@ -46,14 +46,13 @@ def is_allowed_to_create(config: Config, user, cleartext_password) -> bool:
|
|||||||
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
|
||||||
):
|
):
|
||||||
if localpart != "echo":
|
logging.warning(
|
||||||
logging.warning(
|
"localpart %s has to be between %s and %s chars long",
|
||||||
"localpart %s has to be between %s and %s chars long",
|
localpart,
|
||||||
localpart,
|
config.username_min_length,
|
||||||
config.username_min_length,
|
config.username_max_length,
|
||||||
config.username_max_length,
|
)
|
||||||
)
|
return False
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""Advanced echo bot example.
|
|
||||||
|
|
||||||
it will echo back any message that has non-empty text and also supports the /help command.
|
|
||||||
"""
|
|
||||||
import logging
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
from threading import Thread
|
|
||||||
|
|
||||||
from deltachat_rpc_client import Bot, DeltaChat, EventType, Rpc, events
|
|
||||||
|
|
||||||
from chatmaild.newemail import create_newemail_dict
|
|
||||||
from chatmaild.config import read_config
|
|
||||||
|
|
||||||
hooks = events.HookCollection()
|
|
||||||
|
|
||||||
|
|
||||||
@hooks.on(events.RawEvent)
|
|
||||||
def log_event(event):
|
|
||||||
if event.kind == EventType.INFO:
|
|
||||||
logging.info(event.msg)
|
|
||||||
elif event.kind == EventType.WARNING:
|
|
||||||
logging.warning(event.msg)
|
|
||||||
|
|
||||||
|
|
||||||
@hooks.on(events.RawEvent(EventType.ERROR))
|
|
||||||
def log_error(event):
|
|
||||||
logging.error(event.msg)
|
|
||||||
|
|
||||||
|
|
||||||
@hooks.on(events.MemberListChanged)
|
|
||||||
def on_memberlist_changed(event):
|
|
||||||
logging.info(
|
|
||||||
"member %s was %s", event.member, "added" if event.member_added else "removed"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@hooks.on(events.GroupImageChanged)
|
|
||||||
def on_group_image_changed(event):
|
|
||||||
logging.info("group image %s", "deleted" if event.image_deleted else "changed")
|
|
||||||
|
|
||||||
|
|
||||||
@hooks.on(events.GroupNameChanged)
|
|
||||||
def on_group_name_changed(event):
|
|
||||||
logging.info("group name changed, old name: %s", event.old_name)
|
|
||||||
|
|
||||||
|
|
||||||
@hooks.on(events.NewMessage(func=lambda e: not e.command))
|
|
||||||
def echo(event):
|
|
||||||
snapshot = event.message_snapshot
|
|
||||||
if snapshot.text or snapshot.file:
|
|
||||||
snapshot.chat.send_message(text=snapshot.text, file=snapshot.file)
|
|
||||||
|
|
||||||
|
|
||||||
@hooks.on(events.NewMessage(command="/help"))
|
|
||||||
def help_command(event):
|
|
||||||
snapshot = event.message_snapshot
|
|
||||||
snapshot.chat.send_text("Send me any message and I will echo it back")
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
path = os.environ.get("PATH")
|
|
||||||
venv_path = sys.argv[0].strip("echobot")
|
|
||||||
os.environ["PATH"] = path + ":" + venv_path
|
|
||||||
with Rpc() as rpc:
|
|
||||||
deltachat = DeltaChat(rpc)
|
|
||||||
system_info = deltachat.get_system_info()
|
|
||||||
logging.info("Running deltachat core %s", system_info.deltachat_core_version)
|
|
||||||
|
|
||||||
accounts = deltachat.get_all_accounts()
|
|
||||||
account = accounts[0] if accounts else deltachat.add_account()
|
|
||||||
|
|
||||||
bot = Bot(account, hooks)
|
|
||||||
if not bot.is_configured():
|
|
||||||
config = read_config(sys.argv[1])
|
|
||||||
password = create_newemail_dict(config).get("password")
|
|
||||||
email = "echo@" + config.mail_domain
|
|
||||||
configure_thread = Thread(
|
|
||||||
target=bot.configure, kwargs={"email": email, "password": password}
|
|
||||||
)
|
|
||||||
configure_thread.start()
|
|
||||||
bot.run_forever()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
logging.basicConfig(level=logging.INFO)
|
|
||||||
main()
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Chatmail echo bot for testing it works
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart={execpath} {config_path}
|
|
||||||
Environment="PATH={remote_venv_dir}:$PATH"
|
|
||||||
Restart=always
|
|
||||||
RestartSec=30
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
from pathlib import Path
|
|
||||||
import time
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
vmail_dir = sys.argv[1]
|
|
||||||
accounts = 0
|
|
||||||
ci_accounts = 0
|
|
||||||
|
|
||||||
for path in Path(vmail_dir).iterdir():
|
|
||||||
accounts += 1
|
|
||||||
if path.name.startswith("ci-"):
|
|
||||||
ci_accounts += 1
|
|
||||||
|
|
||||||
timestamp = int(time.time() * 1000)
|
|
||||||
print(f"accounts {accounts} {timestamp}")
|
|
||||||
print(f"ci_accounts {ci_accounts} {timestamp}")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -4,22 +4,16 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
import secrets
|
|
||||||
import string
|
|
||||||
|
|
||||||
from chatmaild.config import read_config, Config
|
from chatmaild.config import read_config, Config
|
||||||
|
|
||||||
CONFIG_PATH = "/usr/local/lib/chatmaild/chatmail.ini"
|
CONFIG_PATH = "/usr/local/lib/chatmaild/chatmail.ini"
|
||||||
ALPHANUMERIC = string.ascii_lowercase + string.digits
|
|
||||||
ALPHANUMERIC_PUNCT = string.ascii_letters + string.digits + string.punctuation
|
|
||||||
|
|
||||||
|
|
||||||
def create_newemail_dict(config: Config):
|
def create_newemail_dict(config: Config):
|
||||||
user = "".join(random.choices(ALPHANUMERIC, k=config.username_min_length))
|
alphanumeric = "abcdefghijklmnopqrstuvwxyz1234567890"
|
||||||
password = "".join(
|
user = "".join(random.choices(alphanumeric, k=config.username_min_length))
|
||||||
secrets.choice(ALPHANUMERIC_PUNCT)
|
password = "".join(random.choices(alphanumeric, k=config.password_min_length + 3))
|
||||||
for _ in range(config.password_min_length + 3)
|
|
||||||
)
|
|
||||||
return dict(email=f"{user}@{config.mail_domain}", password=f"{password}")
|
return dict(email=f"{user}@{config.mail_domain}", password=f"{password}")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -84,28 +84,14 @@ def _install_remote_venv_with_chatmaild(config) -> None:
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
files.template(
|
|
||||||
src=importlib.resources.files(__package__).joinpath("metrics.cron.j2"),
|
|
||||||
dest="/etc/cron.d/chatmail-metrics",
|
|
||||||
user="root",
|
|
||||||
group="root",
|
|
||||||
mode="644",
|
|
||||||
config={
|
|
||||||
"mail_domain": config.mail_domain,
|
|
||||||
"execpath": f"{remote_venv_dir}/bin/chatmail-metrics",
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
# install systemd units
|
# install systemd units
|
||||||
for fn in (
|
for fn in (
|
||||||
"doveauth",
|
"doveauth",
|
||||||
"filtermail",
|
"filtermail",
|
||||||
"echobot",
|
|
||||||
):
|
):
|
||||||
params = dict(
|
params = dict(
|
||||||
execpath=f"{remote_venv_dir}/bin/{fn}",
|
execpath=f"{remote_venv_dir}/bin/{fn}",
|
||||||
config_path=remote_chatmail_inipath,
|
config_path=remote_chatmail_inipath,
|
||||||
remote_venv_dir=remote_venv_dir,
|
|
||||||
)
|
)
|
||||||
source_path = importlib.resources.files("chatmaild").joinpath(f"{fn}.service.f")
|
source_path = importlib.resources.files("chatmaild").joinpath(f"{fn}.service.f")
|
||||||
content = source_path.read_text().format(**params).encode()
|
content = source_path.read_text().format(**params).encode()
|
||||||
@@ -392,20 +378,6 @@ def deploy_chatmail(mail_domain: str, mail_server: str, dkim_selector: str) -> N
|
|||||||
system=True,
|
system=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Run local DNS resolver `unbound`.
|
|
||||||
# `resolvconf` takes care of setting up /etc/resolv.conf
|
|
||||||
# to use 127.0.0.1 as the resolver.
|
|
||||||
apt.packages(
|
|
||||||
name="Install unbound",
|
|
||||||
packages="unbound",
|
|
||||||
)
|
|
||||||
systemd.service(
|
|
||||||
name="Start and enable unbound",
|
|
||||||
service="unbound.service",
|
|
||||||
running=True,
|
|
||||||
enabled=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Deploy acmetool to have TLS certificates.
|
# Deploy acmetool to have TLS certificates.
|
||||||
deploy_acmetool(nginx_hook=True, domains=[mail_server, f"mta-sts.{mail_server}"])
|
deploy_acmetool(nginx_hook=True, domains=[mail_server, f"mta-sts.{mail_server}"])
|
||||||
|
|
||||||
|
|||||||
@@ -130,15 +130,7 @@ def test_cmd(args, out):
|
|||||||
out.check_call(f"{sys.executable} -m pip install deltachat")
|
out.check_call(f"{sys.executable} -m pip install deltachat")
|
||||||
|
|
||||||
pytest_path = shutil.which("pytest")
|
pytest_path = shutil.which("pytest")
|
||||||
pytest_args = [
|
pytest_args = [pytest_path, "cmdeploy/src/", "-n4", "-rs", "-x", "-vrx", "--durations=5"]
|
||||||
pytest_path,
|
|
||||||
"cmdeploy/src/",
|
|
||||||
"-n4",
|
|
||||||
"-rs",
|
|
||||||
"-x",
|
|
||||||
"-vrx",
|
|
||||||
"--durations=5",
|
|
||||||
]
|
|
||||||
if args.slow:
|
if args.slow:
|
||||||
pytest_args.append("--slow")
|
pytest_args.append("--slow")
|
||||||
ret = out.run_ret(pytest_args)
|
ret = out.run_ret(pytest_args)
|
||||||
@@ -163,7 +155,7 @@ def fmt_cmd_options(parser):
|
|||||||
|
|
||||||
|
|
||||||
def fmt_cmd(args, out):
|
def fmt_cmd(args, out):
|
||||||
"""Run formattting fixes (ruff and black) on all chatmail source code."""
|
"""Run formattting fixes (fuff and black) on all chatmail source code."""
|
||||||
|
|
||||||
sources = [str(importlib.resources.files(x)) for x in ("chatmaild", "cmdeploy")]
|
sources = [str(importlib.resources.files(x)) for x in ("chatmaild", "cmdeploy")]
|
||||||
black_args = [shutil.which("black")]
|
black_args = [shutil.which("black")]
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
*/5 * * * * root {{ config.execpath }} /home/vmail/mail/{{ config.mail_domain }} >/var/www/html/metrics
|
|
||||||
@@ -41,10 +41,6 @@ http {
|
|||||||
try_files $uri $uri/ =404;
|
try_files $uri $uri/ =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /metrics {
|
|
||||||
default_type text/plain;
|
|
||||||
}
|
|
||||||
|
|
||||||
# add cgi-bin support
|
# add cgi-bin support
|
||||||
include /usr/share/doc/fcgiwrap/examples/nginx.conf;
|
include /usr/share/doc/fcgiwrap/examples/nginx.conf;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,31 +30,31 @@ def test_login_smtp(benchmark, smtp, gencreds):
|
|||||||
|
|
||||||
class TestDC:
|
class TestDC:
|
||||||
def test_autoconfigure(self, benchmark, cmfactory):
|
def test_autoconfigure(self, benchmark, cmfactory):
|
||||||
def dc_autoconfig_and_idle_ready():
|
def autoconfig_and_idle_ready():
|
||||||
cmfactory.get_online_accounts(1)
|
cmfactory.get_online_accounts(1)
|
||||||
|
|
||||||
benchmark(dc_autoconfig_and_idle_ready, 5)
|
benchmark(autoconfig_and_idle_ready, 5)
|
||||||
|
|
||||||
def test_ping_pong(self, benchmark, cmfactory):
|
def test_ping_pong(self, benchmark, cmfactory):
|
||||||
ac1, ac2 = cmfactory.get_online_accounts(2)
|
ac1, ac2 = cmfactory.get_online_accounts(2)
|
||||||
chat = cmfactory.get_accepted_chat(ac1, ac2)
|
chat = cmfactory.get_accepted_chat(ac1, ac2)
|
||||||
|
|
||||||
def dc_ping_pong():
|
def ping_pong():
|
||||||
chat.send_text("ping")
|
chat.send_text("ping")
|
||||||
msg = ac2.wait_next_incoming_message()
|
msg = ac2.wait_next_incoming_message()
|
||||||
msg.chat.send_text("pong")
|
msg.chat.send_text("pong")
|
||||||
ac1.wait_next_incoming_message()
|
ac1.wait_next_incoming_message()
|
||||||
|
|
||||||
benchmark(dc_ping_pong, 5)
|
benchmark(ping_pong, 5)
|
||||||
|
|
||||||
def test_send_10_receive_10(self, benchmark, cmfactory, lp):
|
def test_send_10_receive_10(self, benchmark, cmfactory, lp):
|
||||||
ac1, ac2 = cmfactory.get_online_accounts(2)
|
ac1, ac2 = cmfactory.get_online_accounts(2)
|
||||||
chat = cmfactory.get_accepted_chat(ac1, ac2)
|
chat = cmfactory.get_accepted_chat(ac1, ac2)
|
||||||
|
|
||||||
def dc_send_10_receive_10():
|
def send_10_receive_10():
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
chat.send_text(f"hello {i}")
|
chat.send_text(f"hello {i}")
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
ac2.wait_next_incoming_message()
|
ac2.wait_next_incoming_message()
|
||||||
|
|
||||||
benchmark(dc_send_10_receive_10, 5)
|
benchmark(send_10_receive_10, 5)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class TestEndToEndDeltaChat:
|
|||||||
Example input: 100M, 2.4T, 500 K
|
Example input: 100M, 2.4T, 500 K
|
||||||
"""
|
"""
|
||||||
units = {"B": 1, "K": 2**10, "M": 2**20, "G": 2**30, "T": 2**40}
|
units = {"B": 1, "K": 2**10, "M": 2**20, "G": 2**30, "T": 2**40}
|
||||||
size = re.sub(r"([KMGT])", r" \1", limit.upper())
|
size = re.sub(r'([KMGT])', r' \1', limit.upper())
|
||||||
number, unit = [string.strip() for string in size.split()]
|
number, unit = [string.strip() for string in size.split()]
|
||||||
return int(float(number) * units[unit])
|
return int(float(number) * units[unit])
|
||||||
|
|
||||||
|
|||||||
@@ -36,53 +36,6 @@ def build_webpages(src_dir, build_dir, config):
|
|||||||
print(traceback.format_exc())
|
print(traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
def timespan_to_english(timespan):
|
|
||||||
val = int(timespan[:-1])
|
|
||||||
c = timespan[-1].lower()
|
|
||||||
match c:
|
|
||||||
case "y":
|
|
||||||
return f"{val} years"
|
|
||||||
case "m":
|
|
||||||
return f"{val} months"
|
|
||||||
case "w":
|
|
||||||
return f"{val} weeks"
|
|
||||||
case "d":
|
|
||||||
return f"{val} days"
|
|
||||||
case "h":
|
|
||||||
return f"{val} hours"
|
|
||||||
case "c":
|
|
||||||
return f"{val} seconds"
|
|
||||||
case _:
|
|
||||||
raise ValueError(
|
|
||||||
c
|
|
||||||
+ " is not a valid time unit. Try [y]ears, [w]eeks, [d]ays, or [h]ours"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def int_to_english(number):
|
|
||||||
if number >= 0 and number <= 12:
|
|
||||||
a = [
|
|
||||||
"zero",
|
|
||||||
"one",
|
|
||||||
"two",
|
|
||||||
"three",
|
|
||||||
"four",
|
|
||||||
"five",
|
|
||||||
"six",
|
|
||||||
"seven",
|
|
||||||
"eight",
|
|
||||||
"nine",
|
|
||||||
"ten",
|
|
||||||
"eleven",
|
|
||||||
"twelve",
|
|
||||||
]
|
|
||||||
return a[number]
|
|
||||||
elif number <= 50:
|
|
||||||
return str(number)
|
|
||||||
if number > 50:
|
|
||||||
return "more"
|
|
||||||
|
|
||||||
|
|
||||||
def _build_webpages(src_dir, build_dir, config):
|
def _build_webpages(src_dir, build_dir, config):
|
||||||
mail_domain = config.mail_domain
|
mail_domain = config.mail_domain
|
||||||
assert src_dir.exists(), src_dir
|
assert src_dir.exists(), src_dir
|
||||||
@@ -95,18 +48,6 @@ def _build_webpages(src_dir, build_dir, config):
|
|||||||
for path in src_dir.iterdir():
|
for path in src_dir.iterdir():
|
||||||
if path.suffix == ".md":
|
if path.suffix == ".md":
|
||||||
render_vars, content = prepare_template(path)
|
render_vars, content = prepare_template(path)
|
||||||
render_vars["username_min_length"] = int_to_english(
|
|
||||||
config.username_min_length
|
|
||||||
)
|
|
||||||
render_vars["username_max_length"] = int_to_english(
|
|
||||||
config.username_max_length
|
|
||||||
)
|
|
||||||
render_vars["password_min_length"] = int_to_english(
|
|
||||||
config.password_min_length
|
|
||||||
)
|
|
||||||
render_vars["delete_mails_after"] = timespan_to_english(
|
|
||||||
config.delete_mails_after
|
|
||||||
)
|
|
||||||
target = build_dir.joinpath(path.stem + ".html")
|
target = build_dir.joinpath(path.stem + ".html")
|
||||||
|
|
||||||
# recursive jinja2 rendering
|
# recursive jinja2 rendering
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ Welcome to instant, interoperable and [privacy-preserving](privacy.html) messagi
|
|||||||
|
|
||||||
💬 **Start** chatting with any Delta Chat contacts using [QR invite codes](https://delta.chat/en/help#howtoe2ee)
|
💬 **Start** chatting with any Delta Chat contacts using [QR invite codes](https://delta.chat/en/help#howtoe2ee)
|
||||||
|
|
||||||
{% if config.mail_domain != "nine.testrun.org" %}
|
<div class="experimental">Note: this is an experimental service</div>
|
||||||
<div class="experimental">Note: this is only a temporary development chatmail service</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,32 +3,16 @@
|
|||||||
|
|
||||||
## More information
|
## More information
|
||||||
|
|
||||||
`nine.testrun.org` provides a low-maintenance, resource efficient and
|
|
||||||
interoperable e-mail service for everyone. What's behind a `chatmail` is
|
|
||||||
effectively a normal e-mail address just like any other but optimized
|
|
||||||
for the usage in chats, especially DeltaChat.
|
|
||||||
|
|
||||||
### Choosing a chatmail address instead of using a random one
|
### Choosing a chatmail address instead of using a random one
|
||||||
|
|
||||||
In the Delta Chat account setup
|
In the Delta Chat account setup
|
||||||
you may tap `LOG INTO YOUR E-MAIL ACCOUNT`
|
you may tap `LOG INTO YOUR E-MAIL ACCOUNT`
|
||||||
and fill the two fields like this:
|
and fill the two fields like this:
|
||||||
|
|
||||||
- `Address`: invent a word with
|
- `Address`: invent a word with *exactly* nine characters
|
||||||
{% if username_min_length == username_max_length %}
|
and append `@{{config.mail_domain}}` to it.
|
||||||
*exactly* {{ username_min_length }}
|
|
||||||
{% else %}
|
|
||||||
{{ username_min_length}}
|
|
||||||
{% if username_max_length == "more" %}
|
|
||||||
or more
|
|
||||||
{% else %}
|
|
||||||
to {{ username_max_length }}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
characters
|
|
||||||
and append `@{{config.mail_domain}}` to it.
|
|
||||||
|
|
||||||
- `Password`: invent at least {{ password_min_length }} characters.
|
- `Password`: invent at least 9 characters.
|
||||||
|
|
||||||
If the e-mail address is not yet taken, you'll get that account.
|
If the e-mail address is not yet taken, you'll get that account.
|
||||||
The first login sets your password.
|
The first login sets your password.
|
||||||
@@ -40,11 +24,11 @@ The first login sets your password.
|
|||||||
{{config.mail_domain}} but setting up contact via [QR invite codes](https://delta.chat/en/help#howtoe2ee)
|
{{config.mail_domain}} but setting up contact via [QR invite codes](https://delta.chat/en/help#howtoe2ee)
|
||||||
allows your messages to pass freely to any outside recipients.
|
allows your messages to pass freely to any outside recipients.
|
||||||
|
|
||||||
- You may send up to {{ config.max_user_send_per_minute }} messages per minute.
|
- You may send up to 60 messages per minute
|
||||||
|
|
||||||
- Seen messages are removed {{ delete_mails_after }} after arriving on the server.
|
- Seen messages are removed 40 days after arriving on the server
|
||||||
|
|
||||||
- You can store up to [{{ config.max_mailbox_size }} messages on the server](https://delta.chat/en/help#what-happens-if-i-turn-on-delete-old-messages-from-server).
|
- You can store up to [100MB messages on the server](https://delta.chat/en/help#what-happens-if-i-turn-on-delete-old-messages-from-server)
|
||||||
|
|
||||||
|
|
||||||
### Who are the operators? Which software is running?
|
### Who are the operators? Which software is running?
|
||||||
|
|||||||
@@ -1,47 +1,4 @@
|
|||||||
|
|
||||||
body {
|
|
||||||
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
|
|
||||||
line-height: 1.4;
|
|
||||||
font-size: 1.2em;
|
|
||||||
max-width: 800px;
|
|
||||||
margin: 20px auto;
|
|
||||||
padding: 0 10px;
|
|
||||||
color: #363636;
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 2.2em;
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1, h2, h3, h4, h5, h6 {
|
|
||||||
color: #000;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
margin-top: 24px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
text-decoration: none;
|
|
||||||
color: #0076d1;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
img, video {
|
|
||||||
max-width: 100%;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
code {
|
|
||||||
background: #efefef;
|
|
||||||
padding: 2.5px 5px;
|
|
||||||
border-radius: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#menu {
|
#menu {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
{% if config.webdev %}
|
{% if config.webdev %}
|
||||||
<meta http-equiv="refresh" content="3">
|
<meta http-equiv="refresh" content="3">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
|
|
||||||
<title>{{ config.mail_domain }} {{ pagename }}</title>
|
<title>{{ config.mail_domain }} {{ pagename }}</title>
|
||||||
|
<link rel="stylesheet" href="./water.css">
|
||||||
<link rel="stylesheet" href="./main.css">
|
<link rel="stylesheet" href="./main.css">
|
||||||
<link rel="icon" href="/logo.svg">
|
<link rel="icon" href="/logo.svg">
|
||||||
<link rel=”mask-icon” href=”/logo.svg” color=”#000000">
|
<link rel=”mask-icon” href=”/logo.svg” color=”#000000">
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ we process the following data and details:
|
|||||||
Creating an account happens in one of two ways on our mail servers:
|
Creating an account happens in one of two ways on our mail servers:
|
||||||
|
|
||||||
- with a QR invitation token
|
- with a QR invitation token
|
||||||
which is scanned using the Delta Chat app
|
which is scanned using the DeltaChat app
|
||||||
and then the account is created.
|
and then the account is created.
|
||||||
|
|
||||||
- by letting Delta Chat otherwise create an account
|
- by letting Delta Chat otherwise create an account
|
||||||
@@ -218,16 +218,97 @@ on these or possible objections.
|
|||||||
A deletion can be made
|
A deletion can be made
|
||||||
directly in the Delta Chat email messenger.
|
directly in the Delta Chat email messenger.
|
||||||
|
|
||||||
If you have any questions or complaints,
|
a) request information about your personal data processed by us
|
||||||
please feel free to contact us by email:
|
in accordance with Art. 15 GDPR.
|
||||||
{{ config.privacy_mail }}
|
In particular,
|
||||||
|
you can request information about the processing purposes,
|
||||||
|
the category of personal data,
|
||||||
|
the categories of recipients to whom your data have been or will be disclosed,
|
||||||
|
the planned storage period,
|
||||||
|
the existence of a right to rectification, erasure, restriction of processing or objection,
|
||||||
|
the existence of a right of complaint,
|
||||||
|
the origin of your data if it has not been collected by us,
|
||||||
|
as well as the existence of automated decision-making including profiling
|
||||||
|
and, if applicable,
|
||||||
|
meaningful information about its details;
|
||||||
|
|
||||||
As a rule, you can contact the supervisory authority of your usual place of residence
|
b) in accordance with Art. 16 of the GDPR,
|
||||||
|
immediately request the correction
|
||||||
|
of inaccurate or incomplete personal data stored by us;
|
||||||
|
|
||||||
|
c) pursuant to Article 17 of the GDPR,
|
||||||
|
to request the erasure of your personal data stored by us,
|
||||||
|
unless the processing is necessary
|
||||||
|
for the exercise of the right to freedom of expression and information,
|
||||||
|
for compliance with a legal obligation,
|
||||||
|
for reasons of public interest,
|
||||||
|
or for the establishment, exercise or defence of legal claims;
|
||||||
|
|
||||||
|
d) pursuant to Art. 18 GDPR,
|
||||||
|
to request the restriction of the processing of your personal data,
|
||||||
|
insofar as the accuracy of the data is disputed by you,
|
||||||
|
the processing is unlawful,
|
||||||
|
but you object to its erasure
|
||||||
|
and we no longer require the data,
|
||||||
|
but you need it for the assertion, exercise or defence of legal claims
|
||||||
|
or you have objected to the processing pursuant to Art. 21 GDPR;
|
||||||
|
|
||||||
|
e) pursuant to Art. 20 GDPR,
|
||||||
|
to receive your personal data that you have provided to us
|
||||||
|
in a structured, common and machine-readable format
|
||||||
|
or to request that it be transferred to another controller;
|
||||||
|
|
||||||
|
f) in accordance with Art. 7 (3) of the GDPR,
|
||||||
|
to revoke your consent given to us at any time.
|
||||||
|
This has the consequence that we may no longer continue the data processing
|
||||||
|
based on this consent in the future; and
|
||||||
|
|
||||||
|
g) complain to a supervisory authority
|
||||||
|
in accordance with Article 77 of the GDPR.
|
||||||
|
As a rule,
|
||||||
|
you can contact the supervisory authority of your usual place of residence
|
||||||
or workplace
|
or workplace
|
||||||
or our registered office for this purpose.
|
or our registered office for this purpose.
|
||||||
The supervisory authority responsible for our place of business
|
The supervisory authority responsible for our place of business
|
||||||
is the `{{ config.privacy_supervisor }}`.
|
is the `{{ config.privacy_supervisor }}`.
|
||||||
|
|
||||||
|
If you have any questions or complaints, please feel free to contact us by email:
|
||||||
|
{{ config.privacy_mail }}
|
||||||
|
|
||||||
|
|
||||||
|
### 5.1 Right to object
|
||||||
|
|
||||||
|
If your personal data is processed on the basis of our legitimate interests
|
||||||
|
in accordance with Art. 6 (1) lit. f GDPR,
|
||||||
|
you have the right to object to the processing of your personal data
|
||||||
|
in accordance with Art. 21 GDPR,
|
||||||
|
provided that there are grounds for this based on your particular situation
|
||||||
|
or the objection is directed against direct advertising.
|
||||||
|
In the latter case,
|
||||||
|
you have a general right of objection,
|
||||||
|
which will be implemented by us
|
||||||
|
without specifying a particular situation.
|
||||||
|
|
||||||
|
If you wish to exercise your right of objection,
|
||||||
|
simply send an e-mail to: {{ config.privacy_mail }}
|
||||||
|
|
||||||
|
### 5.2 Right to withdraw
|
||||||
|
|
||||||
|
If your personal data is processed on the basis of your consent
|
||||||
|
in accordance with Art. 6 (1) lit. a GDPR
|
||||||
|
(e.g. via the mailing list),
|
||||||
|
you can withdraw your consent at any time
|
||||||
|
and without any disadvantages.
|
||||||
|
As a result,
|
||||||
|
we may no longer continue the data processing
|
||||||
|
that was based on this consent for the future.
|
||||||
|
However,
|
||||||
|
the withdrawal of your consent
|
||||||
|
does not affect the lawfulness of the processing
|
||||||
|
carried out on the basis of the consent until the withdrawal.
|
||||||
|
|
||||||
|
If you wish to make use of your right of withdrawal,
|
||||||
|
simply send an e-mail to: {{ config.privacy_mail }}
|
||||||
|
|
||||||
## 6. Validity of this privacy policy
|
## 6. Validity of this privacy policy
|
||||||
|
|
||||||
|
|||||||
1690
www/src/water.css
Normal file
1690
www/src/water.css
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user