aboutsummaryrefslogtreecommitdiff
path: root/network
diff options
context:
space:
mode:
authorMarco Bonetti <sid77@slackware.it>2010-08-24 00:24:11 -0400
committerErik Hanson <erik@slackbuilds.org>2010-08-29 15:32:12 -0500
commit6b3dcddbf803c1f7dbbd7b821b559274cd421321 (patch)
tree9e32cceb06ce48bdd454a7a69d485835fe54ea3a /network
parent32376e2b76b9415697b832cf686ecb9b0b3b49fd (diff)
network/ttdnsd: Added (The Tor TCP DNS Daemon)
Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
Diffstat (limited to 'network')
-rw-r--r--network/ttdnsd/README32
-rw-r--r--network/ttdnsd/doinst.sh28
-rw-r--r--network/ttdnsd/rc.ttdnsd.new57
-rw-r--r--network/ttdnsd/slack-desc19
-rw-r--r--network/ttdnsd/ttdnsd.SlackBuild93
-rw-r--r--network/ttdnsd/ttdnsd.info10
6 files changed, 239 insertions, 0 deletions
diff --git a/network/ttdnsd/README b/network/ttdnsd/README
new file mode 100644
index 000000000000..534a190ce0ec
--- /dev/null
+++ b/network/ttdnsd/README
@@ -0,0 +1,32 @@
+ttdnsd accepts DNS requests via UDP and forwards the to a resolving nameserver
+via TCP. The actual requests are really just forwarded so one has complete
+access to the nameserver ttdnsd is talking to. -- It's not a very complicated
+process. If there are no problems with the setup it could go as smoothly as
+connecting to the 'net using a mobile broadband dongle.
+
+ttdnsd only connects to the resolving nameserver after receiving a request via
+UDP. For each connection ttdnsd randomly selects one of the nameservers it
+knows about. The connection will be used for forwarding multiple requests in a
+pipelined fashion and is kept open only until no more requests are received
+via UDP. This pipelining is required to overcome the initial connection
+overhead time which is quite long when using Tor.
+
+To run this service at system startup, edit your rc.local and add this code:
+
+if [ -x /etc/rc.d/rc.ttdsnd ]; then
+ /etc/rc.d/rc.ttdsnd start
+fi
+
+after the similar code used to start the Tor service. To stop the service add
+this to your rc.local_shutdown:
+
+if [ -x /etc/rc.d/rc.ttdsnd ]; then
+ /etc/rc.d/rc.ttdsnd stop
+fi
+
+before the Tor shutdown routines. Remember that this package acts like a DNS
+resolver so it listens by default on port 53. If you're going to run another
+DNS server like bind either as a cache to this server or in parallel, remember
+to modify ttdnsd default port or it will not start.
+
+This package requires tor and tsocks.
diff --git a/network/ttdnsd/doinst.sh b/network/ttdnsd/doinst.sh
new file mode 100644
index 000000000000..727782007dd4
--- /dev/null
+++ b/network/ttdnsd/doinst.sh
@@ -0,0 +1,28 @@
+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
+}
+
+preserve_perms etc/rc.d/rc.ttdnsd.new
+config etc/default/ttdnsd.new
+config etc/ttdnsd.conf.new
+config var/lib/ttdnsd/tsocks.conf.new
diff --git a/network/ttdnsd/rc.ttdnsd.new b/network/ttdnsd/rc.ttdnsd.new
new file mode 100644
index 000000000000..39c214a9831d
--- /dev/null
+++ b/network/ttdnsd/rc.ttdnsd.new
@@ -0,0 +1,57 @@
+#! /bin/sh
+#
+# ttdnsd The Tor TCP DNS Daemon
+#
+# This initscript runs a chrooted ttdnsd process and it makes recursive TCP
+# DNS requests through the Tor network.
+
+# This script is a modified version of Jacob Appelbaum's /etc/init.d/ttdnsd
+# for use on Slackware.
+
+# Author: Marco Bonetti <sid77@slackware.it>
+
+# Do NOT "set -e"
+
+NAME=ttdnsd
+DAEMON=/usr/sbin/$NAME
+PIDFILE=/var/run/ttdnsd.pid
+TSOCKS_CONF_FILE=tsocks.conf
+export TSOCKS_CONF_FILE
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# This will be overloaded by $DEFAULTS
+DAEMON_ARGS="-P $PIDFILE -f /etc/ttdnsd.conf $DEFAULTS"
+
+start() {
+ $DAEMON $DAEMON_ARGS
+}
+
+stop() {
+ kill `cat $PIDFILE`
+}
+
+reload() {
+ kill -s HUP `cat $PIDFILE`
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ reload)
+ reload
+ ;;
+ restart|force-reload)
+ stop
+ sleep 1
+ start
+ ;;
+ *)
+ echo "Usage: $0 (start|stop|reload|restart|force-reload)"
+ ;;
+esac
diff --git a/network/ttdnsd/slack-desc b/network/ttdnsd/slack-desc
new file mode 100644
index 000000000000..87793826955a
--- /dev/null
+++ b/network/ttdnsd/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 ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+ttdnsd: ttdnsd (The Tor TCP DNS Daemon)
+ttdnsd:
+ttdnsd: ttdnsd is a forwarding nameserver that also bridges between UDP and
+ttdnsd: TCP, forwarding each DNS request over Tor.
+ttdnsd:
+ttdnsd:
+ttdnsd:
+ttdnsd:
+ttdnsd:
+ttdnsd:
+ttdnsd:
diff --git a/network/ttdnsd/ttdnsd.SlackBuild b/network/ttdnsd/ttdnsd.SlackBuild
new file mode 100644
index 000000000000..7acd376f4967
--- /dev/null
+++ b/network/ttdnsd/ttdnsd.SlackBuild
@@ -0,0 +1,93 @@
+#!/bin/sh
+
+# Slackware build script for ttdnsd.
+#
+# Copyright 2010-2011 Marco Bonetti <sid77@slackware.it>
+# 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=ttdnsd
+VERSION=${VERSION:-0.7}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+DOCS="AUTHORS CHANGELOG LICENSE README README.TorDNS"
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+make install DESTDIR=$PKG
+
+# House cleaning begins
+chmod 0644 $PKG/etc/default/ttdnsd
+mv $PKG/etc/default/ttdnsd $PKG/etc/default/ttdnsd.new
+rm -rf $PKG/etc/init.d
+mkdir -p $PKG/etc/rc.d
+install -m 0755 $CWD/rc.ttdnsd.new $PKG/etc/rc.d/
+mv $PKG/etc/ttdnsd.conf $PKG/etc/ttdnsd.conf.new
+mkdir -p $PKG/usr/doc
+mv $PKG/usr/share/doc/ttdnsd $PKG/usr/doc/$PRGNAM-$VERSION
+mv $PKG/usr/share/man $PKG/usr/
+rmdir $PKG/usr/share/doc
+rmdir $PKG/usr/share
+mv $PKG/var/lib/ttdnsd/tsocks.conf $PKG/var/lib/ttdnsd/tsocks.conf.new
+# House cleaning ends
+
+find $PKG | xargs 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
+
+cp -a $DOCS $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:-tgz}
diff --git a/network/ttdnsd/ttdnsd.info b/network/ttdnsd/ttdnsd.info
new file mode 100644
index 000000000000..2d81cde6236f
--- /dev/null
+++ b/network/ttdnsd/ttdnsd.info
@@ -0,0 +1,10 @@
+PRGNAM="ttdnsd"
+VERSION="0.7"
+HOMEPAGE="http://www.mulliner.org/collin/ttdnsd.php"
+DOWNLOAD="http://crypto.nsa.org/tor/ttdnsd-0.7.tar.gz"
+MD5SUM="5e964e019b3024cbff15d011071a6772"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+MAINTAINER="Marco Bonetti"
+EMAIL="sid77@slackware.it"
+APPROVED="dsomero"