summaryrefslogtreecommitdiff
path: root/net-dns/dnsdist/files
diff options
context:
space:
mode:
Diffstat (limited to 'net-dns/dnsdist/files')
-rw-r--r--net-dns/dnsdist/files/dnsdist.conf.example19
-rw-r--r--net-dns/dnsdist/files/dnsdist.confd13
-rw-r--r--net-dns/dnsdist/files/dnsdist.initd55
3 files changed, 87 insertions, 0 deletions
diff --git a/net-dns/dnsdist/files/dnsdist.conf.example b/net-dns/dnsdist/files/dnsdist.conf.example
new file mode 100644
index 000000000000..ffcc6060ef0c
--- /dev/null
+++ b/net-dns/dnsdist/files/dnsdist.conf.example
@@ -0,0 +1,19 @@
+--[[
+This is an example dnsdist configuration file.
+Please refer to the dnsdist documentation
+at http://dnsdist.org/README/ for more information.
+]]--
+
+-- Listen on 192.0.2.1 on port 53.
+setLocal("192.0.2.1:53")
+
+-- Add 2001:db8::2:1 to the list of adresses dnsdist should listen on
+addLocal("2001:db8::2:1")
+
+-- Add to the ACL set who can use this server
+addACL("192.0.2.0/24")
+addACL("2001:db8::/32")
+
+-- Instantiate two new downstram server with their default settings
+newServer("198.51.100.1")
+newServer("198.51.100.2")
diff --git a/net-dns/dnsdist/files/dnsdist.confd b/net-dns/dnsdist/files/dnsdist.confd
new file mode 100644
index 000000000000..7151fd0ad7bb
--- /dev/null
+++ b/net-dns/dnsdist/files/dnsdist.confd
@@ -0,0 +1,13 @@
+# /etc/conf.d/dnsdist
+
+# Options to pass on to dnsdist during the start
+DNSDIST_OPTIONS=""
+
+# Run dnsdist as this user
+DNSDIST_USER="dnsdist"
+
+# Run dnsdist in this group
+DNSDIST_GROUP="dnsdist"
+
+# Set the maximum number of open file descriptors
+rc_ulimit="-n 2048"
diff --git a/net-dns/dnsdist/files/dnsdist.initd b/net-dns/dnsdist/files/dnsdist.initd
new file mode 100644
index 000000000000..bfeef82d46f1
--- /dev/null
+++ b/net-dns/dnsdist/files/dnsdist.initd
@@ -0,0 +1,55 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="configcheck"
+#extra_started_commands=""
+
+DNSDIST_INSTANCE="${SVCNAME#dnsdist[.-]}"
+DNSDIST_CONFFILE="/etc/dnsdist/${SVCNAME#dnsdist[.-]}.conf"
+DNSDIST="/usr/bin/dnsdist"
+PIDDIR=/run/dnsdist
+PIDFILE=$PIDDIR/$SVCNAME.pid
+
+
+if [ -n "${DNSDIST_INSTANCE}" ] && [ "${DNSDIST_INSTANCE}" != "dnsdist" ]
+then
+ DNSDIST_INSTANCE="dnsdist-${SVCNAME#dnsdist[.-]}"
+ DNSDIST_CONFFILE="/etc/dnsdist/${DNSDIST_INSTANCE}.conf"
+else
+ DNSDIST_INSTANCE="default"
+fi
+
+depend() {
+ need net
+}
+
+start() {
+ checkpath -q -d ${PIDDIR} -o ${DNSDIST_USER}:${DNSDIST_GROUP}
+
+ configcheck || return 1
+
+ ebegin "Starting dnsdist (${DNSDIST_INSTANCE})"
+ start-stop-daemon --start --exec $DNSDIST --pidfile ${PIDFILE} \
+ -- -d -p ${PIDFILE} -u ${DNSDIST_USER} -g ${DNSDIST_GROUP} \
+ -C $DNSDIST_CONFFILE ${DNSDIST_OPTIONS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping dnsdist (${DNSDIST_INSTANCE})"
+ start-stop-daemon --stop --exec $DNSDIST --pidfile ${PIDFILE}
+ eend $?
+}
+
+configcheck() {
+ ebegin "Checking configuration file (${DNSDIST_CONFFILE})"
+ $DNSDIST --check-config -C $DNSDIST_CONFFILE > /dev/null
+
+ if [ $? -ne 0 ]; then
+ $DNSDIST --check-config -C $DNSDIST_CONFFILE
+ fi
+
+ eend $? "failed, please correct errors above"
+}
+