Commit 4f154fe7 authored by Jan Grewe's avatar Jan Grewe
Browse files

initial commit

parents
blocklist="/etc/powerdns/blocklist.lua"
adservers=newDS()
if io.open(blocklist, 'r') then
adservers:add(dofile(blocklist))
end
function preresolve(dq)
if(not adservers:check(dq.qname) or (dq.qtype ~= pdns.A and dq.qtype ~= pdns.AAAA)) then
return false
end
dq:addRecord(pdns.SOA,
"fake."..dq.qname:toString().." fake."..dq.qname:toString().." 1 7200 900 1209600 86400",
2)
return true
end
#!/bin/bash
if [ -z ${1} ]; then
OUTFILE="/etc/powerdns/blocklist.lua"
else
OUTFILE="${1}"
fi
LISTS=("advertising")
TMPDIR=$(mktemp -d)
mkdir "${TMPDIR}/shavar-prod-lists"
mkdir "${TMPDIR}/Lists"
wget -qO "${TMPDIR}/build-disconnect3.py" 'https://raw.githubusercontent.com/mozilla-mobile/focus-ios/master/build-disconnect3.py'
wget -qO "${TMPDIR}/shavar-prod-lists/disconnect-blacklist.json" 'https://raw.githubusercontent.com/mozilla-services/shavar-prod-lists/master/disconnect-blacklist.json'
wget -qO "${TMPDIR}/shavar-prod-lists/disconnect-entitylist.json" 'https://raw.githubusercontent.com/mozilla-services/shavar-prod-lists/master/disconnect-entitylist.json'
wget -qO "${TMPDIR}/shavar-prod-lists/google_mapping.json" 'https://raw.githubusercontent.com/mozilla-services/shavar-prod-lists/master/google_mapping.json'
(cd ${TMPDIR} && python3 "${TMPDIR}/build-disconnect3.py" >/dev/null)
(
echo 'return{'
for LIST in $LISTS; do
for DOMAIN in $(jq -r '.[].trigger["url-filter"]' "${TMPDIR}/Lists/disconnect-${LIST}.json" | sed 's:.*?::; s:\\::g; s:/.*::' | sort -u); do
echo \"${DOMAIN}\",
done
done
echo '}'
) > ${OUTFILE}
rm -r "${TMPDIR}"
echo "Generated ${OUTFILE}"
lua-dns-script=/etc/powerdns/adblock.lua
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment