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>
This commit is contained in:
1 parent
0eff098140
commit
11c9483a88
15 files changed
+399
-5
No files matched your search
@@ -0,0 +1,21 @@
|
||||
# A tiny SSH server for the docker-compose demo. It trusts certificates signed by the CA in OpenBao's ssh/
|
||||
# engine: the entrypoint fetches the CA public key from OpenBao at start-up. Throwaway; not hardened for real use.
|
||||
FROM alpine:3.22
|
||||
|
||||
RUN apk add --no-cache openssh-server curl \
|
||||
&& ssh-keygen -A \
|
||||
&& for u in deploy alice; do \
|
||||
adduser -D -s /bin/sh "$u" \
|
||||
# sshd refuses locked accounts even for key logins, so give each a random password (password logins are off).
|
||||
&& echo "$u:$(head -c 24 /dev/urandom | base64)" | chpasswd; \
|
||||
done
|
||||
|
||||
COPY sshd_config /etc/ssh/sshd_config
|
||||
COPY sample-data/deploy/ /home/deploy/
|
||||
COPY sample-data/alice/ /home/alice/
|
||||
RUN chown -R deploy:deploy /home/deploy && chown -R alice:alice /home/alice
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
EXPOSE 22
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/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
|
||||
@@ -0,0 +1,3 @@
|
||||
Alice's notes (sample data)
|
||||
- rotate the staging database password
|
||||
- ask platform about the new SSH role
|
||||
@@ -0,0 +1,2 @@
|
||||
You are logged in as "deploy" on the EnvBao demo SSH server, using a certificate signed by OpenBao.
|
||||
Everything in this container is sample data.
|
||||
@@ -0,0 +1,6 @@
|
||||
# sample application config (fake values)
|
||||
service: orders-api
|
||||
environment: demo
|
||||
database:
|
||||
host: postgres
|
||||
name: app
|
||||
@@ -0,0 +1,12 @@
|
||||
# Certificate logins only: no passwords, no root.
|
||||
Port 22
|
||||
HostKey /etc/ssh/ssh_host_ed25519_key
|
||||
HostKey /etc/ssh/ssh_host_rsa_key
|
||||
PasswordAuthentication no
|
||||
KbdInteractiveAuthentication no
|
||||
PermitRootLogin no
|
||||
PubkeyAuthentication yes
|
||||
AllowUsers deploy alice
|
||||
# Written by entrypoint.sh from OpenBao's ssh/ engine.
|
||||
TrustedUserCAKeys /etc/ssh/trusted-user-ca-keys.pem
|
||||
LogLevel VERBOSE
|
||||
Reference in new issue
Block a user