mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
Install setup required packages later so that also uses the proxy
This commit is contained in:
@@ -997,36 +997,43 @@ detect_os() {
|
||||
|
||||
}
|
||||
|
||||
installer_progress_loop() {
|
||||
local i=0
|
||||
while true; do
|
||||
((i++))
|
||||
set_progress_str "$i" 'Checking that all required packages are installed and enabled...'
|
||||
[[ $i -gt 0 ]] && sleep 5s
|
||||
done
|
||||
}
|
||||
|
||||
installer_prereq_packages() {
|
||||
|
||||
if [ "$OS" == centos ]; then
|
||||
# Print message to stdout so the user knows setup is doing something
|
||||
echo "Installing required packages to run installer..."
|
||||
# Install bind-utils so the host command exists
|
||||
if [[ ! $is_iso ]]; then
|
||||
if ! command -v host > /dev/null 2>&1; then
|
||||
yum -y install bind-utils >> "$setup_log" 2>&1
|
||||
yum -y install bind-utils >> "$setup_log" 2>&1
|
||||
fi
|
||||
if ! command -v nmcli > /dev/null 2>&1; then
|
||||
{
|
||||
yum -y install NetworkManager;
|
||||
systemctl enable NetworkManager;
|
||||
systemctl start NetworkManager;
|
||||
yum -y install NetworkManager
|
||||
systemctl enable NetworkManager
|
||||
systemctl start NetworkManager
|
||||
} >> "$setup_log" 2<&1
|
||||
fi
|
||||
if ! command -v bc > /dev/null 2>&1; then
|
||||
yum -y install bc >> "$setup_log" 2>&1
|
||||
yum -y install bc >> "$setup_log" 2>&1
|
||||
fi
|
||||
if ! yum versionlock > /dev/null 2>&1; then
|
||||
yum -y install yum-plugin-versionlock >> "$setup_log" 2>&1
|
||||
yum -y install yum-plugin-versionlock >> "$setup_log" 2>&1
|
||||
fi
|
||||
else
|
||||
else
|
||||
logCmd "systemctl enable NetworkManager"
|
||||
logCmd "systemctl start NetworkManager"
|
||||
fi
|
||||
fi
|
||||
elif [ "$OS" == ubuntu ]; then
|
||||
# Print message to stdout so the user knows setup is doing something
|
||||
echo "Installing required packages to run installer..."
|
||||
retry 50 10 "apt-get update" >> "$setup_log" 2>&1 || exit 1
|
||||
# Install network manager so we can do interface stuff
|
||||
if ! command -v nmcli > /dev/null 2>&1; then
|
||||
|
||||
@@ -94,16 +94,27 @@ if ! [ -f $install_opt_file ]; then
|
||||
fi
|
||||
|
||||
automated=no
|
||||
function progress() {
|
||||
local title='Security Onion Install'
|
||||
progress() {
|
||||
local title='Security Onion Setup'
|
||||
local msg=${1:-'Please wait while installing...'}
|
||||
|
||||
if [ $automated == no ]; then
|
||||
whiptail --title "$title" --gauge 'Please wait while installing...' 6 60 0 # append to text
|
||||
whiptail --title "$title" --gauge "$msg" 6 70 0 # append to text
|
||||
else
|
||||
cat >> $setup_log 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
# Set up handler for setup to exit early (use `kill -SIGUSR1 "$setup_proc"; exit 1` in child scripts)
|
||||
trap 'catch $LINENO' SIGUSR1
|
||||
setup_proc="$$"
|
||||
catch() {
|
||||
info "Fatal error occurred at $1 in so-setup, failing setup."
|
||||
grep --color=never "ERROR" "$setup_log" > "$error_log"
|
||||
whiptail_setup_failed
|
||||
exit 1
|
||||
}
|
||||
|
||||
detect_os
|
||||
|
||||
if [[ -f automation/$automation && $(basename $automation) == $automation ]]; then
|
||||
@@ -198,17 +209,14 @@ if ! [[ -f $install_opt_file ]]; then
|
||||
printf '%s\n' \
|
||||
"MNIC=$MNIC" \
|
||||
"HOSTNAME=$HOSTNAME" > "$net_init_file"
|
||||
if [[ $is_manager ]]; then
|
||||
collect_proxy
|
||||
[[ -n "$so_proxy" ]] && set_proxy >> $setup_log 2>&1
|
||||
fi
|
||||
collect_proxy
|
||||
[[ -n "$so_proxy" ]] && set_proxy >> $setup_log 2>&1
|
||||
whiptail_net_setup_complete
|
||||
else
|
||||
whiptail_install_type
|
||||
true
|
||||
fi
|
||||
else
|
||||
whiptail_install_type
|
||||
fi
|
||||
fi
|
||||
whiptail_install_type
|
||||
else
|
||||
source $install_opt_file
|
||||
fi
|
||||
@@ -261,6 +269,24 @@ if [[ ( $is_manager || $is_import ) && $is_iso ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $is_airgap != true ]]; then
|
||||
collect_proxy
|
||||
fi
|
||||
{
|
||||
installer_progress_loop & # Run progress bar to 100 in ~8 minutes
|
||||
progress_bg_proc=$!
|
||||
installer_prereq_packages
|
||||
install_success=$?
|
||||
kill -9 $progress_bg_proc
|
||||
if [[ $install_success -gt 0 ]]; then
|
||||
error "Could not install packages required for setup, exiting now."
|
||||
kill -SIGUSR1 "$setup_proc"; exit 1
|
||||
fi
|
||||
set_progress_str 99 "Detecting whether setup is running in the cloud."
|
||||
detect_cloud
|
||||
} | progress '...'
|
||||
|
||||
|
||||
if ! [[ -f $install_opt_file ]]; then
|
||||
if [[ $is_manager && $is_sensor ]]; then
|
||||
check_requirements "standalone"
|
||||
@@ -535,16 +561,6 @@ whiptail_make_changes
|
||||
# From here on changes will be made.
|
||||
echo "1" > /root/accept_changes
|
||||
|
||||
# Set up handler for setup to exit early (use `kill -SIGUSR1 "$(ps --pid $$ -oppid=)"; exit 1` in child scripts)
|
||||
trap 'catch $LINENO' SIGUSR1
|
||||
|
||||
catch() {
|
||||
info "Fatal error occurred at $1 in so-setup, failing setup."
|
||||
grep --color=never "ERROR" "$setup_log" > "$error_log"
|
||||
whiptail_setup_failed
|
||||
exit
|
||||
}
|
||||
|
||||
# This block sets REDIRECTIT which is used by a function outside the below subshell
|
||||
set_main_ip >> $setup_log 2>&1
|
||||
compare_main_nic_ip
|
||||
|
||||
Reference in New Issue
Block a user