0

Initial commit

This commit is contained in:
eleksir
2023-11-19 18:01:40 +03:00
commit 80ec8a7529
586 changed files with 29486 additions and 0 deletions

21
unbound/README Normal file
View File

@@ -0,0 +1,21 @@
Unbound is a validating, recursive, and caching DNS resolver.
The C implementation of Unbound is developed and maintained by
NLnet Labs. It is based on ideas and algorithms taken from a java
prototype developed by Verisign labs, Nominet, Kirei and ep.net.
Unbound is designed as a set of modular components, so that also DNSSEC
(secure DNS) validation and stub-resolvers (that do not run as a server,
but are linked into an application) are easily possible.
A user and group are recommended to run Unbound. The following should
not conflict with anything else on SlackBuilds:
groupadd -g 304 unbound
useradd -r -u 304 -g unbound -d /etc/unbound/ -s /sbin/nologin -c \
'Unbound DNS resolver' unbound
Optional DNSCrypt support is provided. To enable:
DNSCRYPT=yes ./unbound.SlackBuild
This will require libsodium which is available at SlackBuilds

5
unbound/auth-zones.conf Normal file
View File

@@ -0,0 +1,5 @@
auth-zone:
name: "localhost"
for-downstream: yes
for-upstream: no
zonefile: "/var/lib/unbound/zones/localhost.zone"

46
unbound/doinst.sh Normal file
View File

@@ -0,0 +1,46 @@
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
preserve_perms() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ -e $OLD ]; then
cp -a $OLD ${NEW}.incoming
cat $NEW > ${NEW}.incoming
mv ${NEW}.incoming $NEW
fi
config $NEW
}
getent group unbound >/dev/null 2>&1
if [ $? -ne 0 ]; then
groupadd -g 304 unbound
chown :unbound /var/lib/unbound
fi
getent passwd unbound >/dev/null 2>&1
if [ $? -ne 0 ]; then
useradd -r -u 304 -g unbound -d /var/lib/unbound/ -s /sbin/nologin -c 'Unbound DNS resolver' unbound
chown unbound: /var/lib/unbound
fi
preserve_perms etc/rc.d/rc.unbound.new
config etc/unbound/unbound.conf.new
config var/lib/unbound/unbound.conf.d/forward.conf.new
config var/lib/unbound/unbound.conf.d/forward-default.conf.new
config var/lib/unbound/unbound.conf.d/local-data.conf.new
config var/lib/unbound/unbound.conf.d/stub-zones.conf.new
config var/lib/unbound/unbound.conf.d/auth-zones.conf.new
config var/lib/unbound/zones/localhost.zone.new
config var/lib/unbound/named.root.new
config etc/cron.monthly/unbound.new

11
unbound/localhost.zone Normal file
View File

@@ -0,0 +1,11 @@
$TTL 86400
$ORIGIN localhost.
@ 1D IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
1D IN NS @
1D IN A 127.0.0.1

92
unbound/named.root Normal file
View File

@@ -0,0 +1,92 @@
; This file holds the information on root name servers needed to
; initialize cache of Internet domain name servers
; (e.g. reference this file in the "cache . <file>"
; configuration file of BIND domain name servers).
;
; This file is made available by InterNIC
; under anonymous FTP as
; file /domain/named.cache
; on server FTP.INTERNIC.NET
; -OR- RS.INTERNIC.NET
;
; last update: May 27, 2021
; related version of root zone: 2021052701
;
; FORMERLY NS.INTERNIC.NET
;
. 3600000 NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
A.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:ba3e::2:30
;
; FORMERLY NS1.ISI.EDU
;
. 3600000 NS B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET. 3600000 A 199.9.14.201
B.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:200::b
;
; FORMERLY C.PSI.NET
;
. 3600000 NS C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
C.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2::c
;
; FORMERLY TERP.UMD.EDU
;
. 3600000 NS D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET. 3600000 A 199.7.91.13
D.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2d::d
;
; FORMERLY NS.NASA.GOV
;
. 3600000 NS E.ROOT-SERVERS.NET.
E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10
E.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:a8::e
;
; FORMERLY NS.ISC.ORG
;
. 3600000 NS F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241
F.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2f::f
;
; FORMERLY NS.NIC.DDN.MIL
;
. 3600000 NS G.ROOT-SERVERS.NET.
G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4
G.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:12::d0d
;
; FORMERLY AOS.ARL.ARMY.MIL
;
. 3600000 NS H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET. 3600000 A 198.97.190.53
H.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:1::53
;
; FORMERLY NIC.NORDU.NET
;
. 3600000 NS I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17
I.ROOT-SERVERS.NET. 3600000 AAAA 2001:7fe::53
;
; OPERATED BY VERISIGN, INC.
;
. 3600000 NS J.ROOT-SERVERS.NET.
J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30
J.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:c27::2:30
;
; OPERATED BY RIPE NCC
;
. 3600000 NS K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129
K.ROOT-SERVERS.NET. 3600000 AAAA 2001:7fd::1
;
; OPERATED BY ICANN
;
. 3600000 NS L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET. 3600000 A 199.7.83.42
L.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:9f::42
;
; OPERATED BY WIDE
;
. 3600000 NS M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33
M.ROOT-SERVERS.NET. 3600000 AAAA 2001:dc3::35
; End of file

133
unbound/rc.unbound Normal file
View File

@@ -0,0 +1,133 @@
#!/bin/sh -e
# Start/stop/restart/status unbound.
PIDFILE=/run/unbound/unbound.pid
VARDIR=/var/lib/unbound
RUNDIR=/run/unbound
DAEMON=/usr/sbin/unbound
USER=unbound
GROUP=unbound
CONFDIR=/etc/unbound
CONFIG=${CONFDIR}/unbound.conf
# Start unbound:
_start() {
echo "Starting Unbound"
# dunno dafuq, but let's repeat it as pointed in redhat script
if [ -f ${VARDIR}/root.anchor -a -f ${DAEMON}-anchor ]; then
sudo -u $USER ${DAEMON}-anchor -a ${VARDIR}/root.anchor -c ${CONFDIR}/icannbundle.pem
fi
# generate new control keys if they're missing
if [ ! -f ${VARDIR}/unbound_control.key ]; then
echo -n "Generating unbound control key and certificate: "
${DAEMON}-control-setup -d ${VARDIR}/ >/dev/null 2>&1
chown ${USER}:${GROUP} ${VARDIR}/unbound_*.{key,pem}
echo
fi
set +o errexit
${DAEMON}-checkconf $CONFIG >/dev/null 2>&1
if [ $? -ne 0 ]; then
set -e
$DAEMON-checkconf $CONFIG
fi
set -e
if [ ! -d $RUNDIR ]; then
install -dpm 0750 -o $USER -g $GROUP $RUNDIR
fi
if [ -f $PIDFILE ]; then
if [ $(stat --printf=%s $PIDFILE) != "0" ]; then
# try to guess if process noted in pidfile still alive
PID=$(cat $PIDFILE)
# Eh, file contains something -try to guess if its unbound or not
set +o errexit
PROCNAME="$(ps -p ${PID} -o comm= 2>/dev/null)"
set -e
if [ -z $PROCNAME ]; then
# looks like no such process
echo "Removing stall PID-file found at $PIDFILE"
rm -f $PIDFILE
elif [ $PROCNAME == "unbound" ]; then
echo "Unbound already running"
exit 1
else
# process exist, but have different name
echo "Removing stall PID-file found at $PIDFILE"
rm -f $PIDFILE
fi
fi
fi
set +o errexit
${DAEMON}-control start
if [ $? -ne 0 ]; then
$DAEMON -c $CONFIG
RET=$?
if [ $RET -ne 0 ]; then
echo "Something went wrong, unbound unable to start."
exit $RET
fi
fi
}
# Stop unbound:
_stop() {
echo "Stopping Unbound"
set +o errexit
${DAEMON}-control stop >/dev/null 2>&1
RET=$?
set -e
if [ $RET -ne 0 ]; then
if [ -f $PIDFILE ]; then
if [ $(stat --printf=%s $PIDFILE) != "0" ]; then
kill $(cat $PIDFILE)
if [ -f $PIDFILE ]; then
rm -rf $PIDFILE
fi
else
echo "Unable to stop unbound"
exit 1
fi
fi
fi
}
# Restart unbound:
_restart() {
_stop
sleep 1
_start
}
_status() {
${DAEMON}-control status
}
case "$1" in
'start')
_start
;;
'stop')
_stop
;;
'restart')
_restart
;;
'status')
_status
;;
*)
echo "usage $0 start|stop|restart|status"
esac

19
unbound/slack-desc Normal file
View File

@@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
unbound: unbound (a validating, recursive, and caching DNSSEC resolver)
unbound:
unbound: Unbound is a validating, recursive, and caching DNS resolver.
unbound: The C implementation of Unbound is developed and maintained by
unbound: NLnet Labs. It is based on ideas and algorithms taken from a java
unbound: prototype developed by Verisign labs, Nominet, Kirei and ep.net.
unbound:
unbound: It is designed as a set of modular components, so that also DNSSEC
unbound: validation and stub-resolvers are easily possible.
unbound:
unbound: Homepage: https://nlnetlabs.nl/projects/unbound/about/

