chatmail/README.md

126 lines
3.9 KiB
Markdown
Raw Normal View History

2023-12-08 14:59:17 +01:00
<img width="800px" src="www/src/collage-top.png"/>
# Chatmail instances optimized for Delta Chat apps
This repository helps to setup a ready-to-use chatmail instance
2023-10-17 00:21:32 +02:00
comprised of a minimal setup of the battle-tested
[postfix smtp](https://www.postfix.org) and [dovecot imap](https://www.dovecot.org) services.
The setup is designed and optimized for providing chatmail accounts
for use by [Delta Chat apps](https://delta.chat).
2023-10-13 16:14:11 +02:00
Chatmail accounts are automatically created by a first login,
after which the initially specified password is required for using them.
## Getting Started deploying your own chatmail instance
2023-12-09 02:07:09 +01:00
1. Setup a domain with `A` and `AAAA` records for your chatmail server.
2023-10-13 16:14:11 +02:00
2023-12-09 02:07:09 +01:00
2. Prepare your local system for deploying to $CHATMAIL_DOMAIN:
2023-10-13 16:14:11 +02:00
2023-12-09 02:07:09 +01:00
scripts/init.sh $CHATMAIL_DOMAIN
2023-10-24 23:21:31 +02:00
2023-12-09 02:07:09 +01:00
3. Edit the generated `chatmail.ini` file
2023-10-13 16:14:11 +02:00
2023-12-09 02:07:09 +01:00
4. Deploy chatmail services remotely:
2023-10-13 16:14:11 +02:00
2023-12-09 02:07:09 +01:00
scripts/deploy.sh chatmail.ini
2023-12-09 02:07:09 +01:00
5. Run `scripts/generate-dns-zone.sh` and
transfer the generated DNS `chatmail.zone` records to your DNS provider
### Home page and getting started for users
The `deploy.sh` script deploys
- a default `index.html` along with a QR code that users can click to
create accounts on your chatmail provider,
- a default `info.html` that is linked from the home page,
- a default `policy.html` that is linked from the home page.
All files are generated by the according markdown `.md` file in the `www` directory.
### Refining the web pages
The `scripts/webdev.sh` script supports live development of the chatmail web presence:
```
scripts/init.sh # to locally initialize python virtual environments etc.
scripts/webdev.sh
```
- uses the `www/src/page-layout.html` file for producing html documents
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.
Note that this script is not needed for running `scripts/deploy.sh"
which deploys the whole chatmail setup remotely.
The code that generates the web pages is identical
which means that `webdev.sh` gives a pretty good preview.
### Ports
Postfix listens on ports 25 (smtp) and 587 (submission) and 465 (submissions).
Dovecot listens on ports 143(imap) and 993 (imaps).
Delta Chat will, however, discover all ports and configurations
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:
2023-11-01 21:55:15 +01:00
touch /etc/chatmail-nocreate
While this file is present, account creation will be blocked.
2023-10-17 00:21:32 +02:00
## Running tests and benchmarks (offline and online)
2023-10-17 00:21:32 +02:00
1. Set `CHATMAIL_SSH` so that `ssh root@$CHATMAIL_SSH` allows
to login to the chatmail instance server.
2023-10-17 00:21:32 +02:00
2. To run local and online tests:
2023-10-17 00:21:32 +02:00
scripts/test.sh
2023-10-17 00:21:32 +02:00
3. To run benchmarks against your chatmail instance:
2023-10-17 00:21:32 +02:00
scripts/bench.sh
## Development Background for chatmail instances
2023-10-13 16:14:11 +02:00
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:
2023-11-14 20:38:15 +01:00
- `chatmaild/src/chatmaild/doveauth.py` implements
create-on-login account creation semantics and is used
by Dovecot during login authentication and by Postfix
2023-11-14 20:38:15 +01:00
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.