feat(security): add operator rotation and recovery commands

This commit is contained in:
2026-11-20 19:02:00 +03:00
parent 1dd020d060
commit f2ea9d65a8
22 changed files with 983 additions and 46 deletions
+38 -1
View File
@@ -26,7 +26,44 @@ def command(args, *, input=None):
def compose(*args, input=None):
return command(["docker", "compose", *args], input=input)
if args[0] == "exec" and "controller" in args:
from scripts.operator_task import prepare
prepare()
result = command(["docker", "compose", *args], input=input)
# A restarted native container can get a new network namespace. Rejoin
# its TLS gateway explicitly instead of keeping an obsolete loopback hop.
native = {
"postgres",
"cache",
"broker",
"s3",
"lb",
"otel",
"prometheus",
"loki",
"tempo",
"grafana",
}
if args[0] in {"restart", "up"}:
targets = sorted(native.intersection(args[1:]))
if targets:
command(
[
"docker",
"compose",
"up",
"-d",
"--no-deps",
"--force-recreate",
*[role + "-tls" for role in targets],
]
)
if "lb" in targets:
command(
["docker", "compose", "up", "-d", "--no-deps", "identity-lb"]
)
return result
def sql(query, *, database="messenger"):