]> git.scottworley.com Git - overonion/commitdiff
--make_INSECURE_key to allow fast tests
authorScott Worley <scottworley@scottworley.com>
Sun, 22 Oct 2017 00:19:31 +0000 (17:19 -0700)
committerScott Worley <scottworley@scottworley.com>
Sun, 22 Oct 2017 00:19:31 +0000 (17:19 -0700)
overonion-make-key

index b909d97ff5d24ea6f5c555329f2a8601742df9ef..6cfc349bec66f01ae84766f39878717d77a223f3 100755 (executable)
@@ -17,6 +17,12 @@ ciphers=(
 
 umask 077
 
+random_source="/dev/random"
+if [[ "$1" == '--make_INSECURE_key' ]];then
+  shift
+  random_source="/dev/urandom"
+fi
+
 if (( $# != 1));then
   echo "usage: overonion-make-key keyfile"
   exit 1
@@ -30,6 +36,6 @@ fi
 i=0
 while read -r cipher;do
   echo -n $'\r'"Generating key $((++i))/${#ciphers[*]}"
-  cat >> "$keyfile" <<< "$cipher $(head -c 99 /dev/random | base64 --wrap=0 )"
+  cat >> "$keyfile" <<< "$cipher $(head -c 99 "$random_source" | base64 --wrap=0 )"
 done < <( IFS=$'\n'; shuf <<< "${ciphers[*]}"; )
 echo