From f99ae2628531e23f5d5dfd3e810525ad56cf9a4f Mon Sep 17 00:00:00 2001 From: chayleaf Date: Sun, 2 Jul 2023 17:12:29 +0700 Subject: [PATCH] router/update-rkn-blacklist: verify json before committing --- system/hosts/router/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/hosts/router/default.nix b/system/hosts/router/default.nix index 6d42a2b..2dcaff3 100644 --- a/system/hosts/router/default.nix +++ b/system/hosts/router/default.nix @@ -703,9 +703,9 @@ in { script = '' BLACKLIST=$(${pkgs.coreutils}/bin/mktemp) || exit 1 ${pkgs.curl}/bin/curl "https://reestr.rublacklist.net/api/v2/ips/json/" -o "$BLACKLIST" || exit 1 - chown unbound:unbound "$BLACKLIST" && mv "$BLACKLIST" /var/lib/unbound/vpn_ips.json + ${pkgs.jq}/bin/jq ".[0:0]" "$BLACKLIST" && chown unbound:unbound "$BLACKLIST" && mv "$BLACKLIST" /var/lib/unbound/vpn_ips.json ${pkgs.curl}/bin/curl "https://reestr.rublacklist.net/api/v2/domains/json/" -o "$BLACKLIST" || exit 1 - chown unbound:unbound "$BLACKLIST" && mv "$BLACKLIST" /var/lib/unbound/vpn_domains.json + ${pkgs.jq}/bin/jq ".[0:0]" "$BLACKLIST" && chown unbound:unbound "$BLACKLIST" && mv "$BLACKLIST" /var/lib/unbound/vpn_domains.json ''; serviceConfig = { Type = "oneshot";