Compare commits

..
Author SHA1 Message Date
parkel 20fe76d282 Document recovery after an interrupted APT upgrade
Coulobre Panel CI / Checks (Python 3.12) (pull_request) Successful in 2m11s
Coulobre Panel CI / Checks (Python 3.14) (pull_request) Successful in 2m27s
2026-12-05 13:18:44 +01:00
parkel cae0a7890a Merge pull request 'Keep the BIND catalog accessible under a restrictive umask' (#320) from fix/dns-catalog-directory into main
Coulobre Panel CI / Checks (Python 3.12) (push) Successful in 2m10s
Coulobre Panel CI / Checks (Python 3.14) (push) Successful in 2m26s
Reviewed-on: #320
2026-12-05 13:12:14 +01:00
parkel 491c5900cb Keep the BIND catalog accessible under a restrictive umask
Coulobre Panel CI / Checks (Python 3.12) (pull_request) Successful in 2m3s
Coulobre Panel CI / Checks (Python 3.14) (pull_request) Successful in 2m16s
2026-12-05 01:28:05 +01:00
3 changed files with 55 additions and 9 deletions

No files matched your search

+12 -1
View File
@@ -2,6 +2,7 @@ import argparse
import grp
import json
import os
import stat
import subprocess
from contextlib import suppress
from pathlib import Path
@@ -60,7 +61,17 @@ def seed_catalog():
from coulobre.domain_names import canonical_domain
from coulobre.node_files import read_root_file
engine.root_directory(PATH.parent)
directory = PATH.parent
mode = 0o2750
engine.root_directory(directory, mode=mode)
info = directory.lstat()
group = grp.getgrnam("bind").gr_gid
if info.st_gid != group:
os.chown(directory, -1, group, follow_symlinks=False)
# mkdir honors the caller's umask, but BIND must be able to traverse
# this directory even when setup is run with a restrictive umask.
if info.st_gid != group or stat.S_IMODE(info.st_mode) != mode:
directory.chmod(mode)
if PATH.exists():
engine.root_file(PATH, 0o644)
return
+29 -8
View File
@@ -342,13 +342,32 @@ console. To update only OS and service packages, use **Server packages**.
If APT lists a Coulobre update there, apply the Coulobre package first and
refresh the server package list.
If an upgrade fails, inspect `/var/lib/coulobre-update/` as root and use
the [recovery procedure](#install-a-compatible-release-from-the-panel) when recovery is
required. Once the issue is resolved, run `sudo dpkg --configure -a` to
finish configuration. For a full downgrade, restore the server snapshot
including the package database. Removing the package removes its staged
installer and remote installation service. The configured panel runtime,
service configuration and customer data remain on the server.
### Recover a failed APT upgrade
Inspect `/var/lib/coulobre-update/status.json` as root. The `recovery` field,
when present, names the directory with the private `update.log` and the
recovery files. If APT reports that linked receivers were not staged and
the running panel has not changed, use the
[linked-node upgrade procedure](#coordinate-a-release-across-linked-mail-and-dns-receivers).
If the status is `failed` and the previous runtime is healthy, fix the
reported pre-upgrade problem before retrying package configuration.
If the status is `recovery_required`, the wheel or database may already
have changed even though APT reports that the package is not configured.
Do not retry APT yet. Fix the cause and follow the
[panel runtime recovery procedure](#install-a-compatible-release-from-the-panel).
After the previous runtime, database and services are healthy and the
failed `status.json` has been archived, run `sudo dpkg --configure -a` to
apply the pending package. Confirm that `sudo dpkg --audit` reports no
problems and that the panel reports the target version. For linked
installations, keep receiver provisioning paused until all participating
panels and receivers are healthy and on the target release.
Restoring the panel runtime does not downgrade the APT package. For a full
downgrade, restore the server snapshot including the package database.
Removing the package is not a recovery procedure. It removes the staged
installer and remote installation service, but leaves the configured panel
runtime, service configuration and customer data on the server.
Web-initiated APT output is in `/var/lib/coulobre-update/apt-update.log`.
If the web launcher was interrupted, verify that `coulobre-apt-update.service`
@@ -3893,7 +3912,9 @@ On an existing catalog primary, rerun the primary command from the current
release using the same peer address. This grants the DNS apply service
write access to the catalog directory while retaining its filesystem
sandbox. It preserves the catalog, managed zones, and transfer key. The
secondary does not need this permission.
command also repairs the catalog directory's access for BIND if setup
previously ran with a restrictive umask. The secondary does not need the
DNS apply service's write permission.
When upgrading a catalog primary from 1.2.0 or earlier, apply this step
before resuming DNS provisioning. On an APT-managed primary, run
+14
View File
@@ -1,4 +1,5 @@
import os
import stat
import tempfile
import unittest
from functools import partial
@@ -113,16 +114,29 @@ class DNSCatalogSandboxTests(unittest.TestCase):
self.run_command.call_args_list,
)
def test_primary_catalog_is_traversable_with_a_restrictive_umask(self):
previous = os.umask(0o077)
try:
secondary.setup("primary", self.peer)
finally:
os.umask(previous)
self.assertEqual(stat.S_IMODE(self.seed.parent.stat().st_mode), 0o2750)
self.assertEqual(self.seed.parent.stat().st_gid, os.getgid())
self.assertEqual(stat.S_IMODE(self.seed.stat().st_mode), 0o644)
def test_existing_primary_without_override_gets_one(self):
self.config.write_text(secondary.configuration("primary", self.peer))
self.seed.parent.mkdir()
catalog = dns_catalog.render_catalog(17, {"site.test"})
self.seed.write_text(catalog)
self.seed.parent.chmod(0o2700)
secondary.setup("primary", self.peer)
self.assertEqual(self.override.read_text(), self.override_text)
self.assertEqual(self.seed.read_text(), catalog)
self.assertEqual(stat.S_IMODE(self.seed.parent.stat().st_mode), 0o2750)
def test_existing_primary_keeps_zones_key_and_manual_override(self):
self.config.write_text(secondary.configuration("primary", self.peer))