Gas City pack: bao proxy for the city's OpenBao token on a unix socket, and an order that renews it
This repository has been archived on 2026-11-20. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Mikhail Lukianchenko 723e4f0905
All checks were successful
release / release (push) Successful in 5s
test / lint (push) Successful in 5s
test / scripts (push) Successful in 2s
test / changelog (push) Successful in 5s
openbao pack: bao proxy for the city's token, and its renewal
Assisted-By: Claude <noreply@anthropic.com>
2026-11-12 19:36:50 +01:00
.forgejo/workflows openbao pack: bao proxy for the city's token, and its renewal 2026-11-12 19:36:50 +01:00
agents/proxy openbao pack: bao proxy for the city's token, and its renewal 2026-11-12 19:36:50 +01:00
assets/scripts openbao pack: bao proxy for the city's token, and its renewal 2026-11-12 19:36:50 +01:00
orders openbao pack: bao proxy for the city's token, and its renewal 2026-11-12 19:36:50 +01:00
tests openbao pack: bao proxy for the city's token, and its renewal 2026-11-12 19:36:50 +01:00
.gitignore openbao pack: bao proxy for the city's token, and its renewal 2026-11-12 19:36:50 +01:00
CHANGELOG.md openbao pack: bao proxy for the city's token, and its renewal 2026-11-12 19:36:50 +01:00
pack.toml openbao pack: bao proxy for the city's token, and its renewal 2026-11-12 19:36:50 +01:00
README.md openbao pack: bao proxy for the city's token, and its renewal 2026-11-12 19:36:50 +01:00

gascity-openbao-pack

A Gas City pack that gives a city an OpenBao identity of its own. The agent proxy runs bao proxy for the city's token on a unix socket, and the order renew keeps the token alive. A client of the socket sends no token: the proxy forces the city's and caches what it reads.

The pack holds nothing about a particular server, token or socket. The city names all three.

Importing

  1. Put the city's token in a file only the city's user can read.

  2. Import the pack at the city level, and give the agent and the order their environment:

    # pack.toml
    [imports.openbao]
    source = "https://sarak.sh/mikluko/gascity-openbao-pack.git"
    version = "^0.1"
    
    [[patches.agent]]
    name = "openbao.proxy"
    env = { BAO_ADDR = "https://bao.example.com", OPENBAO_TOKEN_FILE = "/home/city/.config/city/openbao-token", OPENBAO_SOCKET = "/home/city/.config/city/openbao.sock" }
    
    # city.toml
    [[orders.overrides]]
    name = "renew"
    env = { BAO_ADDR = "https://bao.example.com", OPENBAO_TOKEN_FILE = "/home/city/.config/city/openbao-token" }
    

    An exec order does not receive the agent's environment or workspace.env, so the order gets its own.

  3. Read a secret through the socket to check it:

    BAO_ADDR=unix:///home/city/.config/city/openbao.sock bao kv get -mount=kv some/path
    

A session provider that needs to be told the proxy has no terminal is told in the same patch; rexcity takes REXCITY_BOX = "process".

Reference

Agent proxy

An always-on named session of the city, one at a time, with no prompt. It starts assets/scripts/proxy.sh, which writes the configuration of bao proxy to .gc/runtime/packs/openbao/proxy.json and then becomes bao proxy.

Variable Meaning
BAO_ADDR the OpenBao server
OPENBAO_TOKEN_FILE the file that holds the token; read once, at start
OPENBAO_SOCKET the unix socket to listen on, created with no access for group or others

The script exits without starting the proxy when one of them is unset. A file left at OPENBAO_SOCKET is removed before the proxy starts. The proxy caches KV reads in memory and serves every request with the city's token, whatever token the client sends.

bao and jq must be on the supervisor's PATH.

Order renew

Renews the token in OPENBAO_TOKEN_FILE at BAO_ADDR every hour, with bao token renew. It talks to the server directly, so the token stays alive while the proxy is down. It needs BAO_ADDR and OPENBAO_TOKEN_FILE, given as under Importing.

Development

gc lint .
bash tests/proxy.sh
bash tests/renew.sh

The tests run the scripts against a stub bao, with nothing but bash and jq.

Releases

A pull request notes its change in a file of its own in .changelog/, a fragment, and never edits CHANGELOG.md. A fragment holds level-3 type headings and the notes under them, as they would read under [Unreleased]. test / changelog fails a pull request that adds none.

A release is a pull request that turns the fragments into a version section of CHANGELOG.md. Cut it on a branch from main with:

go run sarak.sh/mikluko/changelog/v2/cmd/changelog@latest release

When it merges, the release workflow tags the commit vX.Y.Z and creates the Forgejo release. An import follows the releases with version = "^0.N".