mirror of
https://github.com/chatmail/relay.git
synced 2026-05-10 16:04:37 +00:00
feat: support self-signed chatmail relays (#855)
feat: support self-signed TLS via underscore domain convention Domains starting with "_" (e.g. _chat.example.org) automatically use self-signed TLS certificates instead of ACME/Let's Encrypt. The TLS mode is derived from the domain name — no separate config option needed. Internally, when config.tls_cert_mode is "self" (underscore domain): - Generate self-signed certificates via openssl - Set Postfix smtp_tls_security_level to "encrypt" (opportunistic TLS) - Add smtp_tls_policy_map entry for underscore domains - Skip ACME, MTA-STS and www CNAME checks in `cmdeploy dns` - Serve /new via GET (not redirect to dcaccount:) with rate-limiting (nginx limit_req, 2r/s burst=5) - Return dclogin: URLs with ic=3 (AcceptInvalidCertificates) from /new - Render QR codes client-side via JavaScript and qrcode-svg - Use config.tls_cert_path/tls_key_path in Postfix, Dovecot and nginx templates instead of hardcoded ACME paths
This commit is contained in:
@@ -47,6 +47,14 @@ steps. Please substitute it with your own domain.
|
||||
www.chat.example.org. 3600 IN CNAME chat.example.org.
|
||||
mta-sts.chat.example.org. 3600 IN CNAME chat.example.org.
|
||||
|
||||
.. note::
|
||||
|
||||
For experimental deployments using self-signed certificates,
|
||||
use a domain name starting with ``_``
|
||||
(e.g. ``_chat.example.org``).
|
||||
The ``mta-sts`` CNAME and ``_mta-sts`` TXT records
|
||||
are not needed for such domains.
|
||||
|
||||
2. On your local PC, clone the repository and bootstrap the Python
|
||||
virtualenv.
|
||||
|
||||
@@ -63,6 +71,16 @@ steps. Please substitute it with your own domain.
|
||||
|
||||
scripts/cmdeploy init chat.example.org # <-- use your domain
|
||||
|
||||
To use self-signed TLS certificates
|
||||
instead of Let's Encrypt,
|
||||
use a domain name starting with ``_``
|
||||
(e.g. ``scripts/cmdeploy init _chat.example.org``).
|
||||
Domains starting with ``_`` cannot obtain WebPKI certificates,
|
||||
so self-signed mode is derived automatically.
|
||||
This is useful for private or test deployments.
|
||||
See the :doc:`overview`
|
||||
for details on certificate provisioning.
|
||||
|
||||
4. Verify that SSH root login to the deployment server server works:
|
||||
|
||||
::
|
||||
@@ -169,6 +187,17 @@ creating addresses, login with ssh to the deployment machine and run:
|
||||
Chatmail address creation will be denied while this file is present.
|
||||
|
||||
|
||||
Running a relay with self-signed certificates
|
||||
----------------------------------------------
|
||||
|
||||
Use a domain name starting with ``_`` (e.g. ``_chat.example.org``)
|
||||
to run a relay with self-signed certificates.
|
||||
Domains starting with ``_`` cannot obtain WebPKI certificates
|
||||
so the relay automatically uses self-signed certificates
|
||||
and all other relays will accept connections from it
|
||||
without requiring certificate verification.
|
||||
This is useful for experimental setups and testing.
|
||||
|
||||
Migrating to a new build machine
|
||||
----------------------------------
|
||||
|
||||
|
||||
@@ -297,8 +297,7 @@ TLS requirements
|
||||
|
||||
Postfix is configured to require valid TLS by setting
|
||||
`smtp_tls_security_level <https://www.postfix.org/postconf.5.html#smtp_tls_security_level>`_
|
||||
to ``verify``. If emails don’t arrive at your chatmail relay server, the
|
||||
problem is likely that your relay does not have a valid TLS certificate.
|
||||
to ``verify``.
|
||||
|
||||
You can test it by resolving ``MX`` records of your relay domain and
|
||||
then connecting to MX relays (e.g ``mx.example.org``) with
|
||||
@@ -317,6 +316,14 @@ default Exim does not log sessions that are closed before sending the
|
||||
by Postfix, so you might think that connection is not established while
|
||||
actually it is a problem with your TLS certificate.
|
||||
|
||||
If emails don’t arrive at your chatmail relay server, the
|
||||
problem is likely that your relay does not have a valid TLS certificate.
|
||||
|
||||
Note that connections to relays with underscore-prefixed test domains
|
||||
(e.g. ``_chat.example.org``) use ``encrypt`` tls security level,
|
||||
because such domains cannot obtain valid Let's Encrypt certificates
|
||||
and run with self-signed certificates.
|
||||
|
||||
|
||||
.. _dovecot: https://dovecot.org
|
||||
.. _postfix: https://www.postfix.org
|
||||
|
||||
Reference in New Issue
Block a user