ops-jrz1/scripts/egress-status
Dan 92d7646d52 Migrate Slack tokens to sops-nix, improve egress rate limits
- Remove beads from VPS deployment (kept locally for dev workflow)
- Add slack-bot-token and slack-app-token secrets with devs group access
- Remove dead acme-email secret reference
- Increase egress limits from 30/min to 150/min (burst 60→300)
- Change egress blocking from REJECT to DROP for better app behavior
- Add egress-status script for user self-diagnosis
- Update dev-slack-direct.md with new /run/secrets access patterns

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 11:14:19 -08:00

36 lines
1.2 KiB
Bash

#!/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"