diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/install-ruleset-timer.sh | 13 | ||||
| -rwxr-xr-x | scripts/update-rulesets.sh | 37 |
2 files changed, 50 insertions, 0 deletions
diff --git a/scripts/install-ruleset-timer.sh b/scripts/install-ruleset-timer.sh new file mode 100755 index 0000000..dc34008 --- /dev/null +++ b/scripts/install-ruleset-timer.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -euo pipefail + +SERVICE_SRC="${1:-/opt/vpnem/deploy/systemd/vpnem-rulesets-update.service}" +TIMER_SRC="${2:-/opt/vpnem/deploy/systemd/vpnem-rulesets-update.timer}" +SYSTEMD_DIR="${3:-/etc/systemd/system}" + +install -m 0644 "$SERVICE_SRC" "$SYSTEMD_DIR/vpnem-rulesets-update.service" +install -m 0644 "$TIMER_SRC" "$SYSTEMD_DIR/vpnem-rulesets-update.timer" +systemctl daemon-reload +systemctl enable --now vpnem-rulesets-update.timer +systemctl start vpnem-rulesets-update.service +systemctl --no-pager --full status vpnem-rulesets-update.timer diff --git a/scripts/update-rulesets.sh b/scripts/update-rulesets.sh new file mode 100755 index 0000000..24dcfcb --- /dev/null +++ b/scripts/update-rulesets.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Downloads public .srs rule-sets from GitHub +# Run via cron: 0 4 * * 1 /opt/vpnem/scripts/update-rulesets.sh + +set -euo pipefail + +RULES_DIR="${1:-/opt/vpnem/data/rules}" +mkdir -p "$RULES_DIR" + +download() { + local url="$1" + local dest="$2" + local tmp="${dest}.tmp" + + if wget -q -O "$tmp" "$url"; then + mv "$tmp" "$dest" + echo "OK: $(basename "$dest")" + else + rm -f "$tmp" + echo "FAIL: $(basename "$dest")" + return 1 + fi +} + +download \ + "https://github.com/1andrevich/Re-filter-lists/releases/latest/download/ruleset-domain-refilter_domains.srs" \ + "$RULES_DIR/refilter-domains.srs" + +download \ + "https://github.com/1andrevich/Re-filter-lists/releases/latest/download/ruleset-ip-refilter_ipsum.srs" \ + "$RULES_DIR/refilter-ip.srs" + +download \ + "https://github.com/legiz-ru/sb-rule-sets/raw/main/discord-voice-ip-list.srs" \ + "$RULES_DIR/discord-voice-ip-list.srs" + +echo "Rule-set update complete" |
