A minimal runtime secrets unsealing service for containerized applications.
This project provides a lightweight Axum-based HTTP server designed to securely inject secrets (such as API keys or configuration) into containerized services at runtime, without the need for heavy infrastructure like Vault.
- The unsealer exposes a single endpoint:
POST /init - You send a NaCl-encrypted payload as base64url via the
configfield in a JSON body. - The server decrypts the payload using its private key and your public key.
- It spawns the target service, either:
- passing the decoded JSON as a base64-encoded argument, or
- setting individual keys as environment variables (
format=env)
| Variable | Description |
|---|---|
PORT |
Port to bind the HTTP server (default: 3000) |
SERVER_PRIVATE_KEY |
Base64-encoded NaCl private key of the unsealer |
UNSEAL_PUBLIC_KEY |
Base64-encoded NaCl public key of the trusted client |
COMMAND |
Command to run (e.g. ./service) after successful unseal |
Endpoint: POST /init?format=json|env
Content-Type: application/json
{
"config": "<base64url(NONCE + CIPHERTEXT)>"
}- The
configmust be encrypted using NaClBox, with:- The client's private key
- The unsealer's public key
curl -X POST http://localhost:3000/init?format=json \
-H "Content-Type: application/json" \
-d '{"config": "<base64url-encoded-data>"}'Keys are 32-byte NaCl keypairs encoded in base64.
To generate compatible keys using PyNaCl:
from nacl.public import PrivateKey
import base64
sk = PrivateKey.generate()
pk = sk.public_key
print("Private Key:", base64.b64encode(sk.encode()).decode())
print("Public Key: ", base64.b64encode(pk.encode()).decode())cargo build --releaseThis produces a single static unsealer binary you can embed in any container image.
FROM node:lts
COPY unsealer /usr/local/bin/unsealer
CMD ["unsealer"]- All secrets must be encrypted on the client side before transmission.
- Payloads should be short-lived or one-time-use to prevent replay attacks (future enhancement).
- Consider HTTPS or reverse proxy termination in production.
MIT