Layer 4 SIP protection with: - SIP traffic matching (REGISTER, INVITE, etc.) - Rate limiting and automatic IP banning - Attack pattern detection (sipvicious, friendly-scanner) - CIDR whitelisting - Admin API for ban management
50 lines
1.1 KiB
Makefile
50 lines
1.1 KiB
Makefile
.PHONY: build run stop logs test clean dev
|
|
|
|
# Build the custom Caddy image
|
|
build:
|
|
docker compose build --no-cache
|
|
|
|
# Run the stack
|
|
run:
|
|
docker compose up -d
|
|
|
|
# Stop the stack
|
|
stop:
|
|
docker compose down
|
|
|
|
# View logs
|
|
logs:
|
|
docker compose logs -f
|
|
|
|
# Run with mock asterisk for testing
|
|
test:
|
|
docker compose --profile testing up -d
|
|
@echo "Testing SIP Guardian..."
|
|
@sleep 3
|
|
@curl -s http://localhost:2019/config/ | jq .
|
|
@echo "\nSending test SIP packet..."
|
|
@echo -e "OPTIONS sip:test@localhost SIP/2.0\r\nVia: SIP/2.0/UDP 127.0.0.1:5060\r\n\r\n" | nc -u -w1 localhost 5060
|
|
@echo "Check logs for SIP Guardian activity"
|
|
|
|
# Clean up
|
|
clean:
|
|
docker compose down -v
|
|
docker rmi caddy-sip-guardian-caddy 2>/dev/null || true
|
|
|
|
# Development mode - rebuild and run
|
|
dev: build run logs
|
|
|
|
# Check ban list via admin API
|
|
bans:
|
|
@curl -s http://localhost:2019/load | jq .
|
|
|
|
# Add test ban
|
|
test-ban:
|
|
@curl -X POST http://localhost:2019/api/sip-guardian/ban/192.168.1.100 \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"reason": "test_ban"}' | jq .
|
|
|
|
# View stats
|
|
stats:
|
|
@curl -s http://localhost:2019/api/sip-guardian/stats | jq .
|