Skip to content

Commit

Permalink
Merge pull request #1907 from noobaa/eran_fixes_to_master
Browse files Browse the repository at this point in the history
generate server secret if doesn't exist
  • Loading branch information
tamireran authored Sep 2, 2016
2 parents 943e243 + 6817e8b commit e455df2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
7 changes: 1 addition & 6 deletions src/deploy/NVA_build/deploy_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@ function setup_linux_users {

#local current_ip=$(ifconfig eth0 | grep 'inet addr' | cut -f 2 -d':' | cut -f 1 -d' ')

if [ ! -f ${NOOBAASEC} ]; then
uuidgen | cut -f 1 -d'-' > ${NOOBAASEC}
fi
local secret=$(cat ${NOOBAASEC})

#Fix login message
echo -e "\x1b[0;35;40m" > /etc/issue
echo ' _ _ ______ ' >> /etc/issue
Expand All @@ -121,7 +116,7 @@ function setup_linux_users {

echo -e "\nConfigured IP on this NooBaa Server \x1b[0;32;40mNONE\x1b[0m." >> /etc/issue

echo -e "\nThis server's secret is \x1b[0;32;40m${secret}\x1b[0m" >> /etc/issue
echo -e "\nNo Server Secret" >> /etc/issue

echo -e "\nYou can set up a cluster member, configure IP, DNS, GW and Hostname by logging in using \x1b[0;32;40mnoobaa/Passw0rd\x1b[0m" >> /etc/issue

Expand Down
12 changes: 8 additions & 4 deletions src/deploy/NVA_build/first_install_diaglog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ trap "" 2 20
. /root/node_modules/noobaa-core/src/deploy/NVA_build/deploy_base.sh

FIRST_INSTALL_MARK="/etc/first_install.mrk"
NOOBAASEC="/etc/noobaa_sec"

function clean_ifcfg() {
sudo sed -i 's:.*IPADDR=.*::' /etc/sysconfig/network-scripts/ifcfg-eth0
Expand Down Expand Up @@ -170,10 +171,6 @@ function configure_ntp_dialog {
}

function run_wizard {
if [ ! -f ${NOOBAASEC} ]; then
local sec=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -1)
echo ${sec} > ${NOOBAASEC}
fi

dialog --colors --backtitle "NooBaa First Install" --title 'Welcome to \Z5\ZbNooBaa\Zn' --msgbox 'Welcome to your \Z5\ZbNooBaa\Zn experience.\n\nThis
is a short first install wizard to help configure \Z5\ZbNooBaa\Zn to best suit your needs' 8 50
Expand All @@ -198,6 +195,13 @@ function end_wizard {
dialog --colors --nocancel --backtitle "NooBaa First Install" --title '\Z5\ZbNooBaa\Zn is Ready' --msgbox "\n\Z5\ZbNooBaa\Zn was configured and is ready to use. You can access \Z5\Zbhttp://${current_ip}:8080\Zn to start using your system." 7 65
date | sudo tee -a ${FIRST_INSTALL_MARK}
clear
if [ ! -f ${NOOBAASEC} ]; then
local sec=$(uuidgen | sudo cut -f 1 -d'-')
echo ${sec} |sudo tee -a ${NOOBAASEC}
#dev/null to avoid output with user name
echo ${sec} |sudo passwd noobaaroot --stdin >/dev/null
sudo sed -i "s:No Server Secret.*:This server's secret is \x1b[0;32;40m${sec}\x1b[0m:" /etc/issue
fi

sudo sed -i "s:Configured IP on this NooBaa Server.*:Configured IP on this NooBaa Server \x1b[0;32;40m${current_ip}\x1b[0m:" /etc/issue

Expand Down

0 comments on commit e455df2

Please sign in to comment.