mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 21:36:40 -10:00
devvm secret set NAME --host HOST[,HOST…] --env VARIABLE [--header H] [--prefix P] [--stdin] saves a secret of your own: the value from a hidden prompt or stdin (never argv) into the Keychain or devvm's secrets folder, and its definition into custom-secrets.json. A VM that uses it (devvm secret use NAME) gets only a per-VM placeholder in VARIABLE, and its proxy puts the real value in that header only for those exact hosts, over TLS on 443; the hosts join that VM's allowlist. Names, hosts, headers, variables and prefixes are checked; wildcards, addresses, internal names and other ports are refused. One placeholder builder serves every secret and login, and the proxy caches values by kind, agent and name. After an independent review, a secret goes in only in four exact shapes (alone; Bearer, Token or a saved --scheme in Authorization; the Basic password; the Basic username only with --basic-user), values are printable ASCII under 3,800 bytes, the proxy checks each binding against its definition, definitions carry IDs and VMs record their hosts, and custom values are stored apart from the known secrets. Co-Authored-By: Claude Opus 5.5 <[email protected]>
258 lines
5.7 KiB
Plaintext
258 lines
5.7 KiB
Plaintext
# devvm's folders: their layout version, checked before every command
|
|
# that reads them, and every file devvm keeps for a VM with network
|
|
# policy, ports, a link and a secret, against the listings below. A
|
|
# change to the layout changes a listing: consider the layout version
|
|
# then (Contributing's state layout).
|
|
|
|
# The first run gives both folders this devvm's version.
|
|
exec devvm ls
|
|
cmp $DATA/version want/version
|
|
cmp $CFG/version want/version
|
|
|
|
# A newer devvm's folders are refused, before the command runs, and so
|
|
# is a version file devvm can't read; help, completion and the version
|
|
# still run.
|
|
cp want/newer $DATA/version
|
|
! exec devvm ls
|
|
stderr '^devvm: layout_newer current=1 path=\S+/data/devvm/version version=2$'
|
|
! stdout .
|
|
exec devvm --version
|
|
exec devvm version
|
|
exec devvm help
|
|
exec devvm completion bash
|
|
cmp $DATA/version want/newer
|
|
cp want/version $DATA/version
|
|
cp want/newer $CFG/version
|
|
! exec devvm doctor
|
|
stderr '^devvm: layout_newer current=1 path=\S+/config/devvm/version version=2$'
|
|
cp want/corrupt $CFG/version
|
|
! exec devvm ls
|
|
stderr '^devvm: layout_unchecked reason=\S+/config/devvm/version: not a layout version$'
|
|
rm $CFG/version
|
|
exec devvm ls
|
|
cmp $CFG/version want/version
|
|
|
|
# A target VM that publishes a port, and a client VM with a link to it
|
|
# and a secret, both with network policy and forwarding a port, one free
|
|
# on this host, so the forwarders start whatever else listens.
|
|
free_port PORT
|
|
exec devvm ports -g $PORT
|
|
project db
|
|
exec devvm --network allowlist --no-git-protect
|
|
exec devvm link publish 5432
|
|
project app
|
|
exec devvm --network allowlist --no-git-protect
|
|
exec devvm link add db 5432
|
|
stdin $WORK/github.token
|
|
exec devvm secret set github --stdin
|
|
exec devvm secret use github
|
|
stdin $WORK/stripe.token
|
|
exec devvm secret set stripe --host api.stripe.com --env STRIPE_API_KEY --stdin
|
|
exec devvm secret use stripe
|
|
vm_name APP app
|
|
vm_name DB db
|
|
vm_state $APP_dir/vm.json
|
|
stdout '^made_by=\S+$'
|
|
|
|
# Every file and folder, with the VMs' hashes named and other hashes,
|
|
# times and versions left out.
|
|
exec sh $WORK/list.sh $CFG
|
|
cmp stdout $WORK/config.txt
|
|
exec sh $WORK/list.sh $DATA
|
|
[darwin] cmp stdout $WORK/data.txt
|
|
[!darwin] cmp stdout $WORK/data-linux.txt
|
|
|
|
-- want/version --
|
|
1
|
|
-- want/newer --
|
|
2
|
|
-- want/corrupt --
|
|
one
|
|
-- github.token --
|
|
ghp_testfake
|
|
-- stripe.token --
|
|
sk_test_fake
|
|
-- list.sh --
|
|
# list.sh FOLDER: every path under FOLDER, sorted, with APP's and DB's
|
|
# hashes named and other hashes, times, versions and QEMU's architecture
|
|
# as X.
|
|
cd "$1" || exit 1
|
|
find . -mindepth 1 | sed -E \
|
|
-e 's|^\./||' -e 's/qemu-system-[a-z0-9_]+/qemu-system-X/' \
|
|
-e "s/${APP##*-}/APP/g" -e "s/${DB##*-}/DB/g" \
|
|
-e 's/[0-9a-f]{12,}/X/g' -e 's/[0-9]{8}-[0-9]{6}-[0-9]+/X/g' -e 's/[0-9]+\.[0-9]+\.[0-9]+/X/g' |
|
|
LC_ALL=C sort -u
|
|
-- config.txt --
|
|
version
|
|
-- data.txt --
|
|
custom-secrets.json
|
|
custom-secrets.lock
|
|
groups.lock
|
|
images
|
|
images/X
|
|
images/X/record.json
|
|
images/locks
|
|
images/locks/X
|
|
images/locks/packages
|
|
images/locks/ubuntu
|
|
images/ubuntu.json
|
|
logs
|
|
logs/runs
|
|
logs/runs/X.log
|
|
making.lock
|
|
packages
|
|
packages/sets
|
|
packages/sets/X.json
|
|
run
|
|
run/build-ports
|
|
run/builds
|
|
run/claims.lock
|
|
run/link-X.ctl
|
|
run/link-X.sock
|
|
settings.json
|
|
ssh_config
|
|
tools
|
|
version
|
|
version.lock
|
|
vms
|
|
vms/APP
|
|
vms/APP/lock
|
|
vms/APP/logs
|
|
vms/APP/logs/links.log
|
|
vms/APP/logs/network.jsonl
|
|
vms/APP/logs/ports.log
|
|
vms/APP/logs/proxy.log
|
|
vms/APP/run
|
|
vms/APP/run/ca
|
|
vms/APP/run/ca/ca.key
|
|
vms/APP/run/ca/ca.pem
|
|
vms/APP/run/ca/lock
|
|
vms/APP/run/ca/next.key
|
|
vms/APP/run/ca/next.pem
|
|
vms/APP/run/known_hosts
|
|
vms/APP/run/links.json
|
|
vms/APP/run/links.pid
|
|
vms/APP/run/ports.lock
|
|
vms/APP/run/ports.pid
|
|
vms/APP/run/ports.status
|
|
vms/APP/run/proxy.json
|
|
vms/APP/run/proxy.pid
|
|
vms/APP/run/proxy.status
|
|
vms/APP/run/sandbox.sb
|
|
vms/APP/run/secrets.json
|
|
vms/APP/run/secrets.policy
|
|
vms/APP/run/started
|
|
vms/APP/vm.json
|
|
vms/DB
|
|
vms/DB/lock
|
|
vms/DB/logs
|
|
vms/DB/logs/network.jsonl
|
|
vms/DB/logs/ports.log
|
|
vms/DB/logs/proxy.log
|
|
vms/DB/run
|
|
vms/DB/run/ca
|
|
vms/DB/run/ca/ca.key
|
|
vms/DB/run/ca/ca.pem
|
|
vms/DB/run/ca/lock
|
|
vms/DB/run/ca/next.key
|
|
vms/DB/run/ca/next.pem
|
|
vms/DB/run/known_hosts
|
|
vms/DB/run/ports.lock
|
|
vms/DB/run/ports.pid
|
|
vms/DB/run/ports.status
|
|
vms/DB/run/proxy.json
|
|
vms/DB/run/proxy.pid
|
|
vms/DB/run/proxy.status
|
|
vms/DB/run/sandbox.sb
|
|
vms/DB/run/secrets.json
|
|
vms/DB/run/secrets.policy
|
|
vms/DB/run/started
|
|
vms/DB/vm.json
|
|
-- data-linux.txt --
|
|
custom-secrets.json
|
|
custom-secrets.lock
|
|
groups.lock
|
|
images
|
|
images/X
|
|
images/X/record.json
|
|
images/locks
|
|
images/locks/X
|
|
images/locks/packages
|
|
images/locks/ubuntu
|
|
images/ubuntu.json
|
|
logs
|
|
logs/runs
|
|
logs/runs/X.log
|
|
making.lock
|
|
packages
|
|
packages/sets
|
|
packages/sets/X.json
|
|
run
|
|
run/build-ports
|
|
run/builds
|
|
run/claims.lock
|
|
run/link-X.ctl
|
|
run/link-X.sock
|
|
run/qemu
|
|
run/qemu/qemu-system-X
|
|
secrets
|
|
secrets/custom.stripe
|
|
secrets/github
|
|
settings.json
|
|
ssh_config
|
|
tools
|
|
version
|
|
version.lock
|
|
vms
|
|
vms/APP
|
|
vms/APP/lock
|
|
vms/APP/logs
|
|
vms/APP/logs/links.log
|
|
vms/APP/logs/network.jsonl
|
|
vms/APP/logs/ports.log
|
|
vms/APP/logs/proxy.log
|
|
vms/APP/run
|
|
vms/APP/run/ca
|
|
vms/APP/run/ca/ca.key
|
|
vms/APP/run/ca/ca.pem
|
|
vms/APP/run/ca/lock
|
|
vms/APP/run/ca/next.key
|
|
vms/APP/run/ca/next.pem
|
|
vms/APP/run/known_hosts
|
|
vms/APP/run/links.json
|
|
vms/APP/run/links.pid
|
|
vms/APP/run/ports.lock
|
|
vms/APP/run/ports.pid
|
|
vms/APP/run/ports.status
|
|
vms/APP/run/proxy.json
|
|
vms/APP/run/proxy.pid
|
|
vms/APP/run/proxy.status
|
|
vms/APP/run/secrets.json
|
|
vms/APP/run/secrets.policy
|
|
vms/APP/run/started
|
|
vms/APP/vm.json
|
|
vms/DB
|
|
vms/DB/lock
|
|
vms/DB/logs
|
|
vms/DB/logs/network.jsonl
|
|
vms/DB/logs/ports.log
|
|
vms/DB/logs/proxy.log
|
|
vms/DB/run
|
|
vms/DB/run/ca
|
|
vms/DB/run/ca/ca.key
|
|
vms/DB/run/ca/ca.pem
|
|
vms/DB/run/ca/lock
|
|
vms/DB/run/ca/next.key
|
|
vms/DB/run/ca/next.pem
|
|
vms/DB/run/known_hosts
|
|
vms/DB/run/ports.lock
|
|
vms/DB/run/ports.pid
|
|
vms/DB/run/ports.status
|
|
vms/DB/run/proxy.json
|
|
vms/DB/run/proxy.pid
|
|
vms/DB/run/proxy.status
|
|
vms/DB/run/secrets.json
|
|
vms/DB/run/secrets.policy
|
|
vms/DB/run/started
|
|
vms/DB/vm.json
|