update-list: Make zone-type dynamic
This commit is contained in:
parent
bd2365c178
commit
8cb50fd264
1 changed files with 4 additions and 2 deletions
|
@ -1,7 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
TYPE="always-null"
|
||||
CONFDIR="/etc/unbound"
|
||||
CONFFILE="always-deny.conf"
|
||||
CONFFILE="${TYPE}.conf"
|
||||
CONF="${CONFDIR}/${CONFFILE}"
|
||||
SOURCES="${CONFDIR}/sources"
|
||||
BUILDDIR="$(openssl rand -hex 42)"
|
||||
|
@ -29,10 +30,11 @@ format_sources()
|
|||
{
|
||||
cat domains | tr -d '|' | tr -d '^' | grep -v '#' | sed -e 's|0.0.0.0 ||g' | sort -u | uniq > new_domains
|
||||
cat new_domains | while read -r domain
|
||||
blocktype="$(printf '%b' "$TYPE" | sed -e 's|-|_|g')"
|
||||
do
|
||||
if ! [ -z "$domain" ]
|
||||
then
|
||||
printf 'local-zone: "%b" always_deny\n' "$domain"
|
||||
printf 'local-zone: "%b" %b\n' "$domain" "$blocktype"
|
||||
fi
|
||||
done | tee "${CONF}"
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue