20613afb26
Add a Vault/OpenBao secrets engine that mints ephemeral, scoped Gitea access tokens on demand. The engine holds a single seeded Gitea site-admin Basic-Auth credential and, per role, mints a fresh per-user token via the admin API, bound to a Vault lease and deleted from Gitea on revocation. Gitea requires Basic Auth for token management (token auth is rejected), and reqSelfOrAdmin lets a site admin manage any user's tokens, which is the mechanism this relies on. Gitea tokens never expire server-side, so the Vault lease is the sole expiry mechanism. - add backend wiring, config (+ rotate-root), roles, creds paths - add the gitea client (Basic Auth create/delete token, admin password change) - add scope validation against Gitea's access-token scope set - add unit tests (fake Gitea API) and a Vault+OpenBao e2e harness - add Makefile, nfpm RPM packaging, and Woodpecker build/test/release pipelines Claude-Session: https://claude.ai/code/session_015ur3i7D2azsMAWTSVABApv
65 lines
1.9 KiB
YAML
65 lines
1.9 KiB
YAML
# End-to-end test stack. A mock Gitea REST API (in-memory, no db/git) plus two
|
|
# secrets-engine hosts running the exact same plugin binary: HashiCorp Vault and
|
|
# OpenBao. Bind mounts use ":z" so they work under SELinux.
|
|
services:
|
|
gitea:
|
|
image: golang:1.25-alpine
|
|
working_dir: /src
|
|
environment:
|
|
MOCKGITEA_ADDR: ":3000"
|
|
MOCKGITEA_ADMIN_USER: "bot-admin"
|
|
MOCKGITEA_ADMIN_PASS: "seed-password"
|
|
GOFLAGS: "-mod=mod"
|
|
command: ["go", "run", "./test/mockgitea"]
|
|
volumes:
|
|
- ..:/src:ro,z
|
|
ports:
|
|
- "3000:3000"
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://localhost:3000/healthz"]
|
|
interval: 3s
|
|
timeout: 3s
|
|
retries: 40
|
|
|
|
vault:
|
|
image: hashicorp/vault:1.18
|
|
depends_on:
|
|
gitea:
|
|
condition: service_healthy
|
|
cap_add: [IPC_LOCK]
|
|
environment:
|
|
VAULT_DEV_ROOT_TOKEN_ID: root
|
|
VAULT_ADDR: http://127.0.0.1:8200
|
|
VAULT_TOKEN: root
|
|
command: ["server", "-dev", "-dev-listen-address=0.0.0.0:8200", "-config=/vault/vault.hcl"]
|
|
volumes:
|
|
- ../dist:/vault/plugins:ro,z
|
|
- ./vault/vault.hcl:/vault/vault.hcl:ro,z
|
|
ports: ["8200:8200"]
|
|
healthcheck:
|
|
test: ["CMD", "vault", "status", "-address=http://127.0.0.1:8200"]
|
|
interval: 3s
|
|
timeout: 3s
|
|
retries: 20
|
|
|
|
openbao:
|
|
image: openbao/openbao:latest
|
|
depends_on:
|
|
gitea:
|
|
condition: service_healthy
|
|
cap_add: [IPC_LOCK]
|
|
environment:
|
|
BAO_DEV_ROOT_TOKEN_ID: root
|
|
BAO_ADDR: http://127.0.0.1:8200
|
|
BAO_TOKEN: root
|
|
command: ["server", "-dev", "-dev-listen-address=0.0.0.0:8200", "-config=/openbao/bao.hcl"]
|
|
volumes:
|
|
- ../dist:/openbao/plugins:ro,z
|
|
- ./openbao/bao.hcl:/openbao/bao.hcl:ro,z
|
|
ports: ["8300:8200"]
|
|
healthcheck:
|
|
test: ["CMD", "bao", "status", "-address=http://127.0.0.1:8200"]
|
|
interval: 3s
|
|
timeout: 3s
|
|
retries: 20
|