From c4f07009eddeac728ca3de24969ad2ee9bae5d07 Mon Sep 17 00:00:00 2001 From: missytake Date: Tue, 26 Aug 2025 11:01:54 +0200 Subject: [PATCH] cmdeploy: enable running DNS commands on localhost --- cmdeploy/src/cmdeploy/cmdeploy.py | 7 ++++++- cmdeploy/src/cmdeploy/dns.py | 2 +- cmdeploy/src/cmdeploy/remote/rdns.py | 3 --- docs/DOCKER_INSTALLATION_EN.md | 5 +++++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cmdeploy/src/cmdeploy/cmdeploy.py b/cmdeploy/src/cmdeploy/cmdeploy.py index 3362c0e9..18a6ade1 100644 --- a/cmdeploy/src/cmdeploy/cmdeploy.py +++ b/cmdeploy/src/cmdeploy/cmdeploy.py @@ -72,7 +72,7 @@ def run_cmd_options(parser): parser.add_argument( "--ssh-host", dest="ssh_host", - help="specify an SSH host to deploy to; uses mail_domain from chatmail.ini by default", + help="Deploy to 'localhost', via 'docker', or to a specific SSH host", ) parser.add_argument( "--skip-dns-check", @@ -135,6 +135,11 @@ def dns_cmd_options(parser): default=None, help="write out a zonefile", ) + parser.add_argument( + "--ssh-host", + dest="ssh_host", + help="Run the DNS queries on 'localhost', in the chatmail 'docker' container, or on a specific SSH host", + ) def dns_cmd(args, out): diff --git a/cmdeploy/src/cmdeploy/dns.py b/cmdeploy/src/cmdeploy/dns.py index 7aa5976a..ec69cdc8 100644 --- a/cmdeploy/src/cmdeploy/dns.py +++ b/cmdeploy/src/cmdeploy/dns.py @@ -10,7 +10,7 @@ def get_initial_remote_data(sshexec, mail_domain): if sshexec == "docker": return remote.rdns.perform_initial_checks(mail_domain, pre_command="docker exec chatmail ") elif sshexec == "localhost": - return remote.rdns.perform_initial_checks(mail_domain, pre_command="running on localhost") + return remote.rdns.perform_initial_checks(mail_domain, pre_command="") return sshexec.logged( call=remote.rdns.perform_initial_checks, kwargs=dict(mail_domain=mail_domain) ) diff --git a/cmdeploy/src/cmdeploy/remote/rdns.py b/cmdeploy/src/cmdeploy/remote/rdns.py index 58aba530..efa49141 100644 --- a/cmdeploy/src/cmdeploy/remote/rdns.py +++ b/cmdeploy/src/cmdeploy/remote/rdns.py @@ -26,9 +26,6 @@ def perform_initial_checks(mail_domain, pre_command=""): WWW = query_dns("CNAME", f"www.{mail_domain}") res = dict(mail_domain=mail_domain, A=A, AAAA=AAAA, MTA_STS=MTA_STS, WWW=WWW) - if pre_command == "running on localhost": - return res - res["acme_account_url"] = shell(pre_command + "acmetool account-url", fail_ok=True) res["dkim_entry"], res["web_dkim_entry"] = get_dkim_entry( mail_domain, pre_command, dkim_selector="opendkim" diff --git a/docs/DOCKER_INSTALLATION_EN.md b/docs/DOCKER_INSTALLATION_EN.md index 5ce7cc44..71f35f0a 100644 --- a/docs/DOCKER_INSTALLATION_EN.md +++ b/docs/DOCKER_INSTALLATION_EN.md @@ -96,6 +96,11 @@ docker compose logs -f chatmail # view container logs, press CTRL+C to exit 8. After installation is complete, you can open `https://` in your browser. +9. To send messages to other chatmail relays, + you need to set additional DNS records. + Run `docker exec chatmail scripts/cmdeploy.sh dns --ssh-host localhost` + to see recommended DNS records and check whether they are correct. + ## Using custom files When using Docker, you can apply modified configuration files to make the installation more personalized. This is usually needed for the `www/src` section so that the Chatmail landing page is customized to your taste, but it can be used for any other cases as well.