fix(security): enforce S3 boundaries and configure persistent audit

This commit is contained in:
2026-11-20 19:35:35 +03:00
parent d6957b2f79
commit 7f6e8cbd27
13 changed files with 7976 additions and 34 deletions
+19 -21
View File
@@ -72,16 +72,25 @@ class Operator:
def unseal(self):
state = self.call("GET", "sys/seal-status")
if not state["sealed"]:
return
for index in [1, 2]:
share = json.loads(
(OPERATOR / ("unseal-" + str(index) + ".json")).read_text()
)
state = self.call("POST", "sys/unseal", {"key": share["key"]})
if not state["sealed"]:
if state["sealed"]:
for index in [1, 2]:
share = json.loads(
(OPERATOR / ("unseal-" + str(index) + ".json")).read_text()
)
state = self.call("POST", "sys/unseal", {"key": share["key"]})
if not state["sealed"]:
break
else:
raise RuntimeError("Unseal threshold not reached")
# Unsealed Raft still needs to elect the active node and load mounts
# and declarative audit devices. Do not retry bootstrap mutations.
deadline = time.monotonic() + 60
while time.monotonic() < deadline:
response = self.http.get("sys/health")
if response.status_code == 200:
return
raise RuntimeError("Unseal threshold not reached")
time.sleep(0.5)
raise TimeoutError("Unsealed OpenBao did not become active")
def authenticate(self):
cached = OPERATOR / "operator-token.json"
@@ -264,18 +273,7 @@ class Operator:
)
audit = root("GET", "sys/audit")
audit = audit.get("data", audit)
if "file/" not in audit:
root(
"PUT",
"sys/audit/file",
{
"type": "file",
"options": {
"file_path": "/data/audit/audit.log",
"mode": "0600",
},
},
)
assert "file/" in audit, "Declarative persistent audit must be enabled"
created = root(
"POST",
"auth/token/create-orphan",