net-dns/unbound: add package with ipset module enable

This commit is contained in:
2024-10-05 21:37:30 +03:00
parent 535d24ebd6
commit b24e984bdc
12 changed files with 523 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
--- a/acx_nlnetlabs.m4
+++ b/acx_nlnetlabs.m4
@@ -535,7 +535,7 @@ AC_CANONICAL_HOST
if echo "$host_os" | grep "sunos4" >/dev/null; then
lt_cv_sys_max_cmd_len=32750;
fi
-AC_PATH_TOOL(AR, ar, [false])
+AC_CHECK_TOOL(AR, ar, [false])
if test $AR = false; then
AC_MSG_ERROR([Cannot find 'ar', please extend PATH to include it])
fi

View File

@@ -0,0 +1,18 @@
To avoid below error messages like
[23109:0] error: Could not open autotrust file for writing, /etc/dnssec/root-anchors.txt: Permission denied
set 'trust-anchor-file' to same value in 'auto-trust-anchor-file'.
diff -ur unbound-1.5.7.orig/doc/example.conf.in unbound-1.5.7/doc/example.conf.in
--- unbound-1.5.7.orig/doc/example.conf.in 2015-12-10 08:59:18.000000000 +0100
+++ unbound-1.5.7/doc/example.conf.in 2016-01-05 04:08:01.666760015 +0100
@@ -378,7 +378,7 @@
# with several entries, one file per entry.
# Zone file format, with DS and DNSKEY entries.
# Note this gets out of date, use auto-trust-anchor-file please.
- # trust-anchor-file: ""
+ # trust-anchor-file: "@UNBOUND_ROOTKEY_FILE@"
# Trusted key for validation. DS or DNSKEY. specify the RR on a
# single line, surrounded by "". TTL is ignored. class is IN default.

View File

@@ -0,0 +1,11 @@
--- a/configure.ac
+++ b/configure.ac
@@ -95,6 +95,8 @@ AC_SUBST(LIBUNBOUND_CURRENT)
AC_SUBST(LIBUNBOUND_REVISION)
AC_SUBST(LIBUNBOUND_AGE)
+PKG_PROG_PKG_CONFIG
+
CFLAGS="$CFLAGS"
AC_AIX
if test "$ac_cv_header_minix_config_h" = "yes"; then

View File

@@ -0,0 +1,13 @@
[Unit]
Description=Update of the root trust anchor for DNSSEC validation
After=network.target
Before=nss-lookup.target
Wants=nss-lookup.target
Before=unbound.service
[Service]
Type=oneshot
ExecStart=/usr/sbin/unbound-anchor
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,36 @@
# /etc/conf.d/unbound
# Configuration file
#UNBOUND_CONFFILE="/etc/unbound/unbound.conf"
# PID file
# This is a fallback value which should NOT be changed. If you ever need
# to change PID file, please change value in configuration file instead!
#UNBOUND_PIDFILE="/run/unbound.pid"
# You can use this configuration option to pass additional options to the
# start-stop-daemon, see start-stop-daemon(8) for more details.
# Per default we wait 1000ms after we have started the service to ensure
# that the daemon is really up and running.
#UNBOUND_SSDARGS="--wait 1000"
# The termination timeout (start-stop-daemon parameter "retry") ensures
# that the service will be terminated within a given time (25 + 5 seconds
# per default) when you are stopping the service.
#UNBOUND_TERMTIMEOUT="TERM/25/KILL/5"
# Options to unbound
# See unbound(8) for more details
# Notes:
# * Do not specify another CONFIGFILE but use the variable above to change the location
#UNBOUND_OPTS=""
# If you want to preserve unbound's cache, set the following variable to
# a non-zero value. In this case unbound's cache will be dumped to disk
# before shutdown and loaded right after start.
# To be able to dump and load cache you have to set up keys (use `unbound-control-setup`)
# and need to set 'control-enable: yes' in your configuration!
# WARNING: If you don't know what you are doing you should NOT use this
# feature. Loading the cache with old or wrong data can result in
# old or wrong data being returned to clients.
#UNBOUND_PRESERVE_CACHE=""

View File

