#!/bin/sh # BusyBox starts this script as the signed network packages' guest smoke test. set -eu export PATH=/bin:/usr/bin:/sbin:/usr/sbin HOME=/tmp TERM=dumb LC_ALL=C phase=identity server= finish() { status=$? if [ -n "$server" ]; then kill "$server" 2>/dev/null || true; fi if [ "$status" -ne 0 ]; then echo "VPAC NETWORK FAIL at $phase with status $status"; fi /sbin/poweroff -f } trap finish EXIT test "$(uname -o)" = Vinix mkdir -p /tmp/network cd /tmp/network phase=trust openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes -days 1 \ -subj /CN=vinix.test -addext subjectAltName=DNS:vinix.test -keyout key.pem -out cert.pem mkdir -p /usr/local/share/ca-certificates cp cert.pem /usr/local/share/ca-certificates/vinix-fixture.crt update-ca-certificates openssl verify -CAfile /etc/ssl/cert.pem cert.pem openssl verify -no-CAfile -no-CAstore -CApath /etc/ssl/certs cert.pem phase=https openssl s_server -accept 127.0.0.1:2443 -cert cert.pem -key key.pem -www >tls.log 2>&1 & server=$! curl --disable --noproxy '*' --retry 5 --retry-connrefused --max-time 8 --silent --show-error \ --resolve vinix.test:2443:127.0.0.1 https://vinix.test:2443/ -o page grep -qi '' page status=0 curl --disable --noproxy '*' --max-time 5 --silent --show-error --resolve wrong.test:2443:127.0.0.1 \ https://wrong.test:2443/ -o wrong || status=$? test "$status" -eq 60 kill "$server" wait "$server" || true server= phase=git git init -q repo printf '%s\n' 'Vinix source ports' >repo/note git -C repo add note git -C repo -c user.name=Vinix -c user.email=ports@example.invalid commit -qm fixture test "$(git -C repo show HEAD:note)" = 'Vinix source ports' git -C repo grep -q -P '(?=source)source' phase=ssh ssh-keygen -q -t ed25519 -N '' -f ssh-key ssh-keygen -Y sign -f ssh-key -n vinix repo/note printf 'builder %s\n' "$(cat ssh-key.pub)" >signers ssh-keygen -Y verify -f signers -I builder -n vinix -s repo/note.sig