Deploy remote mailbox credentials over a dedicated SSH relay
Coulobre Panel CI / Checks (Python 3.12) (pull_request) Canceled after 0s
Coulobre Panel CI / Checks (Python 3.14) (pull_request) Canceled after 0s

This commit is contained in:
parkel committed 2026-11-21 19:23:01 +01:00
1 parent 651f041e84
commit 0ab0eebfc6
11 files changed
+192 -3

No files matched your search

+102 -3
View File
@@ -730,12 +730,45 @@ assigned accounts. Operators need permission to view the account and resource
and the relevant **Can reveal database credentials** or **Can reveal mailbox
credentials** permission.
Passwords are read directly from the local service and rendered on the
confirmation response. The panel stores access events and outcomes in Django
Passwords are read from the service node and rendered on the confirmation
response. The panel stores access events and outcomes in Django
admin under **Service credential accesses**. The audit log includes the actor
and resource identifiers. After five incorrect confirmations within five
minutes, the panel temporarily stops accepting new attempts for that user.
### Rotate a database or mailbox password
Enable the corresponding local credential service first. For each local
service that should allow password rotation, install its rotation drop-in
and enable the matching flag in `/etc/coulobre/panel.env`.
```sh
# COULOBRE_LOCAL_DATABASE_CREDENTIALS_ROTATION=1
sudo install -D -m 0644 deploy/systemd/coulobre-service-credentials@.service.d/database-rotation.conf \
/etc/systemd/system/coulobre-service-credentials@.service.d/database-rotation.conf
# COULOBRE_LOCAL_MAILBOX_CREDENTIALS_ROTATION=1
sudo install -D -m 0644 deploy/systemd/coulobre-service-credentials@.service.d/mailbox-rotation.conf \
/etc/systemd/system/coulobre-service-credentials@.service.d/mailbox-rotation.conf
sudo systemctl daemon-reload
sudo systemctl restart coulobre-panel
```
Open **Connection details**, choose **Rotate password**, and confirm the
current panel password. A customer can rotate a login on their own account.
An operator needs the reveal permission and the corresponding **Can rotate
database credentials** or **Can rotate mailbox credentials** permission.
The service node generates the replacement. Copy it into any application
configuration or mail client using that login before its next connection.
A new phpMyAdmin sign-in reads the current database password.
If the panel cannot confirm the change, retry from the same form or reopen
it to resume the pending request. MariaDB data and grants, and mailbox
messages and quotas, are retained. Existing sessions can stay connected
until they close. The audit trail records the attempt and outcome. The
password stays in the node's root-only registry and is returned only on an
authorized confirmation. Resolve an unconfirmed rotation before suspending
the account or changing the affected mailbox's quota.
### Open phpMyAdmin from the panel
Enable database credential access first. Install phpMyAdmin with PHP's MySQL
@@ -1013,9 +1046,75 @@ corresponding retry action. Check the panel-side relay log with
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
For mail on a separate server, use the
[separate-node backup workflow](development.md#bundle-backups-from-separate-nodes).
### Enable connection details for remote mailboxes
Use a separate SSH identity for credential access. Install the same Coulobre
version on both ends. The key grants access to Coulobre-managed mailbox
logins on that receiver. Keep it with the relay account on the panel and
assign each mailbox domain to one sending installation.
On the panel node, create the relay user and its SSH directory. Generate a
dedicated key pair, copy the public half to the mail node, and install the
verified SSH host key for the destination as `known_hosts` in the relay
directory.
```sh
relay=coulobre-mail-credential-relay
dir=/etc/coulobre-remote/mail-credentials
getent group coulobre-credential-requests >/dev/null || sudo groupadd --system coulobre-credential-requests
sudo useradd --system --user-group --no-create-home --home-dir /nonexistent \
--shell /usr/sbin/nologin "$relay"
sudo install -d -o root -g "$relay" -m 0750 "$dir"
sudo install -o root -g "$relay" -m 0640 deploy/openssh/mail-credential-client.conf.example "$dir/ssh_config"
sudoedit "$dir/ssh_config"
# Install id_ed25519 with owner $relay and mode 0600.
# Install known_hosts with group $relay and mode 0640.
sudo install -m 0644 deploy/systemd/coulobre-mail-credentials.socket \
deploy/systemd/coulobre-mail-credentials@.service /etc/systemd/system/
sudo install -D -m 0644 deploy/systemd/coulobre-mail-credentials@.service.d/remote.conf \
/etc/systemd/system/coulobre-mail-credentials@.service.d/remote.conf
sudo install -D -m 0644 deploy/systemd/coulobre-panel.service.d/credentials-remote-mail.conf \
/etc/systemd/system/coulobre-panel.service.d/credentials-remote-mail.conf
```
On the mail node, save the panel's public key as `mail-credential.pub` and
install the credential receiver and local socket.
```sh
receiver=coulobre-mail-credential-request
getent group coulobre-credential-requests >/dev/null || sudo groupadd --system coulobre-credential-requests
sudo useradd --system --user-group --groups coulobre-credential-requests \
--no-create-home --home-dir / --shell /bin/sh "$receiver"
sudo install -d -m 0755 /etc/ssh/coulobre-node-keys
sudo install -m 0644 mail-credential.pub "/etc/ssh/coulobre-node-keys/$receiver"
sudo install -m 0644 deploy/openssh/coulobre-mail-credentials.conf.example \
/etc/ssh/sshd_config.d/01-coulobre-mail-credentials.conf
sudo install -m 0644 deploy/systemd/coulobre-mail-credentials.socket \
deploy/systemd/coulobre-mail-credentials@.service /etc/systemd/system/
sudo sshd -t
sudo systemctl daemon-reload
sudo systemctl reload-or-restart ssh.service
sudo systemctl enable --now coulobre-mail-credentials.socket
```
For rotation, also install the receiver's rotation drop-in on the **mail
node** and run `sudo systemctl daemon-reload` there.
```sh
sudo install -D -m 0644 deploy/systemd/coulobre-mail-credentials@.service.d/rotation.conf \
/etc/systemd/system/coulobre-mail-credentials@.service.d/rotation.conf
```
On the panel, set `COULOBRE_REMOTE_MAILBOX_CREDENTIALS=1` and, for password
changes, `COULOBRE_REMOTE_MAILBOX_CREDENTIALS_ROTATION=1`. Set
`COULOBRE_MAIL_IMAP_HOST` to the mail server's client-facing hostname. Run
`panel_manage migrate --noinput`, reload systemd, and restart
`coulobre-panel`. These flags route mailbox credential requests to the
remote receiver, while databases still use the local credential service.
## Manage resellers
Open **Resellers** to add a reseller login or change an existing reseller's