Validate email and password for the webuser during install

This commit is contained in:
Jason Ertel
2020-04-03 12:04:42 -04:00
parent 69c90fcdc1
commit 99e8226ae5
3 changed files with 45 additions and 21 deletions

View File

@@ -745,7 +745,8 @@ get_main_ip() {
get_redirect() { get_redirect() {
whiptail_set_redirect_info whiptail_set_redirect_info
whiptail_set_redirect whiptail_set_redirect
if [ $REDIRECTINFO == 'OTHER' ]; then echo "REDIRECTINFO=$REDIRECTINFO"
if [ "$REDIRECTINFO" == "OTHER" ]; then
whiptail_set_redirect_host whiptail_set_redirect_host
fi fi
} }

View File

@@ -29,6 +29,9 @@ else
INSTALLMETHOD="network" INSTALLMETHOD="network"
fi fi
# Allow execution of SO tools during setup
export PATH=$PATH:../salt/common/tools/sbin
# Global Variables # Global Variables
HOSTNAME=$(cat /etc/hostname) HOSTNAME=$(cat /etc/hostname)
TOTAL_MEM=`grep MemTotal /proc/meminfo | awk '{print $2}' | sed -r 's/.{3}$//'` TOTAL_MEM=`grep MemTotal /proc/meminfo | awk '{print $2}' | sed -r 's/.{3}$//'`
@@ -141,7 +144,7 @@ if (whiptail_you_sure) ; then
if [ $INSTALLTYPE == 'HELIXSENSOR' ]; then if [ $INSTALLTYPE == 'HELIXSENSOR' ]; then
MASTERUPDATES=OPEN MASTERUPDATES=OPEN
filter_unused_nics filter_unused_nics
whiptail_bond_nics [[ $SKIP_BOND == no ]] && whiptail_bond_nics
whiptail_helix_apikey whiptail_helix_apikey
whiptail_homenet_master whiptail_homenet_master
RULESETUP=ETOPEN RULESETUP=ETOPEN
@@ -244,6 +247,32 @@ if (whiptail_you_sure) ; then
fi fi
function collect_webuser_inputs() {
# Get a password for the web admin user
VALIDUSER=no
while [ $VALIDUSER != yes ]; do
whiptail_create_web_user
so-user valemail "$WEBUSER"
if [ $? == 0 ]; then
VALIDUSER=yes
else
whiptail_invalid_user_warning
fi
done
WPMATCH=no
while [ $WPMATCH != yes ]; do
whiptail_create_web_user_password1
echo "$WEBPASSWD1" | so-user valpass
if [ $? == 0 ]; then
whiptail_create_web_user_password2
check_web_pass
else
whiptail_invalid_pass_warning
fi
done
}
#################### ####################
## Master ## ## Master ##
#################### ####################
@@ -292,14 +321,7 @@ if (whiptail_you_sure) ; then
check_soremote_pass check_soremote_pass
done done
# Get a password for the web admin user collect_webuser_inputs
whiptail_create_web_user
WPMATCH=no
while [ $WPMATCH != yes ]; do
whiptail_create_web_user_password1
whiptail_create_web_user_password2
check_web_pass
done
get_redirect get_redirect
# Last Chance to back out # Last Chance to back out
whiptail_make_changes whiptail_make_changes
@@ -446,7 +468,7 @@ if (whiptail_you_sure) ; then
if [ $INSTALLTYPE == 'SENSOR' ]; then if [ $INSTALLTYPE == 'SENSOR' ]; then
filter_unused_nics filter_unused_nics
whiptail_bond_nics [[ $SKIP_BOND == no ]] && whiptail_bond_nics
whiptail_management_server whiptail_management_server
whiptail_master_updates whiptail_master_updates
set_updates set_updates
@@ -537,7 +559,7 @@ if (whiptail_you_sure) ; then
if [ $INSTALLTYPE == 'EVAL' ]; then if [ $INSTALLTYPE == 'EVAL' ]; then
TYPE='eval' TYPE='eval'
# Select which NICs are in the bond # Select which NICs are in the bond
whiptail_bond_nics [[ $SKIP_BOND == no ]] && whiptail_bond_nics
elif [ $INSTALLTYPE == 'MASTERSEARCH' ]; then elif [ $INSTALLTYPE == 'MASTERSEARCH' ]; then
TYPE='mastersearch' TYPE='mastersearch'
fi fi
@@ -575,14 +597,7 @@ if (whiptail_you_sure) ; then
check_soremote_pass check_soremote_pass
done done
fi fi
# Get a password for the web admin user collect_webuser_inputs
whiptail_create_web_user
WPMATCH=no
while [ $WPMATCH != yes ]; do
whiptail_create_web_user_password1
whiptail_create_web_user_password2
check_web_pass
done
get_redirect get_redirect
whiptail_make_changes whiptail_make_changes
set_hostname set_hostname
@@ -834,7 +849,7 @@ if (whiptail_you_sure) ; then
if [ $INSTALLTYPE == 'HEAVYNODE' ]; then if [ $INSTALLTYPE == 'HEAVYNODE' ]; then
filter_unused_nics filter_unused_nics
whiptail_bond_nics [[ $SKIP_BOND == no ]] && whiptail_bond_nics
whiptail_management_server whiptail_management_server
whiptail_master_updates whiptail_master_updates
set_updates set_updates

View File

@@ -163,8 +163,13 @@ whiptail_create_web_user() {
WEBUSER=$(whiptail --title "Security Onion Install" --inputbox \ WEBUSER=$(whiptail --title "Security Onion Install" --inputbox \
"Please enter an email address to create an administrator account for the web interface." 10 60 3>&1 1>&2 2>&3) "Please enter an email address to create an administrator account for the web interface." 10 60 3>&1 1>&2 2>&3)
local exitstatus=$?
whiptail_check_exitstatus $exitstatus
} }
whiptail_invalid_user_warning() {
whiptail --title "Security Onion Setup" --msgbox "Please enter a valid email address." 8 75
}
whiptail_create_web_user_password1() { whiptail_create_web_user_password1() {
@@ -185,6 +190,9 @@ whiptail_create_web_user_password2() {
} }
whiptail_invalid_pass_warning() {
whiptail --title "Security Onion Setup" --msgbox "Please choose a more secure password." 8 75
}
whiptail_cur_close_days() { whiptail_cur_close_days() {