diff options
author | d3v11 <d3v11@d3v11.ano> | 2011-11-26 05:16:10 +0000 |
---|---|---|
committer | d3v11 <d3v11@d3v11.ano> | 2011-11-26 05:16:10 +0000 |
commit | 8307feb012e94c2a4b43b9a5b42dacedab2725ca (patch) | |
tree | 22aeee86ba59d7bd00e703c804480ab4f9c0c9ad /contrib/peer2anonet | |
parent | 6aaa07d374fbe07a0c1952f88487b4fc848d41de (diff) | |
download | resdb-8307feb012e94c2a4b43b9a5b42dacedab2725ca.tar.gz resdb-8307feb012e94c2a4b43b9a5b42dacedab2725ca.zip |
massive update to peer2anonet, here's hoping i didn't fuck something
up ;-)
Diffstat (limited to 'contrib/peer2anonet')
-rwxr-xr-x | contrib/peer2anonet/DEBIAN/configure | 10 | ||||
-rw-r--r-- | contrib/peer2anonet/DEBIAN/control | 12 | ||||
-rw-r--r-- | contrib/peer2anonet/README | 107 | ||||
-rwxr-xr-x | contrib/peer2anonet/peer2anonet | 90 |
4 files changed, 155 insertions, 64 deletions
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</dev/random +RTFM: - RUN CHANGES: + CONFIGURE: - peer2anonet exports the /service/$PEER/run file to - /etc/peer2anonet/peers/$PEER/run. If you need to - create customizations for peerings then make adjustments - to that file. + I highly recommend that before you use peer2anonet + you ./configure resdb with tinydns support. - EXAMPLES: + ./contrib/peer2anonet/peer2anonet --configure - ./peer2anonet --configure + EXAMPLES: Enter your AnoNet subnet: 1.2.3.0 Enter your AnoNet router: 1.2.3.1 Enter your peering ip: 1.2.3.4 Enter your AnoNet asn: 1234 + CONFIGURE PEER: + + ./contrib/peer2anonet/peer2anonet --configure-peer + + KEY PAIRS: + + before running peer2anonet to configure peers you can use + quicktun to generate keypairs: + + quicktun.keypair</dev/random + + CLIENT PORT: + + peer2anonet uses '20' plus the first four digits of your peer's asn + as the `clientport'. + + LOCAL_PORT=20${PEERASN:0:4} + + EXAMPLES: + + Enter your peer's name: d3v11 + Enter your peer's remote ip: 11.11.55.1 + Enter your peer's peering ip: 1.1.5.2 + Enter your peer's remote port: 201150 + Enter your peer's asn: 1150 + Enter your peer's public key: * see KEY PAIRS above * + Enter your private key: * see KEY PAIRS above * + + RUN CHANGES: + + peer2anonet exports the /service/$PEER/run file to + /etc/peer2anonet/peers/$PEER/run. If you need to + create customizations for peerings then make adjustments + to that file. + + CONFIGURE DNS: - ./peer2anonet --configure-peer + If you did not ./configure resdb with tinydns support + then you need to do that before using this function. - Enter your peer's name: d3v11 - Enter your peer's remote ip: 11.11.55.1 - Enter your peer's peering ip: 1.1.5.2 - Enter your peer's remote port: 201150 - Enter your peer's asn: 1150 - Enter your peer's public key: * see keypairs above * - Enter your private key: * see keypairs above * + also before using you will need to have installed + daemontools, djbdns, and ucspi-tcp. peer2anonet + can do this for you with --install-* options. - # peer2anonet uses the following for port configurations: - LOCAL_PORT=20${PEERASN:0:4} + ./contrib/peer2anonet/peer2anonet --configure-dns diff --git a/contrib/peer2anonet/peer2anonet b/contrib/peer2anonet/peer2anonet index 98fef00..a2a9906 100755 --- a/contrib/peer2anonet/peer2anonet +++ b/contrib/peer2anonet/peer2anonet @@ -1,22 +1,26 @@ #!/bin/bash if [[ $(id -u) != 0 ]]; then - echo "error: root privileges required." + echo "peer2anonet: root privileges required." exit 1 fi if [ -e /services/bird ]; then - [ -e /etc/peer2anonet/bird.tar ] || (cd /services ; tar /etc/peer2anonet/bird.tar bird) + [ -e /etc/peer2anonet/bird.tar ] || ( cd /services ; tar cf /etc/peer2anonet/bird.tar bird ) fi +[ -e contrib/peer2anonet/peer2anonet ] || echo "peer2anonet: not in \$RESDB_ROOT" +[ -e contrib/peer2anonet/peer2anonet ] || exit 1 + USAGE(){ echo -e '\npeer2anonet:' - echo -e '\n --configure generate a new local configuration and exit' - echo -e '\n --update regenerate peer configurations' - echo -e '\n --configure-peer generate a new peer configuration and update' - echo -e '\n --rm-peer remove a peer configuration and update' - echo -e '\n --install-daemontools installs daemontools' - echo -e '\n --install-ucspi-tcp installs ucspi-tcp' - echo -e '\n --install-djbdns installs djbdns\n' + echo -e '\n ./contrib/peer2anonet/peer2anonet --configure generate a new local configuration and exit' + echo -e '\n ./contrib/peer2anonet/peer2anonet --update regenerate peer configurations' + echo -e '\n ./contrib/peer2anonet/peer2anonet --configure-peer generate a new peer configuration and update' + echo -e '\n ./contrib/peer2anonet/peer2anonet --rm-peer remove a peer configuration and update' + echo -e '\n ./contrib/peer2anonet/peer2anonet --install-daemontools installs daemontools' + echo -e '\n ./contrib/peer2anonet/peer2anonet --install-ucspi-tcp installs ucspi-tcp' + echo -e '\n ./contrib/peer2anonet/peer2anonet --install-djbdns installs djbdns' + echo -e '\n ./contrib/peer2anonet/peer2anonet --configure-dns configures dnscache and tinydns zones\n' exit 0 } @@ -44,6 +48,10 @@ CONFIGURE(){ echo "P2A_IP=\"$P2A_IP\"">>/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 |