Mercurial > hg > anonet-resdb
changeset 778:150043713880 draft
massive update to peer2anonet, here's hoping i didn't fuck something
up ;-)
author | d3v11 <d3v11@d3v11.ano> |
---|---|
date | Sat, 26 Nov 2011 05:16:10 +0000 |
parents | b13bf8dc2c0c |
children | 7746032f8698 |
files | contrib/peer2anonet/DEBIAN/configure contrib/peer2anonet/DEBIAN/control contrib/peer2anonet/README contrib/peer2anonet/peer2anonet |
diffstat | 4 files changed, 157 insertions(+), 66 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/peer2anonet/DEBIAN/configure Sat Nov 26 00:27:46 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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
--- a/contrib/peer2anonet/DEBIAN/control Sat Nov 26 00:27:46 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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. - -
--- a/contrib/peer2anonet/README Sat Nov 26 00:27:46 2011 +0000 +++ b/contrib/peer2anonet/README Sat Nov 26 05:16:10 2011 +0000 @@ -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 + + quicktun, bird, daemontools(non-deb), bash + +AUTHOR: + + d3v11 from www.d3v11.ano somtimes, maybe, dunno. + + REPORT BULLSHIT TO: + + IRC: + + /relayhell/d3v11 + + EMAIL: + + d3v11@d3v11.ano USAGE: - --configure generate a new local configuration and exit - - --update regenerate peer configurations + ./contrib/peer2anonet/peer2anonet --configure generate a new local configuration and exit - --configure-peer generate a new peer configuration and update + ./contrib/peer2anonet/peer2anonet --update regenerate peer configurations - --rm-peer remove a peer configuration and update + ./contrib/peer2anonet/peer2anonet --configure-peer generate a new peer configuration and update - --install-daemontools installs daemontools - - --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 - - RUN CHANGES: +RTFM: - 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: - EXAMPLES: + I highly recommend that before you use peer2anonet + you ./configure resdb with tinydns support. - ./peer2anonet --configure + ./contrib/peer2anonet/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: - ./peer2anonet --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 keypairs above * - Enter your private key: * see keypairs above * + 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 uses the following for port configurations: - LOCAL_PORT=20${PEERASN:0:4} + 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: + + If you did not ./configure resdb with tinydns support + then you need to do that before using this function. + + also before using you will need to have installed + daemontools, djbdns, and ucspi-tcp. peer2anonet + can do this for you with --install-* options. + + ./contrib/peer2anonet/peer2anonet --configure-dns
--- a/contrib/peer2anonet/peer2anonet Sat Nov 26 00:27:46 2011 +0000 +++ b/contrib/peer2anonet/peer2anonet Sat Nov 26 05:16:10 2011 +0000 @@ -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 @@ 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 @@ 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 @@ } 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 @@ 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_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 @@ 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 @@ INSTALL_UCSPI_TCP elif [ "$1" == '--install-djbdns' ]; then INSTALL_DJBDNS +elif [ "$1" == '--configure-dns' ]; then + CONFIGURE_DNS else USAGE fi