summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Tittelbach (xro) <xro@gmx.net>2009-11-13 16:50:23 +0000
committerBernhard Tittelbach (xro) <xro@gmx.net>2009-11-13 16:50:23 +0000
commite2c73d1188456775a14eebdb11d109c80d9ba60f (patch)
tree5bf205c0f877ec14c3ea730ea8ee1824701cee4a /net-misc/anytun
parentx11-wm/i3: Version bump to i3-3.d (diff)
downloadsunrise-e2c73d1188456775a14eebdb11d109c80d9ba60f.tar.gz
sunrise-e2c73d1188456775a14eebdb11d109c80d9ba60f.tar.bz2
sunrise-e2c73d1188456775a14eebdb11d109c80d9ba60f.zip
net-misc/anytun: New Ebuild for bug 292356.
svn path=/sunrise/; revision=9513
Diffstat (limited to 'net-misc/anytun')
-rw-r--r--net-misc/anytun/ChangeLog15
-rw-r--r--net-misc/anytun/Manifest5
-rw-r--r--net-misc/anytun/anytun-0.3.1.ebuild83
-rwxr-xr-xnet-misc/anytun/files/anytun-0.3.1.init185
-rw-r--r--net-misc/anytun/metadata.xml12
5 files changed, 300 insertions, 0 deletions
diff --git a/net-misc/anytun/ChangeLog b/net-misc/anytun/ChangeLog
new file mode 100644
index 000000000..1d0062133
--- /dev/null
+++ b/net-misc/anytun/ChangeLog
@@ -0,0 +1,15 @@
+# ChangeLog for net-misc/anytun
+# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v3
+# $Header: $
+
+ 13 Nov 2009; Bernhard Tittelbach (xro) <xro@gmx.net> +anytun-0.3.1.ebuild,
+ +files/anytun-0.3.1.init, +metadata.xml:
+ New Ebuild for bug 292356.
+
+*anytun-0.3.1 (09 Nov 2009)
+
+ 09 Nov 2009; Bernhard Tittelbach (xro) <xro@gmx.net> anytun-0.3.1.ebuild files/anytun-0.3.1.init :
+ Initial import. Ebuild submitted by Bernhard Tittelbach <xro@realraum.at>.
+ Wrote a gentoo-ified initrd script for anytun.
+ Much linting was done to make a shiny ebuild was done with the help of the nice
+ people in #gentoo-sunrise
diff --git a/net-misc/anytun/Manifest b/net-misc/anytun/Manifest
new file mode 100644
index 000000000..e636d5f39
--- /dev/null
+++ b/net-misc/anytun/Manifest
@@ -0,0 +1,5 @@
+AUX anytun-0.3.1.init 4741 RMD160 41021c9336fe037b4b7b76bafbe0cbc343366570 SHA1 a5b9803db65a8e2ccb881818e6d7bda0401bd475 SHA256 946a48cfae01976469f33aba4d3b281d6ae1cd1dc69f1f57d227c85a2e2e3e44
+DIST anytun-0.3.1.tar.gz 133451 RMD160 0750f681887dcfc527fbf92f525e16b8ab5bfa47 SHA1 7489ebff5b5cefe909e7f187feae783b874ab614 SHA256 e696b2b6767753234df21dbfce8d994d4a9bbb75e9f3f360081d25ece5eb80c6
+EBUILD anytun-0.3.1.ebuild 3023 RMD160 b6b126bda1461d3fdce2682a174fc17000b137ba SHA1 61dbe300951a64abb04703b17e18f434574edc0d SHA256 7f9bf8b0d5830e64cdeb3b568dc289dd90573cdcc115cbcb6069851e228aefee
+MISC ChangeLog 633 RMD160 eac9cb73ed96b6aff1b4c49b4013a3c93d9a2253 SHA1 328574b74c855e687dfb8478d664223fc415f2f1 SHA256 07f9282e4801e311260fe607ea980ebc8bc723b3846839ca24b4fb1340ab0584
+MISC metadata.xml 665 RMD160 d9ec3f7218bcb08bd085753fe5c7a028cbe5c28d SHA1 8e561a19acd6b907dcd1827157dde60131a5db0b SHA256 3a0acaf06b44bad94381079b79b35b37e484296c776981c4553e4bcc3e710aaa
diff --git a/net-misc/anytun/anytun-0.3.1.ebuild b/net-misc/anytun/anytun-0.3.1.ebuild
new file mode 100644
index 000000000..32c080c6a
--- /dev/null
+++ b/net-misc/anytun/anytun-0.3.1.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils
+
+DESCRIPTION="VPN daemon using Secure Anycast Tunneling"
+HOMEPAGE="http://anytun.org/"
+SRC_URI="http://anytun.org/~equinox/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="examples gcrypt"
+
+RDEPEND=">=dev-libs/boost-1.35
+ <dev-libs/boost-1.40
+ gcrypt? ( dev-libs/libgcrypt )
+ !gcrypt? ( dev-libs/openssl )"
+DEPEND="${RDEPEND}
+ <app-text/asciidoc-8.5.0" # asciidoc a2x >= 8.5.0 requires an -L switch not present in lower versions
+
+S="${WORKDIR}/${P}/src"
+
+src_compile() {
+ local myconf=""
+ use gcrypt || myconf="--use-ssl-crypto"
+ # anytun's configure right now only takes 1! option (no --prefix etc), so econf would be too
+ # much for your little script and the build would fail
+ #econf ${myconf} || die "configure failed"
+ ./configure ${myconf} || die "configure failed"
+
+ emake || die "make failed"
+
+ einfo "Building manpages"
+ emake manpage || die "failed building manpages"
+}
+
+src_install() {
+ dosbin anytun || die "failed to copy/install an executable"
+ dobin anytun-config anytun-controld anytun-showtables anytun-nosync || die "failed to copy/install an executable"
+ newinitd "${FILESDIR}/${PN}-0.3.1.init" anytun || die "failed to copy/install initrd script"
+ keepdir /var/run/anytun || die "failed to mkdir"
+ keepdir /var/run/anytun-controld || die "failed to mkdir"
+
+ cd man/
+ doman anyrtpproxy.8 anytun-config.8 anytun-controld.8 anytun-showtables.8 anytun.8 || die "failed to install manpages"
+
+ cd "../../"
+ insinto /usr/share/${P}/wireshark-lua/
+ doins wireshark-lua/* || die "failed to install wireshark-lua contrib script"
+
+ dodoc AUTHORS ChangeLog README || die "failed to install docs"
+
+ if use examples; then
+ insinto /usr/share/doc/${PF}/etc-anytun-examples/
+ doins -r etc/anytun/* || die "failed to install examples"
+ fi
+}
+
+pkg_config() {
+ [ -e "${ROOT}"/etc/anytun ] && die "${ROOT}/etc/anytun/ already present, rm -R it first "
+ if [ ! -d "${ROOT}"/usr/share/doc/${PF}/etc-anytun-examples/ ]; then
+ die "can't copy example configs since examples were not installed (reemerge with USE=\"examples\")"
+ fi
+ mkdir -p "${ROOT}"/etc/anytun/ || die "couldn't mkdir ${ROOT}/etc/anytun/"
+ cp -r "${ROOT}"/usr/share/doc/${PF}/etc-anytun-examples/* "${ROOT}"/etc/anytun/ || die "failed to copy examples"
+}
+
+pkg_postinst() {
+ enewgroup anytun
+ enewuser anytun -1 -1 /var/run/anytun anytun
+ einfo "Note that each VPN gets its own directory under /etc/anytun/"
+ einfo " (see examples provided with the package)"
+ einfo "You can either add tunnels to /etc/anytun/autostart and"
+ einfo "start them using /etc/init.d/anytun"
+ einfo "Or you can forget the autostart file and create"
+ einfo "gentoo-style anytun.{VPN} initrd scripts for each VPN"
+ einfo "# ln -s /etc/init.d/anytun /etc/init.d/anytun.client1"
+ einfo
+ einfo "You can disect anytun traffic using wireshark by plugging the script"
+ einfo " /usr/share/${P}/wireshark-lua/satp.lua into wireshark"
+}
diff --git a/net-misc/anytun/files/anytun-0.3.1.init b/net-misc/anytun/files/anytun-0.3.1.init
new file mode 100755
index 000000000..113e8e1ce
--- /dev/null
+++ b/net-misc/anytun/files/anytun-0.3.1.init
@@ -0,0 +1,185 @@
+#!/sbin/runscript
+# Distributed under the terms of the GNU General Public License v3
+# Written by Bernhard Tittelbach based on examples from Gentoo, openvpn and anytun debian init.rd script
+
+depend() {
+ need net
+ use dns
+ after bootmisc
+}
+
+DAEMON=/usr/sbin/anytun
+ANYTUNCONFIG=/usr/bin/anytun-config
+CONTROLDAEMON=/usr/bin/anytun-controld
+NAME=anytun
+DESC=anytun
+CONFIG_DIR=/etc/anytun
+VARCONFIG_DIR=/var/run/anytun-controld
+VARRUN_DIR=/var/run/anytun
+
+VPN=${SVCNAME#*.}
+[ "$VPN" = "$SVCNAME" ] && VPN=""
+
+# Include anytun defaults if available
+if [ -f /etc/default/anytun ] ; then
+ . /etc/default/anytun
+fi
+
+test -x $DAEMON || exit 1
+
+
+start_vpn () {
+ STATUS="OK"
+ if [ -f $CONFIG_DIR/$NAME/config ] ; then
+ POSTUP=''
+ test -f $CONFIG_DIR/$NAME/post-up.sh && POSTUP="-x $CONFIG_DIR/$NAME/post-up.sh"
+ CHROOTDIR=`grep '^chroot' < $CONFIG_DIR/$NAME/config | sed 's/chroot\s*//'`
+ if [ -n "$CHROOTDIR" ] ; then
+ test -d $CHROOTDIR || mkdir -p $CHROOTDIR
+ fi
+ test -d $VARRUN_DIR || mkdir -p $VARRUN_DIR
+ DAEMONARG=`sed 's/#.*//' < $CONFIG_DIR/$NAME/config | grep -e '\w' | sed 's/^/--/' | tr '\n' ' '`
+ $DAEMON --write-pid $VARRUN_DIR/$NAME.pid $POSTUP \
+ $DAEMONOPTS $DAEMONARG || STATUS="FAILED"
+ else
+ eerror "no config found"
+ return 1
+ fi
+ start_configd
+ return 0
+}
+stop_vpn () {
+ kill `cat $PIDFILE` || true
+ rm $PIDFILE
+ stop_configd
+}
+
+start_configd () {
+ if [ -d $CONFIG_DIR/$NAME/conf.d ] ; then
+ test -d $VARCONFIG_DIR || mkdir -p $VARCONFIG_DIR
+ chmod 700 $VARCONFIG_DIR
+ rm -f $VARCONFIG_DIR/$NAME 2>/dev/null
+ for CLIENTNAME in `ls $CONFIG_DIR/$NAME/conf.d`; do
+ DAEMONARG=`sed 's/#.*//' < $CONFIG_DIR/$NAME/conf.d/$CLIENTNAME | grep -e '\w' | sed 's/^/ --/' | xargs echo`
+ $ANYTUNCONFIG $DAEMONARG >> $VARCONFIG_DIR/$NAME
+ done
+ CONTROLHOST=`sed 's/#.*//' < $CONFIG_DIR/$NAME/config | grep -e 'control-host' | sed 's/^/ --/'`
+ $CONTROLDAEMON -f $VARCONFIG_DIR/$NAME $DAEMONOPTS $CONTROLHOST \
+ --write-pid $VARCONFIG_DIR/$NAME.pid
+ # rm -f $VARCONFIG_DIR/$NAME
+ fi
+}
+stop_configd () {
+ if [ -d $CONFIG_DIR/$NAME/conf.d ] ; then
+ kill `cat $VARCONFIG_DIR/$NAME.pid` || true
+ rm $VARCONFIG_DIR/$NAME.pid
+ fi
+}
+
+start () {
+ if test -z "$VPN" ; then
+ if [ -f $CONFIG_DIR/autostart ] ; then
+ for NAME in `sed 's/#.*//' < $CONFIG_DIR/autostart | grep -e '\w'`; do
+ ebegin "Starting ${DESC} VPN: ${NAME}"
+ start_vpn
+ eend $?
+ done
+ else
+ eerror "no config found"
+ return 1;
+ fi
+ else
+ NAME="$VPN"
+ ebegin "Starting ${DESC} VPN: ${NAME}"
+ start_vpn
+ eend $?
+ fi
+}
+
+stop () {
+ if test -z "$VPN" ; then
+ for PIDFILE in `ls $VARRUN_DIR/*.pid 2> /dev/null`; do
+ NAME=`echo $PIDFILE | cut -c17-`
+ NAME=${NAME%%.pid}
+ ebegin "Stopping ${DESC} VPN: ${NAME}"
+ stop_vpn
+ eend $?
+ done
+ else
+ if test -e $VARRUN_DIR/${VPN}.pid ; then
+ PIDFILE=`ls $VARRUN_DIR/${VPN}.pid 2> /dev/null`
+ NAME=`echo $PIDFILE | cut -c17-`
+ NAME=${NAME%%.pid}
+ ebegin "Stopping ${DESC} VPN: ${NAME}"
+ stop_vpn
+ eend $?
+ else
+ eerror " failure: No such tunnel is running: $VPN"
+ fi
+ fi
+}
+
+reload () {
+ if test -z "$VPN" ; then
+ for PIDFILE in `ls $VARRUN_DIR/*.pid 2> /dev/null`; do
+ NAME=`echo $PIDFILE | cut -c17-`
+ NAME=${NAME%%.pid}
+ if [ -d $CONFIG_DIR/$NAME/conf.d ] ; then
+ ebegin "Reloading ${DESC} VPN: ${NAME}"
+ stop_vpn
+ start_vpn
+ eend $?
+ else
+ ebegin "Reloading ${DESC} VPN: ${NAME}"
+ stop_configd
+ start_configd
+ eend $?
+ fi
+ done
+ else
+ if test -e $VARRUN_DIR/${VPN}.pid ; then
+ PIDFILE=`ls $VARRUN_DIR/${VPN}.pid 2> /dev/null`
+ NAME=`echo $PIDFILE | cut -c17-`
+ NAME=${NAME%%.pid}
+ if [ -d $CONFIG_DIR/$NAME/conf.d ] ; then
+ ebegin "Reloading ${DESC} VPN: ${NAME}"
+ stop_vpn
+ start_vpn
+ eend $?
+ else
+ ebegin "Reloading ${DESC} VPN: ${NAME}"
+ stop_configd
+ start_configd
+ eend $?
+ fi
+ else
+ eerror "failure: No such tunnel is running: $VPN"
+ fi
+ fi
+}
+
+restart () {
+ if test -z "$VPN" ; then
+ for PIDFILE in `ls $VARRUN_DIR/*.pid 2> /dev/null`; do
+ NAME=`echo $PIDFILE | cut -c17-`
+ NAME=${NAME%%.pid}
+ ebegin "Restarting ${DESC} VPN: ${NAME}"
+ stop_vpn
+ start_vpn
+ eend $?
+ done
+ else
+ if test -e $VARRUN_DIR/${VPN}.pid ; then
+ PIDFILE=`ls $VARRUN_DIR/${VPN}.pid 2> /dev/null`
+ NAME=`echo $PIDFILE | cut -c17-`
+ NAME=${NAME%%.pid}
+ ebegin "Restarting ${DESC} VPN: ${NAME}"
+ stop_vpn
+ start_vpn
+ eend $?
+ else
+ eerror "failure: No such tunnel is running: $VPN"
+ fi
+ fi
+}
+
diff --git a/net-misc/anytun/metadata.xml b/net-misc/anytun/metadata.xml
new file mode 100644
index 000000000..498b91174
--- /dev/null
+++ b/net-misc/anytun/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>anytun</herd>
+<longdescription>Anytun is an implementation of the Secure Anycast Tunneling Protocol. It provides similary functionality to openvpn but with less overhead, more flexible configuration and the ability use an anycast ip and therefore mulitple endpoints at the same time.</longdescription>
+<use>
+ <flag name='examples'>Install example configuration into /usr/share/doc/...</flag>
+ <flag name='gcrypt'>Prefer <pkg>dev-libs/libgcrypt</pkg> over
+ <pkg>dev-libs/openssl</pkg> for encryption
+ </flag>
+</use>
+</pkgmetadata>