455 current 2025-06-28 04:47:33 25.05.20250424.f771eb4 6.12.24 *

This commit is contained in:
2025-06-28 04:48:04 -04:00
parent 37b4e716a4
commit b6c057e70a
5 changed files with 60 additions and 1 deletions

View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail
OP=${1:-}; DOMAIN=${2:-}
[[ $OP =~ ^(on|off)$ && -n $DOMAIN ]] || {
echo "usage: dnsblock on|off <domain>"; exit 1; }
FILE="/var/lib/dnsmasq/conf.d/block-$DOMAIN.conf"
if [[ $OP == on ]]; then
sudo tee "$FILE" >/dev/null <<EOF
address=/${DOMAIN}/0.0.0.0
address=/${DOMAIN}/::
EOF
else
sudo rm -f "$FILE"
fi

19
home/scripts/dns/dnsblock.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail
OP=${1:-}; DOMAIN=${2:-}
[[ $OP =~ ^(on|off)$ && -n $DOMAIN ]] || {
echo "usage: dnsblock on|off <domain>"; exit 1; }
FILE="/var/lib/dnsmasq/conf.d/block-$DOMAIN.conf"
if [[ $OP == on ]]; then
sudo tee "$FILE" >/dev/null <<EOF
address=/${DOMAIN}/0.0.0.0
address=/${DOMAIN}/::
EOF
else
sudo rm -f "$FILE"
fi
sudo systemctl restart dnsmasq
# sudo systemctl reload dnsmasq