repo: resdb
action: commit
revision: 
path_from: 
revision_from: 693cadd1df535a6875b26a659ea8d080cc6a5481:
path_to: 
revision_to: 
git.thebackupbox.net
resdb
git clone git://git.thebackupbox.net/resdb
commit 693cadd1df535a6875b26a659ea8d080cc6a5481
Author: d3v11 
Date:   Tue Nov 29 09:23:30 2011 +0000

    updates for peer2anonet,
            ./contrib/peer2anonet/peer2anonet --update-dns
            can now bring tinydns-ano up to date.

diff --git a/contrib/peer2anonet/README b/contrib/peer2anonet/README.html
similarity index 60%
rename from contrib/peer2anonet/README
rename to contrib/peer2anonet/README.html
index 1693e7c8e7e4a2e9761d5dac5aff6c636959ae69..
index ..b536411a3a42e9b8925f2fa016c8a812e67be44a 100644
--- a/contrib/peer2anonet/README
+++ b/contrib/peer2anonet/README.html
@@ -1,27 +1,30 @@
-DESCRIPTION:
+
+
+DESCRIPTION:

     peer2anonet is an autoconfiguration utility for setting
     up core services on AnoNet2. Enjoy :-).

-DEPENDS ON:
+DEPENDS ON:

-    quicktun, bird, daemontools(non-deb), bash
+    quicktun, bird, bash for now. it also installs some cool shit
+    that you'll use later.

-AUTHOR:
+AUTHOR:

-    d3v11 from www.d3v11.ano somtimes, maybe, dunno.
+    d3v11 from www.d3v11.ano, somtimes, maybe, dunno.

-    REPORT BULLSHIT TO:
+    REPORT BULLSHIT TO:

-        IRC:
+        IRC:

             /relayhell/d3v11

-        EMAIL:
+        EMAIL:

             d3v11@d3v11.ano

-USAGE:
+USAGE:

     ./contrib/peer2anonet/peer2anonet --configure             generate a new local configuration and exit

@@ -39,58 +42,66 @@ USAGE:

     ./contrib/peer2anonet/peer2anonet --configure-dns         configures dnscache and tinydns zones

-RTFM:
+    ./contrib/peer2anonet/peer2anonet --update-dns            updates tinydns-ano zone

-    CONFIGURE:
+RTFM:
+
+    CONFIGURE:

         I highly recommend that before you use peer2anonet
         you ./configure resdb with tinydns support.

         ./contrib/peer2anonet/peer2anonet --configure

-        EXAMPLES:
+        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:
+    CONFIGURE PEER:

         ./contrib/peer2anonet/peer2anonet --configure-peer

-            KEY PAIRS:
+            KEY PAIRS:

                 before running peer2anonet to configure peers you can use
                 quicktun to generate keypairs:

-                    quicktun.keypairEXAMPLES:

                 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 remote port: 21150
+                Enter your local port: 61150
                 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:
