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

This commit is contained in:
parkel committed 2026-12-05 01:28:05 +01:00
1 parent 970243c324
commit 491c5900cb
3 files changed
+29 -2

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