Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/om/tls/test/net/badssl.sh # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / om / tls / test / net / badssl.sh` 49 lines ยท 2863 bytes Raw Blame History 1 #!/bin/sh 2 # SPDX-License-Identifier: Apache-2.0 3 # badssl.com sweep for the om/tls client. Network: the badssl.com hosts only (plus 127.0.0.1). 4 # usage: sh om/tls/test/net/badssl.sh OMC 5 # Every host listed on https://badssl.com/ is tried live and, because badssl.com offers no TLS 1.3, 6 # also by replaying its real certificate chain from a local TLS 1.3 server (badssl_run.py explains 7 # the method); openssl verify on the same chain and trust store is the expected verdict. 8 # Writes om/tls/test/net/badssl.tsv. Chains and the dashboard are cached in $BADSSL_CACHE 9 # (default ../tlsverify-TlsSuites-ext/badssl next to the repository); delete it to refetch. 10 # Final line: BADSSL PASS|FAIL refuse_ok=.. accept_ok=.. explained=.. unexplained=.. na=.. hosts=.. 11 set -u 12 omc=${1:?usage: badssl.sh OMC} 13 here=$(cd "$(dirname "$0")" && pwd) 14 tls=$(cd "$here/../.." && pwd) 15 root=$(cd "$tls/../.." && pwd) 16 out="$root/build/tls/net-badssl" 17 cache=${BADSSL_CACHE:-$root/../tlsverify-TlsSuites-ext/badssl} 18 . "$here/lib.sh" 19 rm -rf "$out"; mkdir -p "$out" "$cache/chains" 20 echo "omc $(sha256sum "$omc" | cut -c1-64)" 21 echo "tls.om $(sha256sum "$tls/tls.om" | cut -c1-64)" 22 echo "python $(python3 -c 'import sys,cryptography;print(sys.version.split()[0],"cryptography",cryptography.__version__)') $(openssl version)" 23 echo "store /etc/ssl/certs/ca-certificates.crt $(sha256sum /etc/ssl/certs/ca-certificates.crt | cut -c1-64)" 24 if [ ! -s "$cache/dashboard.html" ]; then 25 curl -fsS --max-time 30 -o "$cache/dashboard.html" https://badssl.com/ || { echo "BADSSL FAIL refuse_ok=0 accept_ok=0 explained=0 unexplained=1 na=0 hosts=0"; exit 1; } 26 fi 27 echo "dashboard $(sha256sum "$cache/dashboard.html" | cut -c1-64) $(date -u -r "$cache/dashboard.html" +%Y-%m-%dT%H:%M:%SZ)" 28 build client "$tls/tls.om" || { echo "BADSSL FAIL refuse_ok=0 accept_ok=0 explained=0 unexplained=1 na=0 hosts=0"; exit 1; } 29 mkpki "$out/pki" 30 cl="$out/client/bin" 31 32 # the negotiation rows (cipher suite, key exchange, protocol) rest on what the client offers 33 p=$(python3 -c 'import socket;s=socket.socket();s.bind(("127.0.0.1",0));print(s.getsockname()[1])') 34 python3 "$here/hostile.py" "$p" "$out/pki" ch_policy > "$out/ch.log" 2>&1 & 35 sp=$! 36 sleep 0.5 37 timeout 20 "$cl" localhost "$p" get 127.0.0.1 "$out/pki/root.pem" > /dev/null 2>&1 38 wait $sp 39 pol=$(grep '^SRV ch_policy' "$out/ch.log") 40 echo "$pol" 41 case "$pol" in *" bad=none") polok=1 ;; *) echo "FAIL ClientHello policy"; polok=0 ;; esac 42 43 python3 "$here/badssl_run.py" "$cl" "$out/pki" "$cache/dashboard.html" "$cache/chains" "$here/badssl.tsv" > "$out/run.log" 2>&1 44 rc=$? 45 grep -v '^BADSSL ' "$out/run.log" 46 final=$(grep '^BADSSL ' "$out/run.log") 47 [ -n "$final" ] || final="BADSSL FAIL refuse_ok=0 accept_ok=0 explained=0 unexplained=1 na=0 hosts=0" 48 if [ $rc = 0 ] && [ $polok = 1 ]; then echo "$final"; exit 0; fi 49 echo "$final" | sed 's/^BADSSL PASS/BADSSL FAIL/'; exit 1