161
unbound/unbound.SlackBuild Executable file
View File

@@ -0,0 +1,161 @@
#!/bin/sh
# Slackware build script for unbound
# Copyright 2020 Gerardo Zamudio <gerardo.zamudio@linux.com> Mexico City, Mexico
# Copyright 2023 Sergei Fedosoff <eleksir@gmail.com>
#
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=unbound
VERSION=${VERSION:-1.19.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_EXs}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/EXs}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
UB_USER=${UB_USER:-unbound}
UB_GROUP=${UB_GROUP:-unbound}
# Check the system user and group for unbound:
if ! grep -q ^"$UB_GROUP": /etc/group ; then
echo " You will need a dedicated group to run unbound"
echo " # groupadd -g 304 $UB_GROUP"
echo " should do the job."
exit 1
fi
if ! grep -q ^"$UB_USER": /etc/passwd ; then
echo " You will need a dedicated user to run unbound, something like"
echo " # useradd -r -u 304 -g $UB_GROUP -d /var/lib/unbound/ -s /sbin/nologin -c 'Unbound DNS resolver' $UB_USER"
exit 1
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \+ -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
if [ "${DNSCRYPT:-no}" == "yes" ]; then
DNSCRYPT="--enable-dnscrypt"
else
DNSCRYPT=""
fi
CFLAGS="-g $SLKCFLAGS -flto -rdynamic" \
CXXFLAGS="-g $SLKCFLAGS -flto -rdynamic" \
LDFLAGS="-flto -rdynamic -Wl,--export-dynamic -Wl,-E -Wl,--no-as-needed -Wl,-O2" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--with-libevent \
--with-ssl \
--with-username=$UB_USER \
--with-pidfile=/var/run/unbound/unbound.pid \
--build=$ARCH-slackware-linux \
$DNSCRYPT
make -j$(nproc)
make install DESTDIR=$PKG
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find $PKG/usr/man -type f -exec gzip -9 {} \+
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a doc/CREDITS doc/FEATURES doc/LICENSE doc/README* $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/var/run/unbound
chown $USER:$GROUP $PKG/var/run/unbound/
# replace original config
cat $CWD/unbound.conf >$PKG/etc/unbound/unbound.conf
mv $PKG/etc/unbound/unbound.conf $PKG/etc/unbound/unbound.conf.new
# additional config bits
# to serve some records from standard bind zone files
install -Dpm 0644 $CWD/auth-zones.conf $PKG/var/lib/unbound/unbound.conf.d/auth-zones.conf.new
# sample zone - localhost, working example
install -Dpm 0644 $CWD/localhost.zone $PKG/var/lib/unbound/zones/localhost.zone.new
# "proxy" query for record to specified servers
touch $PKG/var/lib/unbound/unbound.conf.d/forward.conf.new
# for default upstream if this server acts as caching recursor
touch $PKG/var/lib/unbound/unbound.conf.d/forward-default.conf.new
# to override (or add) some "incorrect" records for domain, but not rewrite whole domain record set
touch $PKG/var/lib/unbound/unbound.conf.d/local-data.conf.new
# to redirect client to another dns for this record query
touch $PKG/var/lib/unbound/unbound.conf.d/stub-zones.conf.new
# rc-script
install -Dpm 0644 $CWD/rc.unbound $PKG/etc/rc.d/rc.unbound.new
# sample root hints
install -Dpm 0644 $CWD/named.root $PKG/var/lib/unbound/named.root.new
# cron job to update root hints, monthly
install -Dpm 0755 $CWD/unbound.cron $PKG/etc/cron.monthly/unbound.new
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

1151
unbound/unbound.conf Normal file

File diff suppressed because it is too large Load Diff

4
unbound/unbound.cron Normal file
View File

@@ -0,0 +1,4 @@
#!/bin/bash -e
wget -q 'https://www.internic.net/domain/named.root' -O /etc/unbound/named.root.tmp
mv --force --update /etc/unbound/named.root.tmp /etc/unbound/named.root

10
unbound/unbound.info Normal file
View File

@@ -0,0 +1,10 @@
PRGNAM="unbound"
VERSION="1.19.0"
HOMEPAGE="https://nlnetlabs.nl/projects/unbound/about/"
DOWNLOAD="https://nlnetlabs.nl/downloads/unbound/unbound-1.19.0.tar.gz"
MD5SUM="1a8c4a4bca75eadc03e21d43089ef1ee"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="ldns"
MAINTAINER="Sergei Fedosoff"
EMAIL="eleksir@gmail.com"