HUB
Sign inSign up

psyb0t/lockbox

By psyb0t

•Updated 18 days ago

Locked-down SSH container with sandboxed file operations. Use as a base image to build your own d...

Image
0

5.6K

psyb0t/lockbox repository overview

Source⁠ | Project page⁠

⁠lockbox

CI version license Docker Pulls

Locked-down SSH container with sandboxed file operations. Use it as a base image for your own tool containers: list the allowed commands and install your binaries. No shell access, no injection bullshit.

Skip the HTTP API wrapper. Any CLI tool becomes a remote service over SSH. No REST endpoints, no request parsing, no serialization layer. Just ssh myapp@host "tool --flag arg" and you're done. Route it through Cloudflare Tunnel or Tailscale and you've got remote access without exposing a port.

⁠Contents

⁠What you get

  • SSH key auth only. Passwords off, root login off, one allowed user.
  • No shell access. A Python wrapper is the forced command for every connection. It splits the command with shlex.split() and runs it with os.execv(). No shell is involved at any point.
  • No injection. &&, ;, |, $() are just literal arguments. No shell means shell metacharacters are meaningless.
  • Allowlist only. If the command isn't a built-in or in allowed.json, it doesn't run.
  • File ops over SSH. put, get, list-files, remove-file, create-dir, remove-dir, remove-dir-recursive, move-file, copy-file, file-info, file-exists, file-hash, disk-usage, search-files and append-file, all locked to /work (search-files can still list names outside it, see the security page).
  • No forwarding. TCP forwarding, tunneling, agent forwarding and X11 are all off.
  • Installer generator. Turn a YAML file into a curl | sudo bash installer and host CLI for your image.

The /work sandbox covers the built-in file ops. Allowed tools get their arguments as sent, so pick them carefully. The security page⁠ has the details and the known gaps.

⁠Quick start

Create allowed.json with your commands:

{
  "ffmpeg": "/usr/bin/ffmpeg",
  "ffprobe": "/usr/bin/ffprobe"
}

Create your Dockerfile:

FROM psyb0t/lockbox

ENV LOCKBOX_USER=myapp

RUN apt-get update && \
    apt-get install -y --no-install-recommends ffmpeg && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

COPY allowed.json /etc/lockbox/allowed.json

Build and run:

docker build -t myapp .
cat ~/.ssh/id_ed25519.pub > authorized_keys
mkdir -p work host_keys

docker run -d \
  --name myapp \
  --restart unless-stopped \
  -p 2222:22 \
  -e "LOCKBOX_UID=$(id -u)" \
  -e "LOCKBOX_GID=$(id -g)" \
  -v "$(pwd)/authorized_keys:/etc/lockbox/authorized_keys:ro" \
  -v "$(pwd)/host_keys:/etc/lockbox/host_keys" \
  -v "$(pwd)/work:/work" \
  myapp

ssh -p 2222 myapp@localhost "ffmpeg -version"

Files go in and out through the built-ins:

ssh -p 2222 myapp@localhost "put input.mp4" < input.mp4

ssh -p 2222 myapp@localhost \
  "ffmpeg -i /work/input.mp4 -vn /work/audio.mp3"

ssh -p 2222 myapp@localhost "get audio.mp3" > audio.mp3

⁠Documentation

Everything else lives on the documentation site: https://psyb0t.github.io/docker-lockbox/⁠

PageWhat's there
Getting started⁠The quick start above, step by step
File operations⁠All 15 built-ins: arguments, output, errors
Configuration⁠allowed.json, LOCKBOX_USER/UID/GID, volumes, entrypoint.d hooks
Installer generator⁠create_installer.sh: config format, generated files, the host CLI
Security⁠What a key holder can and can't do, and the known gaps
Architecture⁠Container start and the path of a command
Troubleshooting⁠Error messages, causes and fixes
Development⁠Make targets, tests, CI and releases

⁠Built on lockbox

ImageDescription
psyb0t/mediaproc⁠FFmpeg, Sox, ImageMagick and 2200+ fonts for media processing over SSH
psyb0t/qwenspeak⁠Qwen3-TTS text-to-speech over SSH with preset voices, voice cloning and voice design

⁠Sponsor

Buy Me a Coffee

⁠License

This project is licensed under WTFPL⁠, the Do What The Fuck You Want To Public License.

Tag summary

Content type

Image

Digest

sha256:04cda1934…

Size

44.8 MB

Last updated

18 days ago

docker pull psyb0t/lockbox