]> Cypherpunks.ru repositories - govpn.git/blobdiff - utils/newclient.sh
Use /dev/urandom for new client identity generation
[govpn.git] / utils / newclient.sh
index 620aac71538a6240294a4c7adc24f2577c5994c6..e741130957a6f30d6c8956988bcd3c3b58e2f940 100755 (executable)
@@ -3,14 +3,14 @@
 getrand()
 {
     local size=$1
-    dd if=/dev/random bs=$size count=1 2>/dev/null | hexdump -ve '"%02x"'
+    dd if=/dev/urandom bs=$size count=1 2>/dev/null | hexdump -ve '"%02x"'
 }
 
 [ -n "$1" ] || {
     cat <<EOF
 Example script for creating new user peer for GoVPN.
-It just creates directory with random peer ID and random key in it,
-and adds empty file with human readable username.
+It just creates directory with random peer ID, dummy verifier,
+dummy up.sh executable script and saves username in it.
 
 Usage: $0 <username>
 EOF
@@ -21,6 +21,8 @@ username=$1
 peerid=$(getrand 16)
 umask 077
 mkdir -p peers/$peerid
-getrand 32 > peers/$peerid/key
-touch peers/$peerid/$1
-echo peers/$peerid/$1
+echo '0000000000000000000000000000000000000000000000000000000000000000' > peers/$peerid/verifier
+echo $username > peers/$peerid/name
+echo '#!/bin/sh' > peers/$peerid/up.sh
+chmod 700 peers/$peerid/up.sh
+echo Place verifier to peers/$peerid/verifier