From 8307feb012e94c2a4b43b9a5b42dacedab2725ca Mon Sep 17 00:00:00 2001 From: d3v11 Date: Sat, 26 Nov 2011 05:16:10 +0000 Subject: massive update to peer2anonet, here's hoping i didn't fuck something up ;-) --- contrib/peer2anonet/DEBIAN/configure | 10 ---- contrib/peer2anonet/DEBIAN/control | 12 ---- contrib/peer2anonet/README | 107 ++++++++++++++++++++++++----------- contrib/peer2anonet/peer2anonet | 90 ++++++++++++++++++++++++++--- 4 files changed, 155 insertions(+), 64 deletions(-) delete mode 100755 contrib/peer2anonet/DEBIAN/configure delete mode 100644 contrib/peer2anonet/DEBIAN/control (limited to 'contrib/peer2anonet') diff --git a/contrib/peer2anonet/DEBIAN/configure b/contrib/peer2anonet/DEBIAN/configure deleted file mode 100755 index 6a01c74..0000000 --- a/contrib/peer2anonet/DEBIAN/configure +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -read -p "Enter your anonet network: " P2A_NET -read -p "Enter your anonet router: " P2A_ROUTE -read -p "Enter your anonet asn: " P2A_ASN -read -p "Enter your anonet ip: " P2A_IP - -echo "P2A_NET=\"$P2A_NET\"" >>DEBIAN/peer2anonet/etc/peer2anonet/p2a.conf -echo "P2A_ROUTE=\"$P2A_ROUTE\"" >>DEBIAN/peer2anonet/etc/peer2anonet/p2a.conf -echo "P2A_ASN=\"$P2A_ASN\"" >>DEBIAN/peer2anonet/etc/peer2anonet/p2a.conf -echo "P2A_IP=\"$P2A_IP\"" >>DEBIAN/peer2anonet/etc/peer2anonet/p2a.conf diff --git a/contrib/peer2anonet/DEBIAN/control b/contrib/peer2anonet/DEBIAN/control deleted file mode 100644 index 903b29e..0000000 --- a/contrib/peer2anonet/DEBIAN/control +++ /dev/null @@ -1,12 +0,0 @@ -Source: peer2anonet -Priority: optional -Maintainer: d3v11 -Version: 1.0-0 -Package: peer2anonet -Architecture: all -Depends: bash(>= 4.1) -Description: peer2anonet 1.0-0 - peer2anonet is an autoconfiguration utility to easily establish a - peering session with BGP on AnoNet2. - - diff --git a/contrib/peer2anonet/README b/contrib/peer2anonet/README index 8b8eacf..1b300b4 100644 --- a/contrib/peer2anonet/README +++ b/contrib/peer2anonet/README @@ -1,64 +1,105 @@ DESCRIPTION: - peer2anonet is an autoconfiguration utility to easily establish a - peering session with BGP on AnoNet2. + + peer2anonet is an autoconfiguration utility for setting + up core services on AnoNet2. Enjoy :-). DEPENDS ON: - quicktun, bird, daemontools(non-deb), bash -USAGE: + quicktun, bird, daemontools(non-deb), bash + +AUTHOR: + + d3v11 from www.d3v11.ano somtimes, maybe, dunno. + + REPORT BULLSHIT TO: - --configure generate a new local configuration and exit + IRC: + + /relayhell/d3v11 - --update regenerate peer configurations + EMAIL: + + d3v11@d3v11.ano - --configure-peer generate a new peer configuration and update +USAGE: + + ./contrib/peer2anonet/peer2anonet --configure generate a new local configuration and exit - --rm-peer remove a peer configuration and update + ./contrib/peer2anonet/peer2anonet --update regenerate peer configurations - --install-daemontools installs daemontools + ./contrib/peer2anonet/peer2anonet --configure-peer generate a new peer configuration and update - --install-ucspi-tcp installs ucspi-tcp + ./contrib/peer2anonet/peer2anonet --rm-peer remove a peer configuration and update - --install-djbdns installs djbdns + ./contrib/peer2anonet/peer2anonet --install-daemontools installs daemontools -NOTES: + ./contrib/peer2anonet/peer2anonet --install-ucspi-tcp installs ucspi-tcp - KEY PAIRS: + ./contrib/peer2anonet/peer2anonet --install-djbdns installs djbdns - before running peer2anonet to configure peers you can use - quicktun to generate keypairs: + ./contrib/peer2anonet/peer2anonet --configure-dns configures dnscache and tinydns zones - quicktun.keypair>/etc/peer2anonet/p2a.conf echo "P2A_ASN=\"$P2A_ASN\"">>/etc/peer2anonet/p2a.conf echo -e '\npeer2anonet: configured\n' + NICK=`cat conf/git_name` + ./scripts/add_as $P2A_ASN $NICK + ./scripts/add_ip $P2A_NET/24 $NICK + ./scripts/add_dom $NICK.ano $NICK a.ns.$NICK.ano/`cat db/dom/ano/$NICK/ns/a.ns.$NICK.ano` exit 0 } @@ -247,6 +255,7 @@ CONFIGURE_PEER(){ read -p " Enter your peer's asn: " PEERASN read -p " Enter your peer's public key: " PUBKEY read -p " Enter your private key: " SECKEY + [ -e /etc/peer2anonet/peers/"$PEER" ] && rm -r /etc/peer2anonet/peers/"$PEER" mkdir -p /etc/peer2anonet/peers/"$PEER" echo $REMOTEIP >/etc/peer2anonet/peers/"$PEER"/remote_ip echo $PEERIP >/etc/peer2anonet/peers/"$PEER"/peering_ip @@ -272,10 +281,13 @@ RM_PEER(){ } INSTALL_DAEMONTOOLS(){ + echo -e '\nINSTALL DAEMONTOOLS:\n' [[ $(echo X`which gcc`) == X ]] && echo ' error: cannot find gcc' [[ $(echo X`which gcc`) == X ]] && exit 1 [[ $(echo X`which make`) == X ]] && echo ' error: cannot find make' [[ $(echo X`which make`) == X ]] && exit 1 + [[ $(echo X`which csh`) == X ]] && echo ' error: cannot find csh' + [[ $(echo X`which csh`) == X ]] && exit 1 mkdir -p /package chmod 1755 /package cd /package @@ -286,9 +298,13 @@ INSTALL_DAEMONTOOLS(){ cd admin/daemontools-0.76 sed -i 's/gcc/gcc -include errno.h/g' src/conf-cc package/install + cp /etc/rc.local /etc/peer2anonet/rc.local.backup + sed -i "s/exit 0/csh -cf \'\/command\/svscanboot \&\'/" /etc/rc.local + chmod +x /etc/rc.local } INSTALL_UCSPI_TCP(){ + echo -e '\nINSTALL UCSPI-TCP:\n' [[ $(echo X`which gcc`) == X ]] && echo ' error: cannot find gcc' [[ $(echo X`which gcc`) == X ]] && exit 1 [[ $(echo X`which make`) == X ]] && echo ' error: cannot find make' @@ -304,6 +320,7 @@ INSTALL_UCSPI_TCP(){ } INSTALL_DJBDNS(){ + echo -e '\nINSTALL DJBDNS:\n' [[ $(echo X`which gcc`) == X ]] && echo ' error: cannot find gcc' [[ $(echo X`which gcc`) == X ]] && exit 1 [[ $(echo X`which make`) == X ]] && echo ' error: cannot find make' @@ -318,6 +335,59 @@ INSTALL_DJBDNS(){ make setup check } +CONFIGURE_DNS(){ + echo -e '\nCONFIGURE DNS:\n' + NICK=`cat conf/git_name` + TINYDNS_ROOT_IP=`cat conf/tinydns__rootsrvrip` + TINYDNS_ROOT_DOMAIN=`cat conf/tinydns__rootsrvrname` + TINYDNS_ANO_IP=`cat conf/tinydns__tldsrvrip` + TINYDNS_ANO_DOMAIN=`cat conf/tinydns__tldsrvrname` + TINYDNS_IP=`cat db/dom/ano/$NICK/ns/a.ns.$NICK.ano` + TINYDNS_DOMAIN="a.ns.$NICK.ano" + GIT_IP=`cat conf/gitd_ip` + GIT_DOMAIN="git.$NICK.ano" + + ip addr add $TINYDNS_ROOT_IP/32 dev lo & + ip addr add $TINYDNS_IP/32 dev lo & + ip addr add $TINYDNS_ANO_IP/32 dev lo & + ip addr add $GIT_IP/32 dev lo & + + echo "ip addr add $TINYDNS_ROOT_IP/32 dev lo &" >> /etc/rc.local + echo "ip addr add $TINYDNS_IP/32 dev lo &" >> /etc/rc.local + echo "ip addr add $TINYDNS_ANO_IP/32 dev lo &" >> /etc/rc.local + echo "ip addr add $GIT_IP/32 dev lo &" >> /etc/rc.local + + useradd Gdnscache + useradd Gdnslog + useradd Gtinydns + + dnscache-conf Gdnscache Gdnslog /services/dnscache + mv /services/dnscache/root/servers/@ /services/dnscache/root/servers/@.icann + echo $TINYDNS_ROOT_IP >/services/dnscache/root/servers/@ + echo 'nameserver 127.0.0.1' >/etc/resolv.conf + ( cd / ; ln -s /services/dnscache /service/dnscache ) + + tinydns-conf Gtinydns Gdnslog /services/tinydns $TINYDNS_IP + ( cd / ; ln -s /services/tinydns /service/tinydns ) + ( cd /service/tinydns/root ; ./add-ns $TINYDNS_DOMAIN $TINYDNS_IP ) + ( cd /service/tinydns/root ; ./add-alias $GIT_DOMAIN $GIT_IP ) + ( cd /service/tinydns/root ; ./add-alias $TINYDNS_ANO_IP $TINYDNS_ROOT_IP ) + ( cd /service/tinydns/root ; ./add-alias $TINYDNS_ANO_DOMAIN $TINYDNS_ANO_IP ) + ( cd /service/tinydns/root ; make ) + + tinydns-conf Gtinydns Gdnslog /services/tinydns-root $TINYDNS_ROOT_IP + ( cd / ; ln -s /services/tinydns-root /service/tinydns-root ) + ./scripts/nameserver_autogen/tinydns_root_datafile > /service/tinydns-root/root/data + ( cd /service/tinydns-root/root ; make ) + + tinydns-conf Gtinydns Gdnslog /services/tinydns-ano $TINYDNS_ANO_IP + ( cd / ; ln -s /services/tinydns-ano /service/tinydns-ano ) + ./scripts/nameserver_autogen/tinydns_tld_datafile > /service/tinydns-ano/root/data + ( cd /service/tinydns-ano/root ; make ) + + ( cd /service ; svc -t dnscache tinydns* ) + } + if [ "$1" == '--configure' ]; then CONFIGURE @@ -335,6 +405,8 @@ elif [ "$1" == '--install-ucspi-tcp' ]; then INSTALL_UCSPI_TCP elif [ "$1" == '--install-djbdns' ]; then INSTALL_DJBDNS +elif [ "$1" == '--configure-dns' ]; then + CONFIGURE_DNS else USAGE fi -- cgit v1.2.3