diff --git a/docs/deployment.md b/docs/deployment.md index 838bcb1..d4e9772 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -760,6 +760,9 @@ database. Sign out of phpMyAdmin to end its session. ## Publish local DNS zones from the panel +To publish to BIND9 on another host, use the +[separate-node setup](#provision-mail-and-dns-on-separate-servers). + Enable the [DNS publishing socket](development.md#enable-local-dns-publishing) on the panel host. Install the BIND9 publishing worker under a dedicated identity with access to that socket. @@ -791,6 +794,9 @@ finishes. Use **Retry publishing** if the current revision failed. ## Provision local mailboxes from the panel +To provision Postfix and Dovecot on another host, use the +[separate-node setup](#provision-mail-and-dns-on-separate-servers). + Set up [Postfix and Dovecot](development.md#apply-a-mailbox-manifest) on the Ubuntu 24.04 or 26.04 panel host and enable the [mailbox provisioning socket](development.md#enable-local-mailbox-provisioning). @@ -834,3 +840,140 @@ the node command for manually provisioned mailboxes. Back up mail on the node that hosts the mailbox. The archive can be used to recover messages and folders into a newly provisioned mailbox with the same address. [Mailbox backup and restore](development.md#back-up-and-restore-a-mailbox) + +## Provision mail and DNS on separate servers + +Choose one destination per service. For example, run mail locally and publish +DNS to a separate authoritative server. The panel uses the same worker and +job history for each deployment. On the panel server, install the SSH +drop-in only for a service that uses another host. + +Several Coulobre installations under the same administration can share a +destination. Generate a separate key per sending installation and service. +The receiver accepts each key separately, and removing its line revokes that +installation's access. Each receiver can manage any Coulobre resource on its +service. Assign each domain to one installation for changes to its zones and +mailboxes. + +Use the values for each service below when following the commands. + +| Value | DNS | Mail | +| --- | --- | --- | +| `node` | `dns` | `mail` | +| `request_group` | `coulobre-dns-provisioning` | `coulobre-mail-provisioning` | +| `receiver` | `coulobre-dns-request` | `coulobre-mail-request` | +| `worker` | `coulobre-dns-publisher` | `coulobre-mail-provisioner` | +| Worker unit | `coulobre-dns-publisher.service` | `coulobre-mailbox-provisioner.service` | +| Panel flag | `COULOBRE_LOCAL_DNS_PUBLISHING=1` | `COULOBRE_LOCAL_MAILBOX_PROVISIONING=1` | + +### Prepare the panel's SSH identity + +Start from the same Coulobre source release on both hosts. For DNS, set these +variables on the panel host. For mail, substitute the values in the table. + +```sh +node=dns +request_group=coulobre-dns-provisioning +worker=coulobre-dns-publisher + +sudo apt install openssh-client +getent group "$request_group" >/dev/null || sudo groupadd --system "$request_group" +id "$worker" >/dev/null 2>&1 || sudo useradd --system --user-group \ + --no-create-home --home-dir /nonexistent --shell /usr/sbin/nologin "$worker" +sudo install -d -o root -g root -m 0755 /etc/coulobre-remote +sudo install -d -o root -g "$worker" -m 0750 "/etc/coulobre-remote/$node" +sudo install -o root -g "$worker" -m 0640 \ + "deploy/openssh/$node-node-client.conf.example" "/etc/coulobre-remote/$node/ssh_config" +sudo sh -c 'umask 077; ssh-keygen -t ed25519 -N "" -f "$1/id_ed25519"' \ + sh "/etc/coulobre-remote/$node" +sudo chown "$worker:$worker" "/etc/coulobre-remote/$node/id_ed25519" +sudo cat "/etc/coulobre-remote/$node/id_ed25519.pub" +``` + +Set `HostName` and `Port` in the SSH client configuration. Obtain the +destination's SSH host public key through your existing administrative +connection. Put the hostname or IP address, key type, and public key on one +line in `/etc/coulobre-remote/` under the service's `known_hosts` file. For a +port other than 22, use `[hostname]:port` in that line. Make the file owned +by root and readable by the worker group. The worker checks this pinned host +key before sending a request. [OpenSSH client configuration](https://man.openbsd.org/ssh_config) + +### Install the node on the destination + +On the destination, unpack the source release and install the Coulobre node +commands in `/opt/coulobre`. + +```sh +sudo apt install python3-venv openssh-server socat +sudo python3 -m venv /opt/coulobre +sudo /opt/coulobre/bin/pip install . +``` + +Set up [BIND9](development.md#apply-a-zone-manifest) or +[Postfix and Dovecot](development.md#apply-a-mailbox-manifest), then enable +the corresponding [DNS socket](development.md#enable-local-dns-publishing) or +[mailbox socket](development.md#enable-local-mailbox-provisioning). The +destination runs the local socket service shipped with Coulobre. + +Save the panel's public key from the previous step as `panel-node.pub` on +the destination. Create a receiver with only the socket group for that +service. This example uses DNS. Substitute the values for a mail node. + +```sh +request_group=coulobre-dns-provisioning +receiver=coulobre-dns-request + +id "$receiver" >/dev/null 2>&1 || sudo useradd --system --user-group --groups "$request_group" \ + --no-create-home --home-dir / --shell /bin/sh "$receiver" +sudo install -d -o root -g root -m 0755 /etc/ssh/coulobre-node-keys +authorized_keys="/etc/ssh/coulobre-node-keys/$receiver" +sudo touch "$authorized_keys" +sudo chown root:root "$authorized_keys" +sudo chmod 0644 "$authorized_keys" +sudo tee -a "$authorized_keys" < panel-node.pub >/dev/null +sudo install -m 0644 deploy/openssh/coulobre-node-requests.conf.example \ + /etc/ssh/sshd_config.d/00-coulobre-node-requests.conf +sudo sshd -t +sudo systemctl reload-or-restart ssh.service +``` + +The receiver authenticates with the panel's key and runs a fixed relay to +the service socket. The socket's systemd service validates and applies the +request. [OpenSSH server configuration](https://man.openbsd.org/sshd_config) + +### Enable the remote destination on the panel + +Use the matching worker from the table. The commands below use DNS. + +```sh +node=dns +worker_unit=coulobre-dns-publisher.service +unit="coulobre-$node-apply" + +sudo install -m 0644 "deploy/systemd/$unit.socket" \ + "deploy/systemd/$unit@.service" "deploy/systemd/$worker_unit" /etc/systemd/system/ +sudo install -D -m 0644 "deploy/systemd/$unit@.service.d/remote.conf" \ + "/etc/systemd/system/$unit@.service.d/remote.conf" +sudo systemctl daemon-reload +``` + +Set the corresponding flag from the table in `/etc/coulobre/panel.env`. The +flag enables the existing panel actions and queue for that service. Restart +the panel and its general worker so they pick up the setting, then enable +the dedicated worker. + +```sh +sudo systemctl restart coulobre-panel coulobre-worker coulobre-beat +sudo systemctl enable --now "$worker_unit" +``` + +Use **Publish zone** or **Provision mailbox** and check the status on the +account page. After correcting a connection or host key problem, use the +corresponding retry action. Check the panel-side relay log with +`sudo journalctl -u 'coulobre-dns-apply@*.service'` for DNS or +`sudo journalctl -u 'coulobre-mail-apply@*.service'` for mail. + +When moving an existing service, migrate its data and provisioning state and +let outstanding jobs finish before switching destinations. +For mail on a separate server, retrieve logins on the mail node, and use the +[separate-node backup workflow](development.md#bundle-backups-from-separate-nodes).