forked from mtusi2026/mtusi2026lab7
fix(security): scope row locks and add explicit expiry recovery
This commit is contained in:
+20
-1
@@ -7,7 +7,7 @@ import subprocess
|
||||
import time
|
||||
|
||||
from scripts.bao_operator import Operator
|
||||
from scripts.bootstrap_security import OPERATOR, generate
|
||||
from scripts.bootstrap_security import OPERATOR, ROLES, generate
|
||||
from scripts.credentials import repair
|
||||
from scripts.prepare_dependencies import main as dependencies
|
||||
from scripts.prepare_dependencies import postgres
|
||||
@@ -17,6 +17,11 @@ from scripts.stand import ROOT, command, compose, ready
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--build", action="store_true")
|
||||
parser.add_argument(
|
||||
"--recover-expired",
|
||||
action="store_true",
|
||||
help="Explicit offline-CA recovery of expired service identities",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
generate()
|
||||
os.environ.setdefault("VCS_REF", command(["git", "rev-parse", "HEAD"]))
|
||||
@@ -28,6 +33,10 @@ def main():
|
||||
compose(
|
||||
"up", "-d", "--no-deps", "openbao", "postgres", "cache", "broker", "s3"
|
||||
)
|
||||
if args.recover_expired:
|
||||
from scripts.pki import recover_bao
|
||||
|
||||
recover_bao(all_roles=False)
|
||||
operator = Operator()
|
||||
try:
|
||||
for attempt in range(90):
|
||||
@@ -43,6 +52,10 @@ def main():
|
||||
operator.init()
|
||||
operator.unseal()
|
||||
operator.configure()
|
||||
if args.recover_expired:
|
||||
for role in ROLES:
|
||||
if role not in {"openbao", "lb", "migrate"}:
|
||||
repair(operator, role)
|
||||
# The maintenance identity is intentionally stopped between migrations.
|
||||
# Its expired leaf is repaired explicitly by the operator before reuse.
|
||||
repair(operator, "migrate")
|
||||
@@ -84,6 +97,12 @@ def main():
|
||||
compose("wait", "telemetry-init")
|
||||
backends = ["otel", "prometheus", "loki", "tempo", "grafana", "lb"]
|
||||
compose("up", "-d", "--no-deps", *backends)
|
||||
if args.recover_expired:
|
||||
operator = Operator()
|
||||
try:
|
||||
repair(operator, "lb")
|
||||
finally:
|
||||
operator.close()
|
||||
gates = [
|
||||
r + "-tls"
|
||||
for r in [
|
||||
|
||||
Reference in New Issue
Block a user