diff --git a/README.md b/README.md index 44571f3..cf1b12d 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ work items in [Gitea issues][issues]. Published versions and their release notes are available on [Gitea Releases][releases]. See [Contributing](CONTRIBUTING.md) for the project workflow. +See [Security](docs/security.md) for deployment hardening and private +vulnerability reporting. [milestones]: https://code.hosting.hippogrief.nl/hippogrief/coulobre/milestones [issues]: https://code.hosting.hippogrief.nl/hippogrief/coulobre/issues diff --git a/deploy/install-node.sh b/deploy/install-node.sh index b0faf88..f88b5c9 100755 --- a/deploy/install-node.sh +++ b/deploy/install-node.sh @@ -61,6 +61,7 @@ if [ ! -x "$venv/bin/python" ]; then python3 -m venv "$venv" fi if [ -z "$installed" ]; then - "$venv/bin/pip" install . + "$venv/bin/python" -m pip install --only-binary=:all: 'pip>=26.2' + "$venv/bin/python" -m pip install . fi exec "$venv/bin/coulobre-node-setup" install-receiver "$@" diff --git a/deploy/panel_installer/engine.py b/deploy/panel_installer/engine.py index dd10348..dc8dbd0 100644 --- a/deploy/panel_installer/engine.py +++ b/deploy/panel_installer/engine.py @@ -282,6 +282,18 @@ def install_release(release, *, step=nullcontext): if key in os.environ } with step("Installing Coulobre and its Python dependencies"): + run( + BINDIR / "python", + "-m", + "pip", + "install", + "--disable-pip-version-check", + "--only-binary=:all:", + "pip>=26.2", + label="Update the virtual environment installer", + env=pip_env, + timeout=1200, + ) run( BINDIR / "pip", "install", @@ -860,12 +872,9 @@ class Installer: HEALTH_TIMER, ): install_unit(unit) - if not REMOTE_MODES.intersection( - (self.plan.dns.mode, self.plan.mail.mode) - ): - install_unit("coulobre-update.socket") - install_unit("coulobre-update@.service") - workers.append("coulobre-update.socket") + install_unit("coulobre-update.socket") + install_unit("coulobre-update@.service") + workers.append("coulobre-update.socket") systemctl("daemon-reload") systemctl( "enable", "--now", *PANEL_UNITS, *workers, "apache2.service" diff --git a/docs/deployment.md b/docs/deployment.md index c793c7e..047d1eb 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -542,7 +542,8 @@ From the unpacked source release, upgrade the existing virtual environment and use the [management command helper](#prepare-the-panel). ```sh -sudo /opt/coulobre/bin/pip install --upgrade '.[server,mariadb]' +sudo /opt/coulobre/bin/python -m pip install --only-binary=:all: 'pip>=26.2' +sudo /opt/coulobre/bin/python -m pip install --upgrade '.[server,mariadb]' panel_manage migrate --noinput panel_manage collectstatic --noinput ``` @@ -587,9 +588,9 @@ without service checks, follow [the collector setup](#monitor-local-and-remote-s ### Install a compatible release from the panel -The installer enables **Updates** for single-server deployments. On an -existing installer-managed single server, install the updater units from the -v0.10.1 source release after upgrading the package: +The installer enables **Updates** for installer-managed panels. On an +existing panel, install the updater units from the source release matching +the installed package: ```sh sudo install -m 0644 deploy/systemd/coulobre-update.socket \ @@ -602,9 +603,10 @@ A superuser with a verified second factor can choose a compatible release from **Server and services → Updates**. The updater uses the official Gitea release over HTTPS and checks the wheel against its published SHA-256 hash. It supports the installer-managed local MariaDB database and installer -layout. Use the in-place procedure for linked mail or DNS receivers, custom -service unit changes, and releases requiring new dependencies. The update -manifest lists the tested starting versions. +layout. The update manifest lists the tested starting versions. Use the +in-place procedure for custom service unit changes and for environments +missing a dependency required by the target version. From 0.11 onward, the +updater checks installed dependencies before stopping panel services. The panel and its workers pause during the upgrade. Refresh **Updates** after the panel returns. The latest update status names the recovery directory in @@ -623,6 +625,78 @@ verify sign-in and service health. Archive `status.json` as root after recovery to allow a later update. Check that `panel.sql` and `venv` exist before restoring from a directory created by an interrupted update. +### Coordinate a release across linked mail and DNS receivers + +Use the in-place procedure for the first upgrade from 0.10 to 0.11 in a +linked deployment. The older web updater supports single-server upgrades. +Bring the receiver and all attached panels to the same release before +resuming provisioning. For manually configured relays, including separate +mail credential and archive relays, use the in-place procedure for the +whole fleet. + +The **Updates** page in 0.11 reports the release, host, and status probe +protocol of each installer-enrolled receiver. Protocol 1 reports readiness +and release. Protocol 2 also reports a staged maintenance target. This is +a read-only addition to the probe. The mail and DNS apply request formats +keep their existing per-operation versions. Active provisioning requires +matching package releases. During a coordinated upgrade, the receiver +keeps provisioning requests paused while panels are on different releases. +Normal mail delivery, IMAP, and existing DNS answers can continue while +the provisioning socket is stopped or paused. + +1. At each receiver, list the authorized panel keys. Match each fingerprint + to a panel and confirm its installed version on that host. Include every + key, including panels operated by another team. Back up the panels, the + receiver packages, and the managed mail or DNS configuration. Pause + new provisioning requests and let current jobs finish. + + ```sh + sudo /opt/coulobre/bin/coulobre-node-setup list-panels dns + ``` + +2. Save a root-owned JSON inventory with mode 0600, the target package version and a + fingerprint-to-version map. Replace the fingerprints and versions with + your actual values. Make a separate inventory for each role on a host. + + ```json + { + "target": "0.11.1rc1", + "panels": { + "SHA256:panel-one-fingerprint": "0.11.0rc1", + "SHA256:panel-two-fingerprint": "0.11.0rc1" + } + } + ``` + +3. Stop the receiver socket and let instances of the corresponding apply + service finish. Stage the inventory, update the receiver to the target, + then start its socket again. Replace `dns` with `mail` for a mail receiver. + The staged receiver answers status probes and rejects apply requests. + + ```sh + sudo systemctl stop coulobre-dns-apply.socket + sudo /opt/coulobre/bin/coulobre-node-setup begin-maintenance dns /root/dns-upgrade.json + # Install the reviewed target package using its release instructions. + sudo systemctl start coulobre-dns-apply.socket + ``` + +4. Refresh **Updates** on each panel. Install the target when all its + receivers report that release in maintenance mode and the compatible + release is offered. Use the in-place procedure if its update requires + additional dependencies or unit changes. Keep the receivers staged if + any panel upgrade is interrupted. Check the recovery files and repair or + roll back before reopening provisioning. +5. Once every panel is running and verified at the target, update each + inventory with the observed installed versions. Finish maintenance on each + receiver, then resume provisioning and retry any affected operations. + The command checks the receiver release and the inventory against the + current authorized keys. The receiver administrator is responsible for + checking the installed version reported by every panel operator. + + ```sh + sudo /opt/coulobre/bin/coulobre-node-setup finish-maintenance dns /root/dns-upgrade.json + ``` + ### Upgrade from v0.9 to v0.10 Use the in-place procedure above with the v0.10 source release. Keep a copy diff --git a/docs/security.md b/docs/security.md new file mode 100644 index 0000000..b1b441a --- /dev/null +++ b/docs/security.md @@ -0,0 +1,60 @@ +# Security + +## Report vulnerabilities privately + +Contact a project maintainer privately with the affected release, the +deployment layout, the affected roles, and a description of the impact. +Share minimal evidence using test data. Remove credentials, tokens, +customer data, private keys, and identifiable account information. If you +cannot find a private channel, open a Gitea issue requesting private +contact and leave the technical details out of the issue. + +Maintainers confirm scope, coordinate remediation with the reporter, and +publish an advisory with the fixed releases and any operational mitigations +after users have a way to update. + +## Panel and account access + +- Serve the panel over HTTPS. If you use a reverse proxy, restrict the + private origin to that proxy and let the managed Apache configuration set + the forwarding headers. Keep debug mode off on shared or public hosts. +- Require two-factor authentication for staff and customer managers. Use an + authenticator app for administrative accounts and keep recovery codes in a + protected location. The **My account** page lets users verify a new email + address, replace their authenticator, renew recovery codes, and revoke + other panel sessions. Revoking panel sessions also clears unused service + login tickets. Webmail, database, and SSH sessions established separately + have their own lifetimes. +- During customer impersonation, use only the approved support + actions. Review impersonation and credential access events. Account + security actions are recorded separately and visible to the account owner. +- Verify that the panel can deliver account messages and email factors. + Treat an address used for password recovery or an email factor as a + credential and check it after changing it. + +## Service boundaries and recovery + +- Restrict the panel database and RabbitMQ to local access. Expose only + the client-facing ports for the functions you run. Keep Unix sockets and + environment files restricted to the identities listed in the deployment + guide. Keep each site's PHP-FPM pool and SFTP keys scoped to that site. +- Pin SSH host keys for linked nodes and off-site backups. Use dedicated + receiver keys and accounts. The panel receiver protocol is authenticated + by the enrolled panel key. Share a receiver only among cooperating + administrators who agree on service ownership and coordinate releases. + The linked-node upgrade runbook accounts for every authorized panel key. +- Review DNS delegation, mail routing permissions, and allowed forwarding. + Keep private DKIM material on the mail receiver and publish the matching + public records. Verify the mail configuration after changing packages. +- Store backup destinations and their keys separately from hosted content. + Protect recovery copies of the virtual environment and database. Test + website, database, and mailbox restores with isolated accounts and check + ownership and access afterwards. +- Keep Ubuntu or Debian packages and the panel's Python environment on + security-supported versions. Check installed dependencies against a + vulnerability advisory source such as OSV before a release. Verify both + distribution files against the reviewed Git revision and check the + wheel digest before enabling a web update. + +Use the [deployment guide](deployment.md) for operating-system support, +configuration and recovery steps. diff --git a/pyproject.toml b/pyproject.toml index c1a311a..fa9ffc3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,18 +4,18 @@ build-backend = "setuptools.build_meta" [project] name = "coulobre-panel" -version = "0.10.2rc1" +version = "0.11.0rc1" description = "A web hosting control panel for hosting providers and resellers." readme = "README.md" requires-python = ">=3.12" license = "Apache-2.0" dependencies = [ - "Django>=5.2.8,<5.3", + "Django>=5.2.17,<5.3", "django-otp>=1.7.5,<2", "celery>=5.6,<6", - "cryptography>=45", - "dnspython>=2.7,<3", - "idna>=3,<4", + "cryptography>=50", + "dnspython>=2.9.2,<3", + "idna>=3.15,<4", "qrcode>=8.2,<9", ]