|
|
|
@@ -62,7 +62,7 @@ validate run-validation: build clean-disk ## Start steamcache2 on :80 with small
|
|
|
|
|
fi; \
|
|
|
|
|
exec "$$BINARY" --config docs/examples/validate-config.yaml --log-level info
|
|
|
|
|
|
|
|
|
|
validate-check: ## Curl local /metrics (full dump + hit/miss + upstream/write/rate fields) and /lancache-heartbeat (default :80)
|
|
|
|
|
validate-check: ## Curl local /metrics (full dump + hit/miss + upstream/write/rate fields), /lancache-heartbeat, and non-Steam Host reject probe (empty upstream; default :80)
|
|
|
|
|
@echo "=== http://localhost/metrics ==="
|
|
|
|
|
@metrics=$$(curl -sf --max-time 5 http://localhost/metrics) || { \
|
|
|
|
|
echo "ERROR: could not fetch http://localhost/metrics"; \
|
|
|
|
@@ -84,7 +84,26 @@ validate-check: ## Curl local /metrics (full dump + hit/miss + upstream/write/ra
|
|
|
|
|
echo "$$hb" | grep -q '204' && echo "$$hb" | grep -qi 'X-LanCache-Processed-By' || { \
|
|
|
|
|
echo "ERROR: expected HTTP 204 and X-LanCache-Processed-By on /lancache-heartbeat"; \
|
|
|
|
|
exit 1; \
|
|
|
|
|
}
|
|
|
|
|
}; \
|
|
|
|
|
echo ""; \
|
|
|
|
|
echo "=== http://localhost/depot/allowlist-probe/chunk (Host: evil.example, Steam UA; expect 400 reject) ==="; \
|
|
|
|
|
allowlist_body=$$(mktemp); \
|
|
|
|
|
allowlist_code=$$(curl -s --max-time 5 -o "$$allowlist_body" -w '%{http_code}' -H 'Host: evil.example' -H 'User-Agent: Valve/Steam HTTP Client 1.0' http://localhost/depot/allowlist-probe/chunk) || { \
|
|
|
|
|
rm -f "$$allowlist_body"; \
|
|
|
|
|
echo "ERROR: could not probe http://localhost/depot/allowlist-probe/chunk"; \
|
|
|
|
|
echo "Is steamcache2 running on the default listen address :80?"; \
|
|
|
|
|
exit 1; \
|
|
|
|
|
}; \
|
|
|
|
|
printf 'HTTP %s\n' "$$allowlist_code"; \
|
|
|
|
|
printf '%s\n' "$$(cat "$$allowlist_body")"; \
|
|
|
|
|
if [ "$$allowlist_code" != "400" ] || ! grep -q 'Invalid URL' "$$allowlist_body"; then \
|
|
|
|
|
rm -f "$$allowlist_body"; \
|
|
|
|
|
echo "ERROR: expected HTTP 400 'Invalid URL' rejecting non-Steam Host with empty upstream (got $$allowlist_code)"; \
|
|
|
|
|
echo "Host allowlist gate regressed: steamcache2 may act as an open LAN reverse proxy."; \
|
|
|
|
|
exit 1; \
|
|
|
|
|
fi; \
|
|
|
|
|
rm -f "$$allowlist_body"; \
|
|
|
|
|
echo "Host allowlist reject OK (non-Steam Host -> 400)"
|
|
|
|
|
|
|
|
|
|
validate-kill: ## Kill leftover steamcache2 processes (safer, checks process name)
|
|
|
|
|
@echo "Looking for steamcache2 processes on common validation ports (80 is primary)..."
|
|
|
|
@@ -133,7 +152,7 @@ help: ## Show this help message
|
|
|
|
|
@echo " clean-disk Remove disk cache"
|
|
|
|
|
@echo " bench Run low-level VFS microbenchmarks"
|
|
|
|
|
@echo " validate / run-validation Start server on :80 (builds, auto-setcaps fresh binary, then runs as normal user, cleans disk cache first)"
|
|
|
|
|
@echo " validate-check Curl local /metrics (full dump + hit/miss + upstream/write/rate fields) and /lancache-heartbeat (default :80)"
|
|
|
|
|
@echo " validate-check Curl local /metrics (full dump + hit/miss + upstream/write/rate fields), /lancache-heartbeat, and non-Steam Host reject probe (empty upstream; default :80)"
|
|
|
|
|
@echo " setcap Explicitly set cap on current build (for port 80 use outside validate)"
|
|
|
|
|
@echo " validate-kill Kill leftover steamcache2 processes (safer)"
|
|
|
|
|
@echo " prefill Download latest SteamPrefill into bin/steam-prefill/SteamPrefill (gitignored)"
|
|
|
|
|