Skip to content

Commit 08a9c85

Browse files
committed
fix tests?
1 parent 126a7be commit 08a9c85

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ make proxy-logs
6666
**DENY**
6767

6868
```sh
69-
# .discoverychannel.pl is not present in allowed-sites.txt
70-
curl -I https://discoverchannel.pl
69+
# .instagram.com is not present in allowed-sites.txt
70+
curl -I https://www.instagram.com
7171
# HTTP/1.1 403 Forbidden
7272

7373
# proxy blocked the request
7474
make proxy-logs
75-
# 0 172.21.0.2 TCP_DENIED/403 3408 CONNECT discoverchannel.pl:443 - HIER_NONE/- text/html
75+
# 0 172.20.0.2 TCP_DENIED/403 3406 CONNECT www.instagram.com:443 - HIER_NONE/- text/html
7676
```
7777

7878
3. SSH traffic is denied unless domain is in allowed sites.txt

tests/proxy.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ else
3737
fi
3838

3939
# --- 3. HTTPS to a non-whitelisted domain is denied -----------------------
40-
name='HTTPS to non-whitelisted domain (discoverchannel.pl) blocked'
41-
out=$(curl -sS --max-time 15 -o /dev/null -w '%{http_code}' https://discoverchannel.pl 2>&1)
42-
# squid returns 403 on the CONNECT; curl surfaces it as a non-2xx or as exit 56.
43-
if [[ "$out" == 403 ]] || [[ "$out" == 000 ]]; then
40+
name='HTTPS to non-whitelisted domain (instagram.com) blocked'
41+
code=$(curl -s --max-time 15 -o /dev/null -w '%{http_code}' https://instagram.com 2>/dev/null)
42+
rc=$?
43+
# squid returns 403 on the CONNECT; curl surfaces it as http_code 403 or exits 56.
44+
if [[ "$code" == 403 ]] || [[ "$rc" == 56 ]]; then
4445
report PASS "$name"
4546
else
46-
report FAIL "$name" "expected proxy denial, got '$out'"
47+
report FAIL "$name" "expected proxy denial, got code='$code' exit=$rc"
4748
fi
4849

4950
# --- 4. Direct internet (bypassing proxy) is unreachable ------------------
@@ -61,7 +62,8 @@ fi
6162
# If squid denied the CONNECT, nc exits early and ssh reports
6263
# "Connection closed by remote host" / "kex_exchange_identification".
6364
name='SSH to whitelisted host (github.com) tunnels through proxy'
64-
ssh_out=$(ssh -o BatchMode=yes \
65+
ssh_out=$(ssh -F none \
66+
-o BatchMode=yes \
6567
-o StrictHostKeyChecking=accept-new \
6668
-o ConnectTimeout=15 \
6769
-T git@github.com 2>&1 || true)
@@ -73,7 +75,8 @@ fi
7375

7476
# --- 6. SSH to non-whitelisted host is denied by squid --------------------
7577
name='SSH to non-whitelisted host (gitlab.com) blocked'
76-
ssh_out=$(ssh -o BatchMode=yes \
78+
ssh_out=$(ssh -F none \
79+
-o BatchMode=yes \
7780
-o StrictHostKeyChecking=no \
7881
-o UserKnownHostsFile=/dev/null \
7982
-o ConnectTimeout=10 \

0 commit comments

Comments
 (0)