unbound: prefer ip4 on ubuntu 24 and above

ip6 queries seems to be blocked by spamhaus
This commit is contained in:
Girish Ramakrishnan
2024-09-12 17:12:01 +02:00
parent aedf55dba0
commit 0647a3a233
4 changed files with 17 additions and 1 deletions
+10 -1
View File
@@ -22,6 +22,11 @@ readonly MAIL_DATA_DIR="${HOME_DIR}/boxdata/mail"
readonly script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly ubuntu_version=$(lsb_release -rs)
vergte() {
greater_version=$(echo -e "$1\n$2" | sort -rV | head -n1)
[[ "$1" == "${greater_version}" ]] && return 0 || return 1
}
cp -f "${script_dir}/../scripts/cloudron-support" /usr/bin/cloudron-support
cp -f "${script_dir}/../scripts/cloudron-translation-update" /usr/bin/cloudron-translation-update
rm -f /usr/bin/cloudron-logs # legacy script
@@ -109,7 +114,11 @@ systemctl restart systemd-journald
usermod -a -G adm ${USER}
log "Setting up unbound"
cp -f "${script_dir}/start/unbound.conf" /etc/unbound/unbound.conf.d/cloudron-network.conf
cp -f "${script_dir}/start/unbound/unbound.conf" /etc/unbound/unbound.conf.d/cloudron-network.conf
unbound_version=$(unbound -V | sed -n 's/^Version \([0-9.]*\)/\1/p')
if vergte "${unbound_version}" "1.19.2"; then
cp "${script_dir}/start/unbound/prefer-ip4.conf" /etc/unbound/unbound.conf.d/cloudron-prefer-ip4.conf
fi
rm -f /etc/unbound/unbound.conf.d/remote-control.conf # on ubuntu 24
# update the root anchor after a out-of-disk-space situation (see #269)
# it returns 1 even on fail, it's not clear - https://unbound.docs.nlnetlabs.nl/en/latest/manpages/unbound-anchor.html#exit-code