Add SSH public key management to hosting accounts
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 10:56:47 +01:00
1 parent a3f7a2e7cb
commit cde9fe00d4
16 files changed
+717 -2

No files matched your search

+51
View File
@@ -261,6 +261,57 @@ and the expected lineage name. The panel can then enable HTTPS using
that certificate. Certbot renews it with its saved authenticator.
[Certbot DNS plugins](https://eff-certbot.readthedocs.io/en/stable/using.html#dns-plugins)
## Set up SFTP access for hosted websites
Use OpenSSH on the local web node. The site account starts in `/public`
inside its hosting directory. OpenSSH allows public key authentication
and restricts the connection to file transfers.
[OpenSSH server configuration](https://man.openbsd.org/sshd_config)
```sh
sudo apt install openssh-server
sudo groupadd --system coulobre-sftp
sudo install -d -m 0755 /etc/ssh/coulobre-authorized-keys
sudo install -m 0644 deploy/openssh/coulobre-sftp.conf.example \
/etc/ssh/sshd_config.d/00-coulobre-sftp.conf
sudo sshd -t
sudo systemctl reload-or-restart ssh.service
```
Install the worker and socket to manage keys from the panel.
```sh
sudo groupadd --system coulobre-sftp-provisioning
sudo useradd --system --user-group --no-create-home --home-dir /nonexistent \
--shell /usr/sbin/nologin coulobre-sftp-provisioner
sudo install -m 0644 deploy/systemd/coulobre-sftp-apply.socket \
deploy/systemd/coulobre-sftp-apply@.service \
deploy/systemd/coulobre-sftp-provisioner.service /etc/systemd/system/
sudo systemctl daemon-reload
```
Set `COULOBRE_LOCAL_WEB_SFTP=1` in `/etc/coulobre/panel.env`, then apply
pending migrations and restart the panel services.
```sh
panel_manage migrate --noinput
sudo systemctl restart coulobre-panel coulobre-worker coulobre-beat
sudo systemctl enable --now coulobre-sftp-apply.socket \
coulobre-sftp-provisioner.service
```
On an active hosting account, open **SFTP access**. Assigned customers
can manage keys for their accounts. Operators need **Can view hosting
account** and **Can change site SFTP access**.
Select one or more `.pub` files to add keys to the hosting account.
A file can contain one OpenSSH public key per line. Each key has its own
fingerprint and **Remove key** action. Use **Revoke SFTP access** to
remove all keys for new connections. Revoke access and close any existing
SFTP sessions before transferring the hosting account to another customer.
Connect to the web node's SSH hostname and port, which may differ from
the hostname that a reverse proxy uses for web traffic.
## Provision local databases from the panel
Enable the [database provisioning socket](development.md#enable-local-database-provisioning)
+23
View File
@@ -754,6 +754,29 @@ read the JSON reply to EOF. A `configured` reply includes the account ID and
domain. A `failed` reply includes a diagnostic in `problem`. Retry the same
manifest if the connection closes before a reply arrives.
## Install SFTP keys on a web node
Generate an Ed25519 key on the computer that will connect and choose a
passphrase when prompted. With the default filename,
`~/.ssh/id_ed25519.pub` is the public key file. Keep the private key on
that computer.
```sh
ssh-keygen -t ed25519
```
Enable the OpenSSH configuration on the web node and apply the site's
deployment manifest. Use the public key file to set the account's keys
directly on that node. Running the command with an empty file removes
the configured keys for new connections.
[SFTP deployment setup](deployment.md#set-up-sftp-access-for-hosted-websites)
```sh
sudo /opt/coulobre/bin/coulobre-web-node set-sftp-keys \
coulobre-web-plan-1.json site-access.pub
sftp coulobre-1@web-node.example.org
```
## Run an isolated PHP test site
Open a completed preview for the account's current domain and select **Download