From 26a28b4af5dde62b88ffedc9b8455aff0f6690e4 Mon Sep 17 00:00:00 2001
From: Ian Wienand <iwienand@redhat.com>
Date: Wed, 14 May 2014 14:10:47 +1000
Subject: [PATCH] Use urandom rather than openssl for password gen

I tried using devstack on a cloud image that didn't have openssl, so
it generated blank passwords and gave an error about openssl missing.
Using urandom should not require more than minimal shell tools.

Change-Id: Ib3091183eb1d85fc8cf7c76e47da24a04ae4791f
---
 stack.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stack.sh b/stack.sh
index 19d47d64ae..8fb57c4d13 100755
--- a/stack.sh
+++ b/stack.sh
@@ -410,7 +410,7 @@ function read_password {
             echo "Invalid chars in password.  Try again:"
         done
         if [ ! $pw ]; then
-            pw=`openssl rand -hex 10`
+            pw=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 20)
         fi
         eval "$var=$pw"
         echo "$var=$pw" >> $localrc