mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-18 23:13:20 +01:00
Merge pull request #2527 from Security-Onion-Solutions/feature/setup
Feature/setup
This commit is contained in:
@@ -1377,6 +1377,38 @@ minio_generate_keys() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
network_init() {
|
||||||
|
disable_ipv6
|
||||||
|
set_hostname
|
||||||
|
if [[ "$setup_type" == 'iso' ]]; then
|
||||||
|
set_management_interface
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
network_init_whiptail() {
|
||||||
|
case "$setup_type" in
|
||||||
|
'iso')
|
||||||
|
whiptail_set_hostname
|
||||||
|
whiptail_management_nic
|
||||||
|
whiptail_dhcp_or_static
|
||||||
|
|
||||||
|
if [ "$address_type" != 'DHCP' ]; then
|
||||||
|
whiptail_management_interface_ip
|
||||||
|
whiptail_management_interface_mask
|
||||||
|
whiptail_management_interface_gateway
|
||||||
|
whiptail_management_interface_dns
|
||||||
|
whiptail_management_interface_dns_search
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
'network')
|
||||||
|
whiptail_network_notice
|
||||||
|
whiptail_dhcp_warn
|
||||||
|
whiptail_set_hostname
|
||||||
|
whiptail_management_nic
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
network_setup() {
|
network_setup() {
|
||||||
{
|
{
|
||||||
echo "Finishing up network setup";
|
echo "Finishing up network setup";
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ if [ "$uid" -ne 0 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Save the original argument array since we modify it
|
# Save the original argument array since we modify it
|
||||||
readarray -t original_args <<< "$@"
|
original_args=("$@")
|
||||||
|
|
||||||
cd "$(dirname "$0")" || exit 255
|
cd "$(dirname "$0")" || exit 255
|
||||||
|
|
||||||
@@ -67,7 +67,11 @@ while [[ $# -gt 0 ]]; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if ! [ -f /root/install_opt ] && [ -d /root/manager_setup/securityonion ] && [[ $(pwd) != /root/manager_setup/securityonion/setup ]]; then
|
if [[ "$setup_type" == 'iso' ]]; then
|
||||||
|
is_iso=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ -f $install_opt_file ] && [ -d /root/manager_setup/securityonion ] && [[ $(pwd) != /root/manager_setup/securityonion/setup ]]; then
|
||||||
exec bash /root/manager_setup/securityonion/setup/so-setup "${original_args[@]}"
|
exec bash /root/manager_setup/securityonion/setup/so-setup "${original_args[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -81,7 +85,7 @@ fi
|
|||||||
|
|
||||||
parse_install_username
|
parse_install_username
|
||||||
|
|
||||||
if ! [ -f /root/install_opt ]; then
|
if ! [ -f $install_opt_file ]; then
|
||||||
# Begin Installation pre-processing
|
# Begin Installation pre-processing
|
||||||
title "Initializing Setup"
|
title "Initializing Setup"
|
||||||
info "Installing as the $INSTALLUSERNAME user"
|
info "Installing as the $INSTALLUSERNAME user"
|
||||||
@@ -164,17 +168,33 @@ if [ "$automated" == no ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -f /root/install_opt ]; then
|
if ! [[ -f $install_opt_file ]]; then
|
||||||
if (whiptail_you_sure); then
|
if (whiptail_you_sure); then
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
echo "User cancelled setup." | tee -a "$setup_log"
|
echo "User cancelled setup." | tee -a "$setup_log"
|
||||||
whiptail_cancel
|
whiptail_cancel
|
||||||
fi
|
fi
|
||||||
|
if [[ $setup_type == 'iso' ]]; then
|
||||||
whiptail_install_type
|
whiptail_first_menu_iso
|
||||||
|
if [[ $option == "Configure Network" ]] && ! [[ -f $net_init_file ]]; then
|
||||||
|
network_init_whiptail
|
||||||
|
whiptail_management_interface_setup
|
||||||
|
network_init
|
||||||
|
printf '%s\n' \
|
||||||
|
"MNIC=$MNIC" \
|
||||||
|
"HOSTNAME=$HOSTNAME" > "$net_init_file"
|
||||||
|
whiptail --title "Security Onion Setup" \
|
||||||
|
--msgbox "Successfully set up networking, setup will now exit." 7 75
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
whiptail_install_type
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
whiptail_install_type
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
source /root/install_opt
|
source $install_opt_file
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$install_type" = 'EVAL' ]; then
|
if [ "$install_type" = 'EVAL' ]; then
|
||||||
@@ -217,11 +237,6 @@ elif [ "$install_type" = 'ANALYST' ]; then
|
|||||||
is_analyst=true
|
is_analyst=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Say yes to the dress if its an ISO install
|
|
||||||
if [[ "$setup_type" == 'iso' ]]; then
|
|
||||||
is_iso=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if this is an airgap install
|
# Check if this is an airgap install
|
||||||
if [[ ( $is_manager || $is_import ) && $is_iso ]]; then
|
if [[ ( $is_manager || $is_import ) && $is_iso ]]; then
|
||||||
whiptail_airgap
|
whiptail_airgap
|
||||||
@@ -230,7 +245,7 @@ if [[ ( $is_manager || $is_import ) && $is_iso ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -f /root/install_opt ]; then
|
if ! [[ -f $install_opt_file ]]; then
|
||||||
if [[ $is_manager && $is_sensor ]]; then
|
if [[ $is_manager && $is_sensor ]]; then
|
||||||
check_requirements "standalone"
|
check_requirements "standalone"
|
||||||
elif [[ $is_fleet_standalone ]]; then
|
elif [[ $is_fleet_standalone ]]; then
|
||||||
@@ -243,43 +258,26 @@ if ! [ -f /root/install_opt ]; then
|
|||||||
check_requirements "import"
|
check_requirements "import"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$setup_type" in
|
[[ -f $net_init_file ]] && whiptail_net_reinit && reinit_networking=true
|
||||||
'iso')
|
|
||||||
whiptail_set_hostname
|
|
||||||
whiptail_management_nic
|
|
||||||
whiptail_dhcp_or_static
|
|
||||||
|
|
||||||
if [ "$address_type" != 'DHCP' ]; then
|
if [[ $reinit_networking ]] || ! [[ -f $net_init_file ]]; then
|
||||||
whiptail_management_interface_ip
|
network_init_whiptail
|
||||||
whiptail_management_interface_mask
|
else
|
||||||
whiptail_management_interface_gateway
|
source "$net_init_file"
|
||||||
whiptail_management_interface_dns
|
fi
|
||||||
whiptail_management_interface_dns_search
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
'network')
|
|
||||||
whiptail_network_notice
|
|
||||||
whiptail_dhcp_warn
|
|
||||||
whiptail_set_hostname
|
|
||||||
whiptail_management_nic
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [[ $is_minion ]]; then
|
if [[ $is_minion ]]; then
|
||||||
whiptail_management_server
|
whiptail_management_server
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $is_minion || $is_iso ]]; then
|
if [[ $is_minion ]] || [[ $reinit_networking ]] || ! [[ -f $net_init_file ]]; then
|
||||||
whiptail_management_interface_setup
|
whiptail_management_interface_setup
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Init networking so rest of install works
|
if [[ $reinit_networking ]] || ! [[ -f $net_init_file ]]; then
|
||||||
disable_ipv6
|
network_init
|
||||||
set_hostname
|
|
||||||
if [[ "$setup_type" == 'iso' ]]; then
|
|
||||||
set_management_interface
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$TURBO" ]]; then
|
if [[ -n "$TURBO" ]]; then
|
||||||
use_turbo_proxy
|
use_turbo_proxy
|
||||||
fi
|
fi
|
||||||
@@ -298,8 +296,8 @@ if ! [ -f /root/install_opt ]; then
|
|||||||
"install_type=$install_type" \
|
"install_type=$install_type" \
|
||||||
"MNIC=$MNIC" \
|
"MNIC=$MNIC" \
|
||||||
"HOSTNAME=$HOSTNAME" \
|
"HOSTNAME=$HOSTNAME" \
|
||||||
"MSRV=$MSRV"\
|
"MSRV=$MSRV" \
|
||||||
"MSRVIP=$MSRVIP" > /root/install_opt
|
"MSRVIP=$MSRVIP" > "$install_opt_file"
|
||||||
download_repo_tarball
|
download_repo_tarball
|
||||||
exec bash /root/manager_setup/securityonion/setup/so-setup "${original_args[@]}"
|
exec bash /root/manager_setup/securityonion/setup/so-setup "${original_args[@]}"
|
||||||
fi
|
fi
|
||||||
@@ -396,7 +394,10 @@ if [[ $is_manager && ! $is_eval ]]; then
|
|||||||
whiptail_manager_adv_escluster
|
whiptail_manager_adv_escluster
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
whiptail_zeek_version
|
whiptail_metadata_tool
|
||||||
|
if [ "$MANAGERADV" = 'ADVANCED' ] && [ "$ZEEKVERSION" != 'SURICATA' ]; then
|
||||||
|
whiptail_manager_adv_service_zeeklogs
|
||||||
|
fi
|
||||||
# Don't run this function for now since Snort is not yet supported
|
# Don't run this function for now since Snort is not yet supported
|
||||||
# whiptail_nids
|
# whiptail_nids
|
||||||
NIDS=Suricata
|
NIDS=Suricata
|
||||||
@@ -406,9 +407,6 @@ if [[ $is_manager && ! $is_eval ]]; then
|
|||||||
whiptail_oinkcode
|
whiptail_oinkcode
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$MANAGERADV" = 'ADVANCED' ] && [ "$ZEEKVERSION" != 'SURICATA' ]; then
|
|
||||||
whiptail_manager_adv_service_zeeklogs
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $is_manager ]]; then
|
if [[ $is_manager ]]; then
|
||||||
|
|||||||
@@ -66,3 +66,9 @@ mkdir -p "$local_salt_dir"
|
|||||||
|
|
||||||
SCRIPTDIR=$(pwd)
|
SCRIPTDIR=$(pwd)
|
||||||
export SCRIPTDIR
|
export SCRIPTDIR
|
||||||
|
|
||||||
|
install_opt_file=/root/install_opt
|
||||||
|
export install_opt_file
|
||||||
|
|
||||||
|
net_init_file=/root/net_init
|
||||||
|
export net_init_file
|
||||||
|
|||||||
@@ -658,6 +658,17 @@ whiptail_log_size_limit() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
whiptail_first_menu_iso() {
|
||||||
|
[ -n "$TESTING" ] && return
|
||||||
|
|
||||||
|
option=$(whiptail --title "Security Onion Setup" --menu "Select an option" 10 75 2 \
|
||||||
|
"Configure Network" "Configure networking only " \
|
||||||
|
"Security Onion Installer" "Run the standard Security Onion installation " \
|
||||||
|
3>&1 1>&2 2>&3
|
||||||
|
)
|
||||||
|
local exitstatus=$?
|
||||||
|
whiptail_check_exitstatus $exitstatus
|
||||||
|
}
|
||||||
whiptail_make_changes() {
|
whiptail_make_changes() {
|
||||||
|
|
||||||
[ -n "$TESTING" ] && return
|
[ -n "$TESTING" ] && return
|
||||||
@@ -760,7 +771,11 @@ whiptail_management_interface_setup() {
|
|||||||
|
|
||||||
if [[ $is_iso ]]; then
|
if [[ $is_iso ]]; then
|
||||||
if [[ $minion_msg != "" ]]; then
|
if [[ $minion_msg != "" ]]; then
|
||||||
msg="initialize networking and $minion_msg"
|
if [[ -f $net_init_file ]]; then
|
||||||
|
msg=$minion_msg
|
||||||
|
else
|
||||||
|
msg="initialize networking and $minion_msg"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
msg="initialize networking"
|
msg="initialize networking"
|
||||||
fi
|
fi
|
||||||
@@ -967,6 +982,12 @@ whiptail_network_notice() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
whiptail_net_reinit() {
|
||||||
|
[ -n "$TESTING" ] && return
|
||||||
|
|
||||||
|
whiptail --title "Security Onion Setup" --yesno "The management interface has already been configured. Do you want to reconfigure it?" 8 75
|
||||||
|
}
|
||||||
|
|
||||||
whiptail_node_advanced() {
|
whiptail_node_advanced() {
|
||||||
|
|
||||||
[ -n "$TESTING" ] && return
|
[ -n "$TESTING" ] && return
|
||||||
|
|||||||
Reference in New Issue
Block a user