Check that random number generator is initialised before creating random passwords

This commit is contained in:
Bob Mottram 2014-12-25 10:46:49 +00:00
parent c738c1d87e
commit f652d20e55
1 changed files with 43 additions and 0 deletions

View File

@ -3207,6 +3207,7 @@ function random_number_generator {
else
apt-get -y --force-yes install haveged
fi
echo 'random_number_generator' >> $COMPLETION_FILE
}
@ -4823,6 +4824,11 @@ function install_mariadb {
if grep -Fxq "install_mariadb" $COMPLETION_FILE; then
return
fi
if ! grep -Fxq "random_number_generator" $COMPLETION_FILE; then
echo 'install_mariadb was called before the random number generator was initialised'
exit 853
fi
apt-get -y --force-yes install python-software-properties debconf-utils
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
add-apt-repository 'deb http://mariadb.biz.net.id//repo/10.1/debian sid main'
@ -4987,6 +4993,10 @@ function install_owncloud {
if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_TOR_DONGLE" || $SYSTEM_TYPE == "$VARIANT_TOR_WIFI" ]]; then
return
fi
if ! grep -Fxq "random_number_generator" $COMPLETION_FILE; then
echo 'install_owncloud was called before the random number generator was initialised'
exit 853
fi
OWNCLOUD_COMPLETION_MSG1=" *** Freedombone $SYSTEM_TYPE is now installed ***"
OWNCLOUD_COMPLETION_MSG2="Open $OWNCLOUD_DOMAIN_NAME in a web browser to complete the setup"
if grep -Fxq "install_owncloud" $COMPLETION_FILE; then
@ -5236,6 +5246,10 @@ function install_xmpp {
if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_TOR_DONGLE" || $SYSTEM_TYPE == "$VARIANT_TOR_WIFI" ]]; then
return
fi
if ! grep -Fxq "random_number_generator" $COMPLETION_FILE; then
echo 'install_xmpp was called before the random number generator was initialised'
exit 853
fi
if grep -Fxq "install_xmpp" $COMPLETION_FILE; then
return
fi
@ -5334,6 +5348,10 @@ function install_irc_server {
if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_TOR_DONGLE" || $SYSTEM_TYPE == "$VARIANT_TOR_WIFI" ]]; then
return
fi
if ! grep -Fxq "random_number_generator" $COMPLETION_FILE; then
echo 'install_irc_server was called before the random number generator was initialised'
exit 853
fi
if grep -Fxq "install_irc_server" $COMPLETION_FILE; then
return
fi
@ -5414,6 +5432,10 @@ function install_wiki {
if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_TOR_DONGLE" || $SYSTEM_TYPE == "$VARIANT_TOR_WIFI" ]]; then
return
fi
if ! grep -Fxq "random_number_generator" $COMPLETION_FILE; then
echo 'install_wiki was called before the random number generator was initialised'
exit 853
fi
if grep -Fxq "install_wiki" $COMPLETION_FILE; then
return
fi
@ -5702,6 +5724,10 @@ function install_blog {
if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_TOR_DONGLE" || $SYSTEM_TYPE == "$VARIANT_TOR_WIFI" ]]; then
return
fi
if ! grep -Fxq "random_number_generator" $COMPLETION_FILE; then
echo 'install_blog was called before the random number generator was initialised'
exit 853
fi
if grep -Fxq "install_blog" $COMPLETION_FILE; then
return
fi
@ -5950,6 +5976,10 @@ function install_gnu_social {
if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_TOR_DONGLE" || $SYSTEM_TYPE == "$VARIANT_TOR_WIFI" ]]; then
return
fi
if ! grep -Fxq "random_number_generator" $COMPLETION_FILE; then
echo 'install_gnu_social was called before the random number generator was initialised'
exit 853
fi
if [ ! $MICROBLOG_DOMAIN_NAME ]; then
return
fi
@ -6199,6 +6229,10 @@ function install_redmatrix {
if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_TOR_DONGLE" || $SYSTEM_TYPE == "$VARIANT_TOR_WIFI" ]]; then
return
fi
if ! grep -Fxq "random_number_generator" $COMPLETION_FILE; then
echo 'install_redmatrix was called before the random number generator was initialised'
exit 853
fi
# if this is exclusively a social setup
if [[ $SYSTEM_TYPE == "$VARIANT_SOCIAL" ]]; then
REDMATRIX_DOMAIN_NAME=$DOMAIN_NAME
@ -7090,6 +7124,10 @@ function enable_wifi_hotspot {
if [[ $ENABLE_WIFI_HOTSPOT != "yes" ]]; then
return
fi
if ! grep -Fxq "random_number_generator" $COMPLETION_FILE; then
echo 'enable_wifi_hotspot was called before the random number generator was initialised'
exit 853
fi
apt-get -y install hostapd dnsmasq
get_wifi_essid
@ -7177,6 +7215,11 @@ function enable_wifi {
if [[ $ENABLE_WIFI != "yes" || $ENABLE_WIFI_HOTSPOT != "yes" ]]; then
return
fi
if ! grep -Fxq "random_number_generator" $COMPLETION_FILE; then
echo 'enable_wifi was called before the random number generator was initialised'
exit 853
fi
sed -i 's/#auto wlan0/auto wlan0/g' /etc/network/interfaces
sed -i 's/#iface wlan0 inet dhcp/iface wlan0 inet dhcp/g' /etc/network/interfaces
sed -i 's/# wpa-ssid "essid"/ wpa-ssid "essid"/g' /etc/network/interfaces