Install multiple panels and shared receivers from one inventory

This commit is contained in:
parkel committed 2026-11-26 22:10:34 +01:00
1 parent 0ade3ac001
commit 082f601f2a
12 files changed
+1361 -93

No files matched your search

+10 -1
View File
@@ -597,7 +597,12 @@ def main(argv=None):
if command == "authorize-scoped-panel":
action.add_argument("panel")
action.add_argument("public_key", type=Path)
action.add_argument("domains", nargs="+")
action.add_argument("domains", nargs="*")
action.add_argument(
"--empty",
action="store_true",
help="Authorize this identity with no hosted domains.",
)
action.add_argument("--keep-domains", action="store_true")
if command in {"begin-maintenance", "finish-maintenance"}:
action.add_argument("inventory", type=Path)
@@ -629,6 +634,10 @@ def main(argv=None):
authorize_panel(role, args.public_key)
print(f"Authorized the panel key for the {role.name} receiver.")
elif args.command == "authorize-scoped-panel":
if bool(args.domains) == args.empty:
raise ValueError(
"Supply hosted domains or explicitly use --empty."
)
account = authorize_scoped_panel(
role,
args.panel,
+3 -7
View File
@@ -46,13 +46,9 @@ def scope_path(account):
def scoped_domains(path):
require_root_directory(path.parent)
domains = json.loads(read_root_file(path, mode=0o600))
if (
not isinstance(domains, list)
or not domains
or any(
not isinstance(domain, str) or canonical_domain(domain) != domain
for domain in domains
)
if not isinstance(domains, list) or any(
not isinstance(domain, str) or canonical_domain(domain) != domain
for domain in domains
):
raise ValueError("The receiver has an invalid domain scope.")
return set(domains)
+14
View File
@@ -75,6 +75,20 @@ class ReceiverScopeTests(TestCase):
with self.assertRaisesRegex(ValueError, "not assigned"):
check_request("mail", MailQueueRequest(domain))
def test_empty_scope_allows_probes_and_denies_managed_domains(self):
with (
patch.object(
receiver_scope,
"socket_peer",
return_value="coulobre-mail-p-alpha",
),
patch.object(receiver_scope, "require_root_directory"),
patch.object(receiver_scope, "read_root_file", return_value="[]"),
):
check_request("mail")
with self.assertRaisesRegex(ValueError, "not assigned"):
check_request("mail", MailQueueRequest("alpha.example.test"))
def test_scope_is_enforced_before_dispatching_dns_operations(self):
zone = DnsZone(
"beta.example.test",