+            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:
+            CONFIGURATION FILES:
+
+                /etc/peer2anonet/peers/$PEER/* contains:
+                
+                    asn  local_port  peering_ip  pubkey  remote_ip  remote_port  run  seckey
+
+                In the event you want to reconfigure a peer's tunnel you can alter the run
+                file and do `--update', rm run and modify the above files then use `--update',
+                or reconfigure the peering tunnel altogether with --configure-peer and choose
+                that peer's name. If you think this is absurd then you're probably right! I 
+                plan on doing something with these files later.
+
+    CONFIGURE DNS:

         If you did not ./configure resdb with tinydns support
         then you need to do that before using this function.
@@ -101,7 +112,13 @@ RTFM:

         ./contrib/peer2anonet/peer2anonet --configure-dns

-    COMPLAIN:
+        UPDATE DNS:
+
+            After a successful `--configure-dns', you can now
+            enjoy to use `--update-dns' to bring your AnoNet
+            domains up to speed.
+
+    COMPLAIN:

         If this README doesn't tell you what you need to know
         you can head over to www.d3v11.ano/peering. If that
@@ -109,5 +126,5 @@ RTFM:
         me or shoot both of us in the face.


-

+
diff --git a/contrib/peer2anonet/peer2anonet b/contrib/peer2anonet/peer2anonet
index 4e6aad3aadc23bc9ef9895fe9c609579739b315e..
index ..bfa671b25fe556f8a40d8cf656072f15ec192c29 100755
--- a/contrib/peer2anonet/peer2anonet
+++ b/contrib/peer2anonet/peer2anonet
@@ -21,7 +21,8 @@ USAGE(){
     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'
+    echo -e '\n    ./contrib/peer2anonet/peer2anonet --configure-dns         configures dnscache and tinydns zones'
+    echo -e '\n    ./contrib/peer2anonet/peer2anonet --update-dns            updates tinydns-ano zone\n'
     exit 0
     }

@@ -399,9 +400,13 @@ CONFIGURE_DNS(){
         tar cf /etc/peer2anonet/tinydns-root.tar tinydns-root )
     fi

-    (cd /service ; svc -d dnscache tinydns tinydns-ano tinydns-root) 
-    (cd /service ; rm -f dnscache tinydns tinydns-ano tinydns-root)   
-    (cd /services ; rm -rf dnscache tinydns tinydns-ano tinydns-root)
+    (
+        cd /service
+        svc -d dnscache tinydns tinydns-ano tinydns-root
+        rm -f dnscache tinydns tinydns-ano tinydns-root
+        cd /services
+        rm -rf dnscache tinydns tinydns-ano tinydns-root
+    )

     echo -e '\nCONFIGURE DNS:\n'
     NICK=`cat conf/git_name`
@@ -443,22 +448,13 @@ CONFIGURE_DNS(){


     tinydns-conf Gtinydns Gdnslog /services/tinydns $TINYDNS_IP
-    #echo ".$NICK.ano:$TINYDNS_IP:a:259200" > /services/tinydns/root/data
-    #echo "=www.$NICK.ano:$GIT_IP:86400" >> /services/tinydns/root/data
-    #echo "+git.$NICK.ano:$GIT_IP:86400" >> /services/tinydns/root/data
-    #echo "+$NICK.ano:$GIT_IP:86400" >> /services/tinydns/root/data
-    #echo "+$TINYDNS_ANO_DOMAIN:$TINYDNS_ANO_IP:3600" >> /services/tinydns/root/data
-    #echo ".1.in-addr.arpa::$TINYDNS_ANO_DOMAIN" >> /services/tinydns/root/data
-    #echo ".2.in-addr.arpa::$TINYDNS_ANO_DOMAIN" >> /services/tinydns/root/data
-    #echo ".ano::$TINYDNS_ANO_DOMAIN" >> /services/tinydns/root/data
-    #echo ".ntwrk::$TINYDNS_ANO_DOMAIN" >> /services/tinydns/root/data
     (
-     cd /services/tinydns/root
-     ./add-ns $NICK.ano $TINYDNS_IP
-     ./add-alias $GIT_DOMAIN $GIT_IP
-     ./add-alias $TINYDNS_ROOT_DOMAIN $TINYDNS_ROOT_IP
-     ./add-alias $TINYDNS_ANO_DOMAIN $TINYDNS_ANO_IP
-     make
+        cd /services/tinydns/root
+        ./add-ns $NICK.ano $TINYDNS_IP
+        ./add-alias $GIT_DOMAIN $GIT_IP
+        ./add-alias $TINYDNS_ROOT_DOMAIN $TINYDNS_ROOT_IP
+        ./add-alias $TINYDNS_ANO_DOMAIN $TINYDNS_ANO_IP
+        make
     )

     tinydns-conf Gtinydns Gdnslog /services/tinydns-root $TINYDNS_ROOT_IP
@@ -469,11 +465,66 @@ CONFIGURE_DNS(){
     ./scripts/nameserver_autogen/tinydns_tld_datafile > /services/tinydns-ano/root/data
     ( cd /services/tinydns-ano/root ; make )

-    ( cd / ; ln -s /services/dnscache /service/dnscache )
-    ( cd / ; ln -s /services/tinydns /service/tinydns )
-    ( cd / ; ln -s /services/tinydns-ano /service/tinydns-ano )
-    ( cd / ; ln -s /services/tinydns-root /service/tinydns-root )
-    ( cd /service ; sleep 5 ; svc -t dnscache tinydns tinydns-ano tinydns-root )  
+    ( 
+        cd /
+        ln -s /services/dnscache /service/dnscache
+        ln -s /services/tinydns /service/tinydns
+        ln -s /services/tinydns-ano /service/tinydns-ano
+        ln -s /services/tinydns-root /service/tinydns-root
+        cd /service ; sleep 5 ; svc -t dnscache tinydns tinydns-ano tinydns-root
+    )
+    }
+
+INSTALL_DJBDNS(){
+    echo -e '\nINSTALL DJBDNS:\n'
+    [[ $(echo X`which gcc`) == X ]] && echo '   fatal error: cannot find gcc'
+    [[ $(echo X`which gcc`) == X ]] && exit 1
+    [[ $(echo X`which make`) == X ]] && echo '   fatal error: cannot find make'
+    [[ $(echo X`which make`) == X ]] && exit 1
+    [[ $(echo X`which tcpserver`) == X ]] && echo '   fatal error: needs ./contrib/peer2anonet/peer2nonet --install-ucspi-tcp'
+    [[ $(echo X`which tcpserver`) == X ]] && exit 1
+    [[ $(echo X`which svscanboot`) == X ]] && echo '   fatal error: needs ./contrib/peer2anonet/peer2nonet --install-daemontools'
+    [[ $(echo X`which svscanboot`) == X ]] && exit 1
+    cd /usr/local/src
+    wget http://cr.yp.to/djbdns/djbdns-1.05.tar.gz
+    gunzip djbdns-1.05.tar
+    tar -xf djbdns-1.05.tar
+    cd djbdns-1.05
+    echo gcc -O2 -include /usr/include/errno.h > conf-cc
+    make
+    make setup check
+    }
+
+UPDATE_DNS(){
+    if [ -e /etc/peer2anonet/p2a.conf ]; then
+        source /etc/peer2anonet/p2a.conf
+    else
+        CONFIGURE
+        exit 0
+    fi
+
+    [[ $(echo X`which tcpserver`) == X ]] && echo '   fatal error: needs ./contrib/peer2anonet/peer2nonet --install-ucspi-tcp'
+    [[ $(echo X`which tcpserver`) == X ]] && exit 1
+    [[ $(echo X`which svscanboot`) == X ]] && echo '   fatal error: needs ./contrib/peer2anonet/peer2nonet --install-daemontools'
+    [[ $(echo X`which svscanboot`) == X ]] && exit 1
+
+    if [ -e /services/tinydns-ano ]; then
+        ( 
+            cd /services
+            echo "creating /etc/peer2anonet/tinydns-ano.tar backup"
+            tar cf /etc/peer2anonet/tinydns-ano.tar tinydns-ano
+        )
+    fi
+
+    echo -e '\nUPDATE DNS:\n'
+    ./scripts/nameserver_autogen/tinydns_tld_datafile > /services/tinydns-ano/root/data
+    ( cd /services/tinydns-ano/root ; make )
+
+    ( 
+        cd /service
+        sleep 5
+        svc -t dnscache tinydns tinydns-ano tinydns-root
+    )
     }


@@ -495,6 +546,8 @@ elif [ "$1" == '--install-djbdns' ]; then
     INSTALL_DJBDNS
 elif [ "$1" == '--configure-dns' ]; then
     CONFIGURE_DNS
+elif [ "$1" == '--update-dns' ]; then
+    UPDATE_DNS
 else
     USAGE
 fi

-----END OF PAGE-----