... | ... |
@@ -695,6 +695,13 @@ function get_default_host_ip { |
695 | 695 |
echo $host_ip |
696 | 696 |
} |
697 | 697 |
|
698 |
+# Generates hex string from ``size`` byte of pseudo random data |
|
699 |
+# generate_hex_string size |
|
700 |
+function generate_hex_string { |
|
701 |
+ local size=$1 |
|
702 |
+ hexdump -n "$size" -v -e '/1 "%02x"' /dev/urandom |
|
703 |
+} |
|
704 |
+ |
|
698 | 705 |
# Grab a numbered field from python prettytable output |
699 | 706 |
# Fields are numbered starting with 1 |
700 | 707 |
# Reverse syntax is supported: -1 is the last field, -2 is second to last, etc. |
... | ... |
@@ -98,7 +98,7 @@ function configure_heat { |
98 | 98 |
iniset $HEAT_CONF DEFAULT heat_waitcondition_server_url http://$HEAT_API_CFN_HOST:$HEAT_API_CFN_PORT/v1/waitcondition |
99 | 99 |
iniset $HEAT_CONF DEFAULT heat_watch_server_url http://$HEAT_API_CW_HOST:$HEAT_API_CW_PORT |
100 | 100 |
iniset $HEAT_CONF database connection `database_connection_url heat` |
101 |
- iniset $HEAT_CONF DEFAULT auth_encryption_key `hexdump -n 16 -v -e '/1 "%02x"' /dev/urandom` |
|
101 |
+ iniset $HEAT_CONF DEFAULT auth_encryption_key $(generate_hex_string 16) |
|
102 | 102 |
|
103 | 103 |
iniset $HEAT_CONF DEFAULT region_name_for_services "$REGION_NAME" |
104 | 104 |
|
... | ... |
@@ -426,7 +426,7 @@ function read_password { |
426 | 426 |
echo "Invalid chars in password. Try again:" |
427 | 427 |
done |
428 | 428 |
if [ ! $pw ]; then |
429 |
- pw=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 20) |
|
429 |
+ pw=$(generate_hex_string 10) |
|
430 | 430 |
fi |
431 | 431 |
eval "$var=$pw" |
432 | 432 |
echo "$var=$pw" >> $localrc |
... | ... |
@@ -1211,11 +1211,7 @@ fi |
1211 | 1211 |
|
1212 | 1212 |
# Create a randomized default value for the keymgr's fixed_key |
1213 | 1213 |
if is_service_enabled nova; then |
1214 |
- FIXED_KEY="" |
|
1215 |
- for i in $(seq 1 64); do |
|
1216 |
- FIXED_KEY+=$(echo "obase=16; $(($RANDOM % 16))" | bc); |
|
1217 |
- done; |
|
1218 |
- iniset $NOVA_CONF keymgr fixed_key "$FIXED_KEY" |
|
1214 |
+ iniset $NOVA_CONF keymgr fixed_key $(generate_hex_string 32) |
|
1219 | 1215 |
fi |
1220 | 1216 |
|
1221 | 1217 |
if is_service_enabled zeromq; then |