-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathclient.sh
More file actions
76 lines (66 loc) · 2.2 KB
/
Copy pathclient.sh
File metadata and controls
76 lines (66 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh
set -e
echo "Installing curl..."
apk add --no-cache curl
echo "============================================="
echo " iron-proxy demo client"
echo "============================================="
echo ""
echo "Waiting for proxy CA cert..."
while [ ! -f /certs/ca.crt ]; do sleep 0.5; done
echo "Waiting for proxy to be ready..."
sleep 2
run() {
local label="$1"
shift
echo ""
echo "--- $label ---"
echo "> curl $*"
echo "> Proxy log:"
output=$(curl --max-time 10 --cacert /certs/ca.crt "$@" -s -S 2>&1 || echo "Failed")
sleep 0.3
echo ""
echo "> Upstream received:"
echo "$output"
echo ""
}
echo ""
echo "============================================="
echo " 1. ALLOWED: request to httpbin.org"
echo "============================================="
run "GET https://httpbin.org/get" https://httpbin.org/get
echo ""
echo "============================================="
echo " 2. BLOCKED: request to disallowed host"
echo "============================================="
run "GET https://example.com/" https://example.com/
echo ""
echo "============================================="
echo " 3. SECRET SWAP: proxy token in Authorization"
echo " (httpbin echoes headers back — look for"
echo " the real key in the response)"
echo "============================================="
run "GET with proxy token" \
-H "Authorization: Bearer proxy-openai-abc123" \
https://httpbin.org/headers
echo ""
echo "============================================="
echo " 4. SECRET SWAP: proxy token in custom header"
echo " (INTERNAL_TOKEN matches all headers)"
echo "============================================="
run "GET with internal token" \
-H "X-Internal: proxy-internal-tok" \
https://httpbin.org/headers
echo ""
echo "============================================="
echo " 5. SECRET SWAP: token in query parameter"
echo "============================================="
run "GET with query param token" \
"https://httpbin.org/get?token=proxy-openai-abc123&q=hello"
echo ""
echo "============================================="
echo " Demo complete!"
echo " Check the proxy container logs for audit output:"
echo " docker compose logs proxy"
echo "============================================="
sleep 5