1+ #! /bin/bash
2+ # Debug script to understand TLS environment in CI
3+
4+ echo " === TLS Environment Debug Information ==="
5+ echo " "
6+
7+ echo " 1. OpenSSL Version:"
8+ openssl version -a
9+ echo " "
10+
11+ echo " 2. Curl Version and Features:"
12+ curl --version
13+ echo " "
14+
15+ echo " 3. System CA certificates location:"
16+ ls -la /etc/ssl/certs/ | head -10
17+ echo " Total certs in /etc/ssl/certs: $( ls /etc/ssl/certs/* .pem 2> /dev/null | wc -l) "
18+ echo " "
19+
20+ echo " 4. User config directories:"
21+ echo " HOME: $HOME "
22+ echo " USER: $USER "
23+ echo " SUDO_USER: $SUDO_USER "
24+ echo " Current UID: $( id -u) "
25+ echo " Current user: $( whoami) "
26+ echo " "
27+
28+ echo " 5. httpjail CA certificate locations:"
29+ for dir in /home/runner/.config/httpjail /root/.config/httpjail $HOME /.config/httpjail; do
30+ if [ -d " $dir " ]; then
31+ echo " Found httpjail config at: $dir "
32+ ls -la " $dir " /* .pem 2> /dev/null || echo " No .pem files found"
33+
34+ # Check if CA cert is valid
35+ if [ -f " $dir /ca-cert.pem" ]; then
36+ echo " Validating CA certificate:"
37+ openssl x509 -in " $dir /ca-cert.pem" -text -noout 2>&1 | grep -E " Subject:|Issuer:|Signature Algorithm:|Public Key Algorithm:" | head -10
38+
39+ # Test if OpenSSL can parse it without errors
40+ if openssl x509 -in " $dir /ca-cert.pem" -noout 2> /dev/null; then
41+ echo " ✓ Certificate parses successfully"
42+ else
43+ echo " ✗ Certificate parsing failed!"
44+ openssl x509 -in " $dir /ca-cert.pem" -noout 2>&1
45+ fi
46+ fi
47+ else
48+ echo " No httpjail config at: $dir "
49+ fi
50+ echo " "
51+ done
52+
53+ echo " 6. Test ECDSA support:"
54+ # Generate a test ECDSA key and certificate
55+ TEMP_KEY=$( mktemp)
56+ TEMP_CERT=$( mktemp)
57+ openssl ecparam -genkey -name prime256v1 -out " $TEMP_KEY " 2> /dev/null
58+ openssl req -new -x509 -key " $TEMP_KEY " -out " $TEMP_CERT " -days 1 -subj " /CN=test" 2> /dev/null
59+
60+ if openssl x509 -in " $TEMP_CERT " -noout 2> /dev/null; then
61+ echo " ✓ ECDSA P-256 certificates work"
62+ openssl x509 -in " $TEMP_CERT " -text -noout 2>&1 | grep " Signature Algorithm:"
63+ else
64+ echo " ✗ ECDSA P-256 certificates failed"
65+ fi
66+ rm -f " $TEMP_KEY " " $TEMP_CERT "
67+ echo " "
68+
69+ echo " 7. Test certificate chain verification:"
70+ # If httpjail CA exists, test creating and verifying a certificate with it
71+ CA_CERT=" "
72+ for dir in /home/runner/.config/httpjail /root/.config/httpjail $HOME /.config/httpjail; do
73+ if [ -f " $dir /ca-cert.pem" ]; then
74+ CA_CERT=" $dir /ca-cert.pem"
75+ break
76+ fi
77+ done
78+
79+ if [ -n " $CA_CERT " ]; then
80+ echo " Testing with CA cert: $CA_CERT "
81+ # Extract the signature algorithm from the CA
82+ echo " CA Certificate details:"
83+ openssl x509 -in " $CA_CERT " -text -noout 2>&1 | grep -E " Signature Algorithm:|Public Key Algorithm:"
84+ else
85+ echo " No httpjail CA certificate found to test"
86+ fi
87+ echo " "
88+
89+ echo " 8. Environment variables:"
90+ env | grep -E " SSL|TLS|CERT|CA" | sort
91+ echo " "
92+
93+ echo " === End Debug Information ==="
0 commit comments