a2a78c0aff
If you run it as scripts/initenv.sh, activating venv is useless as bash will exit immediately afterwards. If you `source` it as suggested by README.md, `set -e` will set the flag for the current shell and your shell will exit as soon as some command returns non-zero status, e.g. cmdeploy fails or you simply do `ls /foo/bar/baz` and `ls` complains that `/foo/bar/baz` does not exist. |
||
---|---|---|
.github/workflows | ||
chatmaild | ||
cmdeploy | ||
scripts | ||
www/src | ||
.gitignore | ||
README.md |
Chatmail services optimized for Delta Chat apps
This repository helps to setup a ready-to-use chatmail server comprised of a minimal setup of the battle-tested postfix smtp and dovecot imap services.
The setup is designed and optimized for providing chatmail accounts for use by Delta Chat apps.
Chatmail accounts are automatically created by a first login, after which the initially specified password is required for using them.
Deploying your own chatmail server
We subsequently use CHATMAIL_DOMAIN
as a placeholder for your fully qualified
DNS domain name (FQDN), for example chat.example.org
.
-
Setup DNS
A
andAAAA
records for yourCHATMAIL_DOMAIN
. Verify that DNS is set and SSH root login works:ssh root@CHATMAIL_DOMAIN
-
Install the
cmdeploy
command in a virtualenv and activate itscripts/initenv.sh . venv/bin/activate
-
Create chatmail configuration file
chatmail.ini
:cmdeploy init CHATMAIL_DOMAIN
-
Deploy to the remote chatmail server:
cmdeploy run
-
To output a DNS zone file from which you can transfer DNS records to your DNS provider:
cmdeploy dns
-
To check status of your remotely running chatmail service:
cmdeploy status
-
To test your chatmail service:
cmdeploy test
-
To benchmark your chatmail service:
cmdeploy bench
Refining the web pages
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 fromwww/src/*.md
files -
continously builds the web presence reading files from
www/src
directory and generating html files and copying assets to thewww/build
directory. -
Starts a browser window automatically where you can "refresh" as needed.
Home page and getting started for users
cmdeploy run
sets up mail services,
and also creates default static Web pages and deploys them:
-
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 .html
files are generated
by the according markdown .md
file in the www/src
directory.
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:
touch /etc/chatmail-nocreate
While this file is present, account creation will be blocked.
Running tests and benchmarks (offline and online)
-
Set
CHATMAIL_SSH
so thatssh root@$CHATMAIL_SSH
allows to login to the chatmail instance server. -
To run local and online tests:
scripts/test.sh
-
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
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 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.