~ knotless Search/
↑↓ move↵ open⇧↵ all results

zat.dev/zds

atproto pds · mirror of https://tangled.org/zat.dev/zds

0
0
29 lines · 903 B Raw History
#!/bin/sh
set -eu

work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT HUP INT TERM

probe() {
    timeout 5 openssl s_client -connect "$1:443" -servername "$1" \
        -verify_hostname "$1" -verify_return_error -brief \
        ${CA_FILE:+-CAfile "$CA_FILE" -no-CApath -no-CAstore} </dev/null
}

probe atproto.com >"$work/control" 2>&1 || {
    cat "$work/control" >&2
    echo 'Valid TLS control failed' >&2
    exit 1
}
for host in dv-g3b-emudhra.we-have-a-problem.com dv-g3b-aaa-emudhra.we-have-a-problem.com; do
    if probe "$host" >"$work/rejected" 2>&1; then
        echo "FAIL: $host is still trusted" >&2
        exit 1
    fi
    if ! grep -Eq 'verify error:num=(20|21|23):' "$work/rejected"; then
        cat "$work/rejected" >&2
        echo "FAIL: $host did not fail with an untrusted/revoked certificate" >&2
        exit 1
    fi
    echo "PASS: $host rejected by the runtime CA bundle"
done