Created
May 27, 2025 11:40
-
-
Save rooty/874c82eaa3bb85d433a8bef26a5316ed to your computer and use it in GitHub Desktop.
Update AWS Nova ip poll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Тимчасовий файл | |
TMP_FILE="/tmp/aws_ca_central_1_ips.txt" | |
NGINX_BLOCK_FILE="/etc/nginx/aws-nova-deny.conf" | |
# Завантажити актуальний список IP | |
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | \ | |
jq -r '.prefixes[] | select(.region=="ca-central-1") | "deny \(.ip_prefix);"' > "$TMP_FILE" | |
# Перевірити, чи змінився список | |
if ! cmp -s "$TMP_FILE" "$NGINX_BLOCK_FILE"; then | |
echo "🛡️ Оновлення списку IP для блокування..." | |
mv "$TMP_FILE" "$NGINX_BLOCK_FILE" | |
nginx -t && systemctl reload nginx && echo "✅ Nginx перезапущено" | |
else | |
echo "ℹ️ IP список не змінився — нічого не робимо" | |
fi | |
# Очистити тимчасовий файл | |
rm -f "$TMP_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment