Files
envbao-admin/docker/sshd/entrypoint.sh
T
mattandClaude Sonnet 5.5 11c9483a88 Demo and CI: Postgres and SSH server for the dynamic engines
docker compose now runs a Postgres with sample tables and an SSH server
that trusts the CA in OpenBao's ssh/ engine. seed.sh configures the
database engine (dynamic and static roles), the ssh CA and a role, a few
live leases, and grants for alice and the platform group. CI gains a
Postgres service so the database engine and its admin-policy rules are
tested against a real database (skipped when BAO_PG_URL is unset).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 13:58:59 +00:00

16 lines
529 B
Bash

#!/bin/sh
# Wait for OpenBao's SSH CA (generated by docker/seed.sh), trust it, then run sshd in the foreground.
set -eu
CA_URL="${BAO_ADDR:-http://openbao:8200}/v1/ssh/public_key"
i=0
until curl -fsS "$CA_URL" -o /etc/ssh/trusted-user-ca-keys.pem 2>/dev/null && [ -s /etc/ssh/trusted-user-ca-keys.pem ]; do
i=$((i + 1))
[ "$i" -le 60 ] || { echo "No SSH CA at $CA_URL after 60 tries" >&2; exit 1; }
echo "Waiting for the SSH CA at $CA_URL ..."
sleep 2
done
echo "Trusting the CA from $CA_URL"
exec /usr/sbin/sshd -D -e