-
-
Notifications
You must be signed in to change notification settings - Fork 105
/
Copy pathrpz.txt.sh
executable file
·40 lines (32 loc) · 889 Bytes
/
rpz.txt.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
# Author: Héctor Molinero Fernández <[email protected]>
# License: MIT, https://opensource.org/licenses/MIT
# Repository: https://github.com/hectorm/hblock
set -eu
export LC_ALL='C'
main() {
source="${1:?}"
target="${2:?}"
hblock="${3:-hblock}"
# shellcheck disable=SC2155
export HBLOCK_HEADER="$(cat <<-'EOF'
$TTL 2h
@ IN SOA localhost. root.localhost. (1 6h 1h 1w 2h)
IN NS localhost.
EOF
)"
export HBLOCK_FOOTER=''
export HBLOCK_SOURCES="file://${source:?}"
export HBLOCK_ALLOWLIST=''
export HBLOCK_DENYLIST='hblock-check.molinero.dev'
export HBLOCK_REDIRECTION='.'
export HBLOCK_WRAP='1'
export HBLOCK_TEMPLATE='%D CNAME %R'
export HBLOCK_COMMENT=';'
export HBLOCK_LENIENT='false'
export HBLOCK_REGEX='false'
export HBLOCK_FILTER_SUBDOMAINS='false'
export HBLOCK_CONTINUE='false'
"${hblock:?}" -qO "${target:?}"
}
main "${@-}"