# OpenBao allow/deny, root credential отсутствует в app
# 2026-11-28T14:15:50+00:00

$ C:\Program Files\Git\bin\bash.exe scripts\bao_check.sh
== api
service api: OpenBao https://openbao:8200 (TLS verified against /run/secrets/internal-ca.crt)
  PASS  allow  AppRole login with the service's role_id/secret_id         -> HTTP 200
         token policies=['api'] ttl=3600s renewable=True
  PASS  allow  read own path messenger/data/api                           -> HTTP 200
         keys: ['cache_url', 'database_url', 's3_access_key_id', 's3_secret_access_key']
  PASS  allow  token lookup-self                                          -> HTTP 200
  PASS  deny   read other service's path messenger/data/relay             -> HTTP 403
  PASS  deny   read other service's path messenger/data/worker            -> HTTP 403
  PASS  deny   write own path messenger/data/api                          -> HTTP 403
  PASS  deny   list messenger/metadata                                    -> HTTP 403
  PASS  deny   write policy sys/policies/acl/api                          -> HTTP 403
  PASS  deny   read policy list sys/policies/acl                          -> HTTP 403
  PASS  deny   create a child token auth/token/create                     -> HTTP 403
  PASS  deny   enable an auth method sys/auth/userpass                    -> HTTP 403
  PASS  deny   read sys/mounts                                            -> HTTP 403
  PASS  allow  revoke-self                                                -> HTTP 204
  PASS  deny   use the token after revoke-self (lookup-self)              -> HTTP 403
  PASS  deny   read own path with the revoked token                       -> HTTP 403
  PASS  deny   AppRole login with a wrong secret_id                       -> HTTP 400
PASS: OpenBao policy of api, 0 failure(s)
== relay
service relay: OpenBao https://openbao:8200 (TLS verified against /run/secrets/internal-ca.crt)
  PASS  allow  AppRole login with the service's role_id/secret_id         -> HTTP 200
         token policies=['relay'] ttl=3600s renewable=True
  PASS  allow  read own path messenger/data/relay                         -> HTTP 200
         keys: ['broker_url', 'database_url']
  PASS  allow  token lookup-self                                          -> HTTP 200
  PASS  deny   read other service's path messenger/data/api               -> HTTP 403
  PASS  deny   read other service's path messenger/data/worker            -> HTTP 403
  PASS  deny   write own path messenger/data/relay                        -> HTTP 403
  PASS  deny   list messenger/metadata                                    -> HTTP 403
  PASS  deny   write policy sys/policies/acl/relay                        -> HTTP 403
  PASS  deny   read policy list sys/policies/acl                          -> HTTP 403
  PASS  deny   create a child token auth/token/create                     -> HTTP 403
  PASS  deny   enable an auth method sys/auth/userpass                    -> HTTP 403
  PASS  deny   read sys/mounts                                            -> HTTP 403
  PASS  allow  revoke-self                                                -> HTTP 204
  PASS  deny   use the token after revoke-self (lookup-self)              -> HTTP 403
  PASS  deny   read own path with the revoked token                       -> HTTP 403
  PASS  deny   AppRole login with a wrong secret_id                       -> HTTP 400
PASS: OpenBao policy of relay, 0 failure(s)
== worker
service worker: OpenBao https://openbao:8200 (TLS verified against /run/secrets/internal-ca.crt)
  PASS  allow  AppRole login with the service's role_id/secret_id         -> HTTP 200
         token policies=['worker'] ttl=3600s renewable=True
  PASS  allow  read own path messenger/data/worker                        -> HTTP 200
         keys: ['broker_url', 'database_url', 's3_access_key_id', 's3_secret_access_key']
  PASS  allow  token lookup-self                                          -> HTTP 200
  PASS  deny   read other service's path messenger/data/api               -> HTTP 403
  PASS  deny   read other service's path messenger/data/relay             -> HTTP 403
  PASS  deny   write own path messenger/data/worker                       -> HTTP 403
  PASS  deny   list messenger/metadata                                    -> HTTP 403
  PASS  deny   write policy sys/policies/acl/worker                       -> HTTP 403
  PASS  deny   read policy list sys/policies/acl                          -> HTTP 403
  PASS  deny   create a child token auth/token/create                     -> HTTP 403
  PASS  deny   enable an auth method sys/auth/userpass                    -> HTTP 403
  PASS  deny   read sys/mounts                                            -> HTTP 403
  PASS  allow  revoke-self                                                -> HTTP 204
  PASS  deny   use the token after revoke-self (lookup-self)              -> HTTP 403
  PASS  deny   read own path with the revoked token                       -> HTTP 403
  PASS  deny   AppRole login with a wrong secret_id                       -> HTTP 400
PASS: OpenBao policy of worker, 0 failure(s)

== root credential / unseal material in the application containers (values compared, never printed)
  PASS  api: no *TOKEN*/*UNSEAL*/*ROOT* environment variable
  PASS  control: own role_id found by the same search (/run/secrets/bao_role_id)
  PASS  api: root-token absent (/run/secrets, /app, /tmp, PID 1 environment)
  PASS  api: unseal-share-1 absent (/run/secrets, /app, /tmp, PID 1 environment)
  PASS  api: unseal-share-2 absent (/run/secrets, /app, /tmp, PID 1 environment)
  PASS  api: unseal-share-3 absent (/run/secrets, /app, /tmp, PID 1 environment)
        api /run/secrets: bao_role_id bao_secret_id internal-ca.crt service.crt service.key 
  PASS  relay: no *TOKEN*/*UNSEAL*/*ROOT* environment variable
  PASS  control: own role_id found by the same search (/run/secrets/bao_role_id)
  PASS  relay: root-token absent (/run/secrets, /app, /tmp, PID 1 environment)
  PASS  relay: unseal-share-1 absent (/run/secrets, /app, /tmp, PID 1 environment)
  PASS  relay: unseal-share-2 absent (/run/secrets, /app, /tmp, PID 1 environment)
  PASS  relay: unseal-share-3 absent (/run/secrets, /app, /tmp, PID 1 environment)
        relay /run/secrets: bao_role_id bao_secret_id internal-ca.crt service.crt service.key 
  PASS  worker: no *TOKEN*/*UNSEAL*/*ROOT* environment variable
  PASS  control: own role_id found by the same search (/run/secrets/bao_role_id)
  PASS  worker: root-token absent (/run/secrets, /app, /tmp, PID 1 environment)
  PASS  worker: unseal-share-1 absent (/run/secrets, /app, /tmp, PID 1 environment)
  PASS  worker: unseal-share-2 absent (/run/secrets, /app, /tmp, PID 1 environment)
  PASS  worker: unseal-share-3 absent (/run/secrets, /app, /tmp, PID 1 environment)
        worker /run/secrets: bao_role_id bao_secret_id internal-ca.crt service.crt service.key 
PASS: OpenBao allow/deny and no root credential in the application

[exit 0]

$ .venv\Scripts\python.exe scripts/bao_operator.py status
bao-operator: initialized=True sealed=False storage=raft version=2.7.3 operator_dir=C:\Users\wfa22\.mtusi-lab7-operator\mtusi-lab7-clean

[exit 0]
