#!/usr/bin/env bash # Check egress rate limit status for current user # Users can run this to see if they're hitting connection limits set -euo pipefail # Colors RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color echo "=== Egress Rate Limit Status ===" echo "" # Check recent limit hits (last 5 minutes) RECENT_HITS=$(journalctl --since "5 minutes ago" -q 2>/dev/null | grep -c "EGRESS-LIMIT:" 2>/dev/null || true) RECENT_HITS=${RECENT_HITS:-0} RECENT_HITS=$(echo "$RECENT_HITS" | tr -d '[:space:]') if [ "$RECENT_HITS" -gt 0 ] 2>/dev/null; then echo -e "${RED}⚠ Rate limit hit ${RECENT_HITS} times in the last 5 minutes${NC}" echo "" echo "Recent blocked connections:" journalctl --since "5 minutes ago" -q 2>/dev/null | grep "EGRESS-LIMIT:" | tail -5 | \ sed 's/.*DST=\([^ ]*\).*/ → \1/' || true echo "" echo -e "${YELLOW}Tip: Wait 1-2 minutes for the limit to reset, or run commands with fewer parallel connections.${NC}" else echo -e "${GREEN}✓ No rate limit hits in the last 5 minutes${NC}" fi echo "" echo "Current limits: 150 new connections/min, burst 300" echo "Check logs: journalctl --since '1 hour ago' | grep EGRESS-LIMIT"