@@ -0,0 +1,137 @@
#!/sbin/openrc-run
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
UNBOUND_BINARY=${UNBOUND_BINARY:-"/usr/sbin/unbound"}
UNBOUND_CACHEFILE=${UNBOUND_CACHEFILE:-"/var/lib/unbound/${SVCNAME}.cache"}
UNBOUND_CHECKCONF=${UNBOUND_CHECKCONF:-"/usr/sbin/unbound-checkconf"}
UNBOUND_CONFFILE=${UNBOUND_CONFFILE:-"/etc/unbound/${SVCNAME}.conf"}
UNBOUND_CONTROL=${UNBOUND_CONTROL:-"/usr/sbin/unbound-control"}
UNBOUND_PIDFILE=${UNBOUND_PIDFILE:-"/run/unbound.pid"}
UNBOUND_SSDARGS=${UNBOUND_SSDARGS:-"--wait 1000"}
UNBOUND_TERMTIMEOUT=${UNBOUND_TERMTIMEOUT:-"TERM/25/KILL/5"}
UNBOUND_OPTS=${UNBOUND_OPTS:-""}
UNBOUND_LOAD_CACHE_TIMEOUT=${UNBOUND_LOAD_CACHE_TIMEOUT:-"30"}
getconfig() {
local key="$1"
local value_default="$2"
local value=
if service_started ; then
value="$(service_get_value "${key}")"
fi
if [ -z "${value}" ] && [ -n "${UNBOUND_CONFFILE}" ] && [ -r "${UNBOUND_CONFFILE}" ] ; then
value=$("${UNBOUND_CHECKCONF}" -o ${key} "${UNBOUND_CONFFILE}")
fi
if [ -z "${value}" ] ; then
# Value not explicitly set in the configfile or configfile does not exist
# or is not readable
echo "${value_default}"
else
echo "${value}"
fi
return 0
}
command=${UNBOUND_BINARY}
command_args="${UNBOUND_OPTS} -c \"${UNBOUND_CONFFILE}\""
start_stop_daemon_args="${UNBOUND_SSDARGS}"
pidfile="$(getconfig pidfile /run/unbound.pid)"
retry="${UNBOUND_TERMTIMEOUT}"
required_files="${UNBOUND_CONFFILE}"
name="unbound daemon"
extra_commands="configtest"
extra_started_commands="reload save_cache"
description="unbound is a Domain Name Server (DNS) that is used to resolve host names to IP address."
description_configtest="Run syntax tests for configuration files only."
description_reload="Kills all children and reloads the configuration."
description_save_cache="Saves the current cache to disk."
depend() {
use net logger
provide dns
after auth-dns
}
configtest() {
local _config_status=
ebegin "Checking ${SVCNAME} configuration"
"${UNBOUND_CHECKCONF}" "${UNBOUND_CONFFILE}" 1>/dev/null 2>&1
_config_status=$?
if [ ${_config_status} -ne 0 ] ; then
# Run command again but this time we will show the output
# Ugly, but ...
"${UNBOUND_CHECKCONF}" "${UNBOUND_CONFFILE}"
else
if [ -n "${UNBOUND_PRESERVE_CACHE}" ] ; then
local _is_control_enabled=$(getconfig control-enable no)
if [ "${_is_control_enabled}" != "yes" ] ; then
eerror "Cannot preserve cache: control-enable is 'no' in the config file!"
_config_status=2
fi
fi
fi
eend ${_config_status} "failed, please correct errors above"
}
save_cache() {
if [ "${RC_CMD}" != "restart" ] ; then
UNBOUND_PRESERVE_CACHE=1 configtest || return 1
fi
ebegin "Saving cache to '${UNBOUND_CACHEFILE}'"
${UNBOUND_CONTROL} -c "${UNBOUND_CONFFILE}" dump_cache > "${UNBOUND_CACHEFILE}"
eend $?
}
start_pre() {
if [ "${RC_CMD}" != "restart" ] ; then
configtest || return 1
fi
}
start_post() {
if [ -n "${UNBOUND_PRESERVE_CACHE}" ] ; then
if [ -s "${UNBOUND_CACHEFILE}" ] ; then
ebegin "Loading cache from '${UNBOUND_CACHEFILE}'"
# Loading cache can fail which would block this runscript.
# Using `timeout` from coreutils will be our safeguard ...
timeout -k 5 ${UNBOUND_LOAD_CACHE_TIMEOUT} ${UNBOUND_CONTROL} -q -c "${UNBOUND_CONFFILE}" load_cache < "${UNBOUND_CACHEFILE}"
eend $?
else
ewarn "Loading cache from '${UNBOUND_CACHEFILE}' skipped: File does not exists or is empty!"
fi
fi
# It is not a fatal error if preserved cache could not be loaded
return 0
}
stop_pre() {
if [ "${RC_CMD}" = "restart" ] ; then
configtest || return 1
fi
if [ -n "${UNBOUND_PRESERVE_CACHE}" ] ; then
save_cache
fi
# It is not a fatal error if cache cannot be preserved
return 0
}
reload() {
configtest || return 1
ebegin "Reloading ${SVCNAME}"
start-stop-daemon --signal HUP --pidfile "${pidfile}"
eend $?
}

View File

@@ -0,0 +1,12 @@
[Unit]
Description=Unbound recursive Domain Name Server
After=network.target
Before=nss-lookup.target
Wants=nss-lookup.target
[Service]
ExecStartPre=/usr/sbin/unbound-checkconf
ExecStart=/usr/sbin/unbound -d
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,5 @@
[Socket]
ListenDatagram=127.0.0.1:1153
ListenStream=127.0.0.1:1153
[Install]
WantedBy=sockets.target

View File

@@ -0,0 +1,13 @@
[Unit]
Description=Unbound recursive Domain Name Server
After=network.target
Before=nss-lookup.target
Wants=nss-lookup.target
[Service]
Type=simple
ExecStartPre=/usr/sbin/unbound-checkconf /etc/unbound/%i.conf
ExecStart=/usr/sbin/unbound -d -c /etc/unbound/%i.conf
[Install]
WantedBy=multi-user.target