Block ads via dnscrypt-proxy

This commit is contained in:
coolneng 2023-12-12 14:56:24 +01:00
parent add2bee896
commit 1723a4a872
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 6 additions and 8 deletions

View File

@ -108,7 +108,7 @@ in {
local-ttl = 300;
conf-file = "${pkgs.dnsmasq}/share/dnsmasq/trust-anchors.conf";
dnssec = true;
dnssec = false;
address = "/coolneng.duckdns.org/192.168.13.2";
};
@ -129,6 +129,8 @@ in {
minisign_key =
"RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3";
};
blocked_names.blocked_names_file =
"/var/lib/dnscrypt-proxy/blocklist.txt";
};
};

View File

@ -1,8 +1,8 @@
{ config, lib, pkgs, ... }:
let
stateDir = "/var/lib/dnsmasq";
blocklist = "${stateDir}/dnsmasq.blacklist.txt";
stateDir = "/var/lib/dnscrypt-proxy";
blocklist = "${stateDir}/blocklist.txt";
in {
# PostgreSQL daily backups
@ -20,13 +20,9 @@ in {
wantedBy = [ "default.target" ];
path = with pkgs; [ curl coreutils ];
script = ''
curl -L https://github.com/notracking/hosts-blocklists/raw/master/dnsmasq/dnsmasq.blacklist.txt -o ${blocklist}
sed "/cainiao/d" -i ${blocklist}
curl -L https://download.dnscrypt.info/blacklists/domains/mybase.txt -o ${blocklist}
'';
serviceConfig.Type = "oneshot";
postStop = ''
chown -R dnsmasq ${stateDir}
'';
startAt = "02:00:00";
};