changeset 542:32741b02849b draft

peer2anonet: Sun Jul 10 17:04:36 CDT 2011 - d3v1150m471c * security check and key bugs patched.
author d3v1150m471c <d3v11@d3v1150m471c.ano>
date Sun, 10 Jul 2011 17:06:31 -0500
parents f64ce05c68af
children 19893f0d86bd
files contrib/peer2anonet/README contrib/peer2anonet/peer2anonet
diffstat 2 files changed, 15 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/peer2anonet/README	Sun Jul 10 08:32:02 2011 -0500
+++ b/contrib/peer2anonet/README	Sun Jul 10 17:06:31 2011 -0500
@@ -108,6 +108,9 @@
         showing offending info for violating data detections.
       * security checks more specific
 
+      Sun Jul 10 17:04:36 CDT 2011 - d3v1150m471c
+      * security check and key bugs patched.
+
 
 
       
--- a/contrib/peer2anonet/peer2anonet	Sun Jul 10 08:32:02 2011 -0500
+++ b/contrib/peer2anonet/peer2anonet	Sun Jul 10 17:06:31 2011 -0500
@@ -14,14 +14,13 @@
 
 #########################################################################
 # Generate new keys:
-KEYS=`quicktun.keypair</dev/random`
-SECKEY=`echo $KEYS | head -1`
-YPUBKEY=`echo $KEYS | head -2 | tail -1`
+KEYS=`quicktun.keypair</dev/random | head -2`
+SECKEY=`echo "${KEYS/SECRET: /}" | head -1`
+YPUBKEY=`echo "${KEYS/PUBLIC: /}" | head -2 | tail -1`
 echo "
 peer2anonet: your public key is:
-
-$YPUBKEY
-
+"
+echo "$YPUBKEY
 "
 
 #########################################################################
@@ -41,8 +40,8 @@
 #########################################################################
 # Do some security checks on variables:
 TEST[0]=$PEERNAME; TEST[1]=$YOURNET; TEST[2]=$YOURROUTE; TEST[3]=$YOURIP
-TEST[4]=$YOURPORT; TEST[5]=$YOURASN; TEST[6]=$REMOTEIP; TEST[7]=$PEERIP
-       TEST[8]=$PEERPORT; TEST[9]=$PEERASN; TEST[10]=$PUBKEY
+TEST[4]=$REMOTEIP; TEST[5]=$PEERIP; TEST[6]=$YOURPORT; TEST[7]=$PEERPORT
+       TEST[8]=$YOURASN; TEST[9]=$PEERASN; TEST[10]=$PUBKEY
 
 if [[ $(echo ${TEST[0]} | tr -d 'a-zA-Z0-9._-' | wc -c) -gt 1 ]]; then
  echo "peer2anonet: fatal error: unacceptable data: ${TEST[0]}
@@ -51,7 +50,8 @@
 fi
      
 for((X=1;X<=5;X++)); do
-if [[ $(echo ${TEST[$X]} | tr -d '0-9.' | wc -c) -gt 1 ]]; then
+if [[ $(echo ${TEST[$X]} | tr -d 'a-zA-Z0-9.' | wc -c) -gt 1 ]]; then
+echo ${TEST[$X]} | tr -d 'a-zA-Z0-9' | wc -c
  echo "peer2anonet: fatal error: unacceptable data: ${TEST[$X]}
 "
  exit 1
@@ -60,7 +60,7 @@
 
 for((X=6;X<=9;X++)); do
 if [[ $(echo ${TEST[$X]} | tr -d '0-9' | wc -c) -gt 1 ]]; then
- echo "peer2anonet: fatal error: unacceptable data: ${TEST[$X]}
+ echo "peer2anonet: fatal error: unacceptable data:$X ${TEST[$X]}
 "
  exit 1
 fi
@@ -69,7 +69,7 @@
 if [[ $(echo ${TEST[10]} | tr -d 'a-zA-Z0-9' | wc -c) -gt 1 ]]; then
  echo "peer2anonet: fatal error: unacceptable data: ${TEST[11]}
 "
- exit 1
+exit 1
 fi
 
 #########################################################################
@@ -154,7 +154,7 @@
 export REMOTE_ADDRESS=$REMOTEIP
 export REMOTE_PORT=$PEERPORT
 export LOCAL_PORT=$YOURPORT
-export PRIVATE_KEY=${SECKEY/'SECRET: /}
+export PRIVATE_KEY=$SECKEY
 export PUBLIC_KEY=$PUBKEY
 export TUN_MODE=1
 export INTERFACE=ppp-$PEERNAME