From 6682d93a6ddc22bdc801143521b94790b1a97bd2 Mon Sep 17 00:00:00 2001 From: d3v1150m471c Date: Sun, 10 Jul 2011 07:16:47 -0500 Subject: peer2anonet changes made: * parse quicktun.keypair'* ]] && SECURE +[[ $CHECK == *'<'* ]] && SECURE +[[ $CHECK == *'/'* ]] && SECURE +[[ $CHECK == *'kill'* ]] && SECURE +done + ######################################################################### # We need to check if base files need to be imported to services for bird: NEW_PROTOCOL=" @@ -96,49 +162,18 @@ protocol direct direct_AnoNet_routes { table AnoNet_routes; import filter only_AnoNet; }" -while true; do - read -p "Is this your first peering session?" ASK - if [[ $ASK == *y* ]]; then - echo "$BIRD_CONF" > /services/bird/bird.conf - echo "$BIRD_RUN" > /services/bird/run - chmod +x /services/bird/run - echo "$NEW_PROTOCOL" >> /services/bird/bird.conf - break - elif [[ $ASK == *Y* ]]; then - echo "$BIRD_CONF" > /services/bird/bird.conf - echo "$BIRD_RUN" > /services/bird/run - chmod +x /services/bird/run - echo "$NEW_PROTOCOL" >> /services/bird/bird.conf - break - elif [[ $ASK == *n* ]]; then - break - elif [[ $ASK == *N* ]]; then - break - fi -done + + +test -e /services/bird/bird.conf || echo "$BIRD_CONF" > /services/bird/bird.conf +test -e /services/bird/run || echo "$BIRD_RUN" > /services/bird/run +chmod +x /services/bird/run +echo "$NEW_PROTOCOL" >> /services/bird/bird.conf ######################################################################### # We need to check if this peering session already exists: -if [ -e /services/"$PEERNAME" ]; then - while true; do - read -p "$PEERNAME already exists, would you like to replace it? [y/n]: " ASK - if [[ $ASK == *y* ]]; then - rm -r /services/"$PEERNAME" - mkdir /services/"$PEERNAME" - break - elif [[ $ASK == *Y* ]]; then - rm -r /services/"$PEERNAME" - mkdir /services/"$PEERNAME" - break - elif [[ $ASK == *n* ]]; then - exit 0 - elif [[ $ASK == *N* ]]; then - exit 0 - fi - done -else - mkdir /services/"$PEERNAME" -fi +test -e /services/"$PEERNAME" && rm -r /services/"$PEERNAME" +mkdir -p /services/"$PEERNAME" + ######################################################################### # Create files to configure the new peering session: @@ -146,7 +181,7 @@ echo "#!/bin/sh export REMOTE_ADDRESS=$REMOTEIP export REMOTE_PORT=$PEERPORT export LOCAL_PORT=$YOURPORT -export PRIVATE_KEY=$SECKEY +export PRIVATE_KEY=${SECKEY/'SECRET: /} export PUBLIC_KEY=$PUBKEY export TUN_MODE=1 export INTERFACE=ppp-$PEERNAME @@ -161,7 +196,6 @@ chmod +x /services/"$PEERNAME"/run ######################################################################### # Configure and start our new peering session: ln -s /services/"$PEERNAME" /service/ -echo echo "peer2anonet: New peering session configured " exit 0 -- cgit v1.2.3