aboutsummaryrefslogtreecommitdiff
path: root/network
diff options
context:
space:
mode:
authorAlexander Verbovetsky <alik@ejik.org>2024-02-02 08:15:56 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2024-02-02 11:05:42 +0700
commit4dfa7f761faa26ef919af80622d87b723a31eb4c (patch)
treed8e2b458c7a08aae9276387ef1da127b1eabf42e /network
parent784b85f15c322c63850a7f008d54c3e264375182 (diff)
network/dnsproxy-bin: Added (DNS Proxy).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network')
-rw-r--r--network/dnsproxy-bin/README21
-rw-r--r--network/dnsproxy-bin/dnsproxy-bin.SlackBuild89
-rw-r--r--network/dnsproxy-bin/dnsproxy-bin.info14
-rw-r--r--network/dnsproxy-bin/doinst.sh23
-rw-r--r--network/dnsproxy-bin/rc.dnsproxy62
-rw-r--r--network/dnsproxy-bin/slack-desc19
6 files changed, 228 insertions, 0 deletions
diff --git a/network/dnsproxy-bin/README b/network/dnsproxy-bin/README
new file mode 100644
index 000000000000..c8f4a6e94a2e
--- /dev/null
+++ b/network/dnsproxy-bin/README
@@ -0,0 +1,21 @@
+dnsproxy is a simple DNS proxy server that supports all existing DNS
+protocols including DNS-over-TLS, DNS-over-HTTPS, DNSCrypt, and
+DNS-over-QUIC. Moreover, it can work as a DNS-over-HTTPS, DNS-over-TLS
+or DNS-over-QUIC server.
+
+This script packages the official prebuilt binary.
+
+A simple init script /etc/rc.d/rc.dnsproxy has been provided to run
+dnsproxy as a daemon.
+
+In most cases, dnsproxy should not be run as root. If there exists the
+user dnsproxy, the script /etc/rc.d/rc.dnsproxy will run dnsproxy as
+the user dnsproxy. This user can be created with:
+ groupadd -g 384 dnsproxy
+ useradd -u 384 -g 384 -s /sbin/nologin -M dnsproxy
+
+If the user dnsproxy does not exist, then the script
+/etc/rc.d/rc.dnsproxy will run dnsproxy as root.
+
+Also, the script /etc/rc.d/rc.dnsproxy assumes that the configuration
+file location is /etc/dnsproxy.yaml
diff --git a/network/dnsproxy-bin/dnsproxy-bin.SlackBuild b/network/dnsproxy-bin/dnsproxy-bin.SlackBuild
new file mode 100644
index 000000000000..615b63d93512
--- /dev/null
+++ b/network/dnsproxy-bin/dnsproxy-bin.SlackBuild
@@ -0,0 +1,89 @@
+#!/bin/bash
+
+# Slackware build script for dnsproxy-bin
+
+# Copyright 2024 Alexander Verbovetsky, Moscow, Russia
+# 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.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=dnsproxy-bin
+VERSION=${VERSION:-0.64.1}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+case "$ARCH" in
+ i?86) SUFFIX="linux-386" ;;
+ x86_64) SUFFIX="linux-amd64" ;;
+ *) SUFFIX="linux-$ARCH" ;;
+esac
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $SUFFIX
+tar xvf $CWD/${PRGNAM%-bin}-$SUFFIX-v$VERSION.tar.gz
+cd $SUFFIX
+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 {} \;
+
+mkdir -p $PKG/usr/sbin $PKG/etc/rc.d
+install -m 0755 -o root -g root dnsproxy $PKG/usr/sbin
+install -m 0644 -o root -g root $CWD/rc.dnsproxy \
+ $PKG/etc/rc.d/rc.dnsproxy.new
+install -m 0644 -o root -g root $CWD/config.yaml.dist \
+ $PKG/etc/dnsproxy.yaml.new
+
+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
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a README.md $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+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
diff --git a/network/dnsproxy-bin/dnsproxy-bin.info b/network/dnsproxy-bin/dnsproxy-bin.info
new file mode 100644
index 000000000000..dd8ece8c975e
--- /dev/null
+++ b/network/dnsproxy-bin/dnsproxy-bin.info
@@ -0,0 +1,14 @@
+PRGNAM="dnsproxy-bin"
+VERSION="0.64.1"
+HOMEPAGE="https://github.com/AdguardTeam/dnsproxy"
+DOWNLOAD="https://github.com/AdguardTeam/dnsproxy/releases/download/v0.64.1/dnsproxy-linux-386-v0.64.1.tar.gz \
+ https://raw.githubusercontent.com/AdguardTeam/dnsproxy/master/config.yaml.dist"
+MD5SUM="52ef9740a3e9b77b05673e42d67df684 \
+ 5a8aaaacbc3aeb1af4aac34233f2d14b"
+DOWNLOAD_x86_64="https://github.com/AdguardTeam/dnsproxy/releases/download/v0.64.1/dnsproxy-linux-amd64-v0.64.1.tar.gz \
+ https://raw.githubusercontent.com/AdguardTeam/dnsproxy/master/config.yaml.dist"
+MD5SUM_x86_64="dd98fffa0d8ad9096564c83663cfd8b1 \
+ 5a8aaaacbc3aeb1af4aac34233f2d14b"
+REQUIRES=""
+MAINTAINER="Alexander Verbovetsky"
+EMAIL="alik@ejik.org"
diff --git a/network/dnsproxy-bin/doinst.sh b/network/dnsproxy-bin/doinst.sh
new file mode 100644
index 000000000000..7ddb7da4e8cb
--- /dev/null
+++ b/network/dnsproxy-bin/doinst.sh
@@ -0,0 +1,23 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ rm $NEW
+ fi
+}
+
+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
+}
+
+preserve_perms etc/rc.d/rc.dnsproxy.new
+config etc/dnsproxy.yaml.new
diff --git a/network/dnsproxy-bin/rc.dnsproxy b/network/dnsproxy-bin/rc.dnsproxy
new file mode 100644
index 000000000000..f71496a4679d
--- /dev/null
+++ b/network/dnsproxy-bin/rc.dnsproxy
@@ -0,0 +1,62 @@
+#!/bin/bash
+# Start/stop/restart the dnsproxy
+
+if [[ $EUID -ne 0 ]]; then
+ echo "This script must be run as root" 1>&2
+ exit 1
+fi
+
+name="dnsproxy"
+pidfiles=/run/"$name"
+mkdir -p $pidfiles
+if /bin/id "$name" &>/dev/null; then
+ chown $name:$name $pidfiles
+ daemon="/usr/bin/daemon --name=$name --pidfiles=$pidfiles --user=$name"
+else
+ daemon="/usr/bin/daemon --name=$name --pidfiles=$pidfiles"
+fi
+
+start_dnsproxy() {
+if $daemon --running; then
+ echo "$name is already running"
+else
+ echo "Starting $name..."
+ $daemon -- /usr/sbin/dnsproxy --config-path=/etc/dnsproxy.yaml
+fi
+}
+
+stop_dnsproxy() {
+if $daemon --running; then
+ echo "Stopping $name..."
+ $daemon --stop
+else
+ echo "$name is not running"
+fi
+}
+
+restart_dnsproxy() {
+ stop_dnsproxy
+ sleep 1
+ start_dnsproxy
+}
+
+status_dnsproxy() {
+ $daemon --running --verbose
+}
+
+case "$1" in
+'start')
+ start_dnsproxy
+ ;;
+'stop')
+ stop_dnsproxy
+ ;;
+'restart')
+ restart_dnsproxy
+ ;;
+'status')
+ status_dnsproxy
+ ;;
+*)
+ echo "usage $0 start|stop|restart|status"
+esac
diff --git a/network/dnsproxy-bin/slack-desc b/network/dnsproxy-bin/slack-desc
new file mode 100644
index 000000000000..a45ac3d72ac7
--- /dev/null
+++ b/network/dnsproxy-bin/slack-desc
@@ -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------------------------------------------------------|
+dnsproxy-bin: dnsproxy-bin (DNS proxy server)
+dnsproxy-bin:
+dnsproxy-bin: dnsproxy is a simple DNS proxy server that supports all existing DNS
+dnsproxy-bin: protocols including DNS-over-TLS, DNS-over-HTTPS, DNSCrypt, and
+dnsproxy-bin: DNS-over-QUIC. Moreover, it can work as a DNS-over-HTTPS,
+dnsproxy-bin: DNS-over-TLS or DNS-over-QUIC server.
+dnsproxy-bin:
+dnsproxy-bin: This script packages the official prebuilt binary.
+dnsproxy-bin:
+dnsproxy-bin: Homepage: https://github.com/AdguardTeam/dnsproxy
+dnsproxy-bin: