OpenBao: bootstrap, policies и PKI lifecycle
Pinned OpenBao2.7.2 runs as UID100:1000, not dev-mode. NativeHTTPS8200,
Raftvolume /openbao/file, auditvolume /openbao/audit; clusterlistener8201
is loopback. server.hcl declares TLS1.2+, clientCA and persistentHMAC audit
with log_raw=false. Browser/operator endpoint is loopbackHTTPS, not publicadmin.
Запуск и custody
cp .env.example .env
make prepare
make up
make test test-security test-lab7
make up builds the application, preparesrolefiles, runsvolumeownershipjob,
startsBao, performs firstinit (3shares, threshold2), operatorunseal and scoped
provisioning, createsDB/S3roles/bucket, runsmigrations, startsapps andwaits for
CA/hostname-verifiedHTTPS and full64KiBS3bodyreadiness. RunningAPI restart does
not requireunseal. AfterBao restart:
make bao-unseal
# Or complete namespace-aware storage/application restart:
python3 scripts/securityctl.py restart
Offline rootCA/privatekey and operator-unseal.json are outsidecheckout:
~/.local/share/mtusi-lab7/<COMPOSE_PROJECT_NAME> (0700directory,0600files),
optionally overridden by LAB7_OPERATOR_STATE. They are never mounted into
containers. Operatorhost/Dockeraccess is trusted. Protect and back up this state;
losingunsealshares cannot be repaired by readingBao'sencryptedRaftvolume.
Initialroot token is used only for provisioning. After verifyingseparate operatorcert-auth, bootstraprevokesit, confirms403 and removesit fromstate. App/worker/relay receive only ownleaf+ownconfidentialKVconfiguration, notroot, unsealshares, sharedBAO_TOKEN or a staticbootstrapsecret.
Identity и policies
securityctl.py applies KVv2 at secret/, cert/ auth and pki/intermediate.
Operator signs anintermediateCSR withoffline root; itsprivatekey remains inside
BaoRaft, not at thehost. Serviceauth binds bothCN and URIspiffe://mtusi/<role>.
| Role | ReadableKV | Issuance | Othercapabilities |
|---|---|---|---|
| api | secret/data/api | pki/issue/api | tokenlookup/renew/revoke-self |
| worker | secret/data/worker | pki/issue/worker | tokenlookup/renew/revoke-self |
| relay | secret/data/relay | pki/issue/relay | tokenlookup/renew/revoke-self |
| Othernative service | None | Itsownpki/issue/ | tokenlookup/renew/revoke-self |
| operator | ManagedKVandPKI | Managedroles/issuers | Restrictedlab7policies/certauth/seal/auditinspection; no permanentroot token |
Servicepolicy cannot readforeignKV, issueforeignrole or writepolicy. Live
make test-lab7 returns ownKV200 andforeignKV/issuer/policyadmin403. KVbackend
passwords/keys remain static until explicitrotation; tokenTTL is not theirTTL.
Cert-auth tokenTTL60s/max300s. Go admission is bounded independently by actualtokenlease, KVfreshness60s and currentleafNotAfter, with a1s safetymargin. Renewal/reauth must succeed beforedeadlines; sealed/unavailableBao cannot widen a cachedlease. A firstcancellation fixes one30s shutdownbudget for allcleanup.
Leaf publication и renewal
make pki-issue ROLE=api CERT_TTL=1h
make pki-renew ROLE=api CERT_TTL=1h
make renew-watch ROLE=api CERT_TTL=1h
NormalleafTTL1h/max24h. Watcher uses ownservicecert-auth and renews at half of
remaininglifetime. Allcertificate/key/CA/CRL files are prepared in immutable
pki/<role>/versions/<name> with runtime-readableownership. Nativeconsumers
use current; Go uses one atomicregular current-version selector. TLSfile
settings still namecurrentbasenames; TLS_VERSION_FILE identifies theselector.
Go cannot mixfiles or fail because a hot-swap traversed thesymlink. Invalid,
missing, stale or revokedmaterial remains fail-closed; no insecure/cachefallback.
Go hotloadsleaf/CRL; CAtrustchanges restartprocesses. NativeHAProxy, PostgreSQL,
S3, RabbitMQ, Collector/Grafana clients use explicitreload/recreate paths. A shared
namespaceconsumer is recreated against actualowner afterownerrestart. up
also reappliesnativegateways whenownercontainers are reused.
Отзыв, staticsecret и CArollover
# Issue/reload the replacement before revoking itsoldserial:
python3 scripts/securityctl.py revoke lb --serial OLD_SERIAL
python3 scripts/securityctl.py rotate-secret worker
python3 scripts/securityctl.py ca-rollover --phase prepare
python3 scripts/securityctl.py ca-rollover --phase issue
python3 scripts/securityctl.py ca-rollover --phase retire
python3 scripts/securityctl.py audit-summary
Revocation publishesissuerCRLs toallroles/Baoauth, then reloads anddrains native HAProxy consumers. Go validates CRLissuer/signature/ThisUpdate/NextUpdate/serial for everyissuer, includingroot-issuedintermediateCRL. Offline rootCRLs refresh before their final24h. This does not claim revocation of RabbitMQprincipal from CRL alone: compromise requires user/connection closure and token/credential/auth role disable as documented inthreatmodel.
WorkerS3rotation changesonlyitskey, updatesownKV, restartsS3+worker withoutimage build andchecksnewqueuedattachmentprocessing. Oldkey must return403.
CAprepare retainsold/newCA+CRLtrust; issue switchesissuer andallmanagedleaves; retire removesoldCA/issuer/authCRLs. Nativeconsumers reload/drain at eachphase. No statement of zero-downtimeCArollover: errors/recovery are measured underload.
Recovery и безопасная остановка
python3 scripts/securityctl.py recover openbao
python3 scripts/securityctl.py recover api
make up
make down
ExpiredBao/operatortransport can be replaced byofflineoperatorleaf for verified
restart/unseal, then a restrictedBao-issuedleaf. Never disableCAverification.
make down preservesRaft/applicationvolumes andoperatorstate. Intentional deletion
of your syntheticstand data: docker compose --env-file .env down --volumes;
it does not deleteofflineoperatorstate, which must be managed separately and
never reused accidentally with unrelatedvolumes.
make test-pki executes3freshisolatedprojects with20s APIleaves, renewal/expiry,
oldleafrevoke, workerkeyrotation, CAprepare/issue/retire, telemetry/nativeTLS checks
and retaineddata. Cleanup is restricted to itsgeneratedproject/volumes/operator
state; existinglab6volumes are not removed. Fullresults/limitations belong in
REPORT, trustmatrix and
evidence/lab7/track2.json.