mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
Merge pull request #2343 from Security-Onion-Solutions/experimental
Experimental
This commit is contained in:
@@ -557,6 +557,19 @@ check_requirements() {
|
||||
fi
|
||||
}
|
||||
|
||||
compare_versions() {
|
||||
manager_ver=$(ssh -i /root/.ssh/so.key soremote@"$MSRV" cat /etc/soversion)
|
||||
|
||||
if [[ $manager_ver == "" ]]; then
|
||||
rm /root/install_opt
|
||||
echo "Could not determine version of Security Onion running on manager $MSRV. Please check your network settings and run setup again." | tee -a "$setup_log"
|
||||
kill -SIGUSR1 "$(ps --pid $$ -oppid=)"; exit 1
|
||||
fi
|
||||
|
||||
[[ "$manager_ver" == "$SOVERSION" ]]
|
||||
return
|
||||
}
|
||||
|
||||
configure_network_sensor() {
|
||||
echo "Setting up sensor interface" >> "$setup_log" 2>&1
|
||||
local nic_error=0
|
||||
@@ -692,7 +705,7 @@ copy_ssh_key() {
|
||||
chown -R "$SUDO_USER":"$SUDO_USER" /root/.ssh
|
||||
|
||||
echo "Removing old entry for manager from known_hosts if it exists"
|
||||
sed -i "/${MSRV}/d" /root/.ssh/known_hosts
|
||||
grep -q "$MSRV" /root/.ssh/known_hosts && sed -i "/${MSRV}/d" /root/.ssh/known_hosts
|
||||
|
||||
echo "Copying the SSH key to the manager"
|
||||
#Copy the key over to the manager
|
||||
@@ -952,6 +965,28 @@ docker_seed_registry() {
|
||||
|
||||
}
|
||||
|
||||
download_repo_tarball() {
|
||||
mkdir -p /root/manager_setup/securityonion
|
||||
{
|
||||
local manager_ver
|
||||
manager_ver=$(ssh -i /root/.ssh/so.key soremote@"$MSRV" cat /etc/soversion)
|
||||
scp -i /root/.ssh/so.key soremote@"$MSRV":/opt/so/repo/"$manager_ver".tar.gz /root/manager_setup
|
||||
} >> "$setup_log" 2>&1
|
||||
|
||||
# Fail if the file doesn't download
|
||||
if ! [ -f /root/manager_setup/"$manager_ver".tar.gz ]; then
|
||||
rm /root/install_opt
|
||||
local message="Could not download $manager_ver.tar.gz from manager, please check your network settings and verify the file /opt/so/repo/$manager_ver.tar.gz exists on the manager."
|
||||
echo "$message" | tee -a "$setup_log"
|
||||
kill -SIGUSR1 "$(ps --pid $$ -oppid=)"; exit 1
|
||||
fi
|
||||
|
||||
{
|
||||
tar -xzf /root/manager_setup/"$manager_ver".tar.gz -C /root/manager_setup/securityonion
|
||||
rm -rf /root/manager_setup/"$manager_ver".tar.gz
|
||||
} >> "$setup_log" 2>&1
|
||||
}
|
||||
|
||||
fireeye_pillar() {
|
||||
|
||||
local fireeye_pillar_path=$local_salt_dir/pillar/fireeye
|
||||
@@ -1011,6 +1046,11 @@ generate_passwords(){
|
||||
KRATOSKEY=$(get_random_value)
|
||||
}
|
||||
|
||||
generate_repo_tarball() {
|
||||
mkdir /opt/so/repo
|
||||
tar -czf /opt/so/repo/"$SOVERSION".tar.gz ../.
|
||||
}
|
||||
|
||||
get_redirect() {
|
||||
whiptail_set_redirect
|
||||
if [ "$REDIRECTINFO" = "OTHER" ]; then
|
||||
@@ -1049,18 +1089,22 @@ host_pillar() {
|
||||
}
|
||||
|
||||
install_cleanup() {
|
||||
echo "Installer removing the following files:"
|
||||
ls -lR "$temp_install_dir"
|
||||
if [ -f "$temp_install_dir" ]; then
|
||||
echo "Installer removing the following files:"
|
||||
ls -lR "$temp_install_dir"
|
||||
|
||||
# Clean up after ourselves
|
||||
rm -rf "$temp_install_dir"
|
||||
# Clean up after ourselves
|
||||
rm -rf "$temp_install_dir"
|
||||
fi
|
||||
|
||||
# All cleanup prior to this statement must be compatible with automated testing. Cleanup
|
||||
# that will disrupt automated tests should be placed beneath this statement.
|
||||
[ -n "$TESTING" ] && return
|
||||
|
||||
# If Mysql is running stop it
|
||||
/usr/sbin/so-mysql-stop
|
||||
if docker ps --format "{{.Names}}" 2>&1 | grep -q "so-mysql"; then
|
||||
/usr/sbin/so-mysql-stop
|
||||
fi
|
||||
|
||||
if [[ $setup_type == 'iso' ]]; then
|
||||
info "Removing so-setup permission entry from sudoers file"
|
||||
@@ -1328,12 +1372,10 @@ network_setup() {
|
||||
disable_misc_network_features;
|
||||
|
||||
echo "... Setting ONBOOT for management interface";
|
||||
if ! netplan > /dev/null 2>&1; then
|
||||
nmcli con mod "$MNIC" connection.autoconnect "yes";
|
||||
fi
|
||||
command -v netplan &> /dev/null || nmcli con mod "$MNIC" connection.autoconnect "yes"
|
||||
|
||||
echo "... Copying 99-so-checksum-offload-disable";
|
||||
cp ./install_scripts/99-so-checksum-offload-disable /etc/NetworkManager/dispatcher.d/pre-up.d/99-so-checksum-offload-disable ;
|
||||
echo "... Copying 99-so-checksum-offload-disable";
|
||||
cp ./install_scripts/99-so-checksum-offload-disable /etc/NetworkManager/dispatcher.d/pre-up.d/99-so-checksum-offload-disable ;
|
||||
|
||||
echo "... Modifying 99-so-checksum-offload-disable";
|
||||
sed -i "s/\$MNIC/${MNIC}/g" /etc/NetworkManager/dispatcher.d/pre-up.d/99-so-checksum-offload-disable;
|
||||
@@ -1376,7 +1418,7 @@ elasticsearch_pillar() {
|
||||
|
||||
parse_install_username() {
|
||||
# parse out the install username so things copy correctly
|
||||
INSTALLUSERNAME=$(pwd | sed -E 's/\// /g' | awk '{ print $2 }')
|
||||
INSTALLUSERNAME=${SUDO_USER:-${USER}}
|
||||
}
|
||||
|
||||
patch_pillar() {
|
||||
@@ -1668,7 +1710,7 @@ saltify() {
|
||||
apt-key add "$temp_install_dir"/gpg/GPG-KEY-WAZUH >> "$setup_log" 2>&1
|
||||
echo "deb http://repo.saltstack.com$py_ver_url_path/ubuntu/$ubuntu_version/amd64/archive/3002.2/ $OSVER main" > /etc/apt/sources.list.d/saltstack.list 2>> "$setup_log"
|
||||
echo "deb https://packages.wazuh.com/3.x/apt/ stable main" > /etc/apt/sources.list.d/wazuh.list 2>> "$setup_log"
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
apt-get update >> "$setup_log" 2>&1
|
||||
set_progress_str 8 'Installing salt-minion & python modules'
|
||||
@@ -1798,6 +1840,19 @@ set_network_dev_status_list() {
|
||||
|
||||
set_main_ip() {
|
||||
MAINIP=$(ip route get 1 | awk '{print $7;exit}')
|
||||
MNIC_IP=$(ip a s "$MNIC" | grep -oE 'inet [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d' ' -f2)
|
||||
}
|
||||
|
||||
compare_main_nic_ip() {
|
||||
if [[ "$MAINIP" != "$MNIC_IP" ]]; then
|
||||
read -r -d '' message <<- EOM
|
||||
The IP being routed by Linux is not the IP address assigned to the management interface ($MNIC).
|
||||
|
||||
This is not a supported configuration, please remediate and rerun setup.
|
||||
EOM
|
||||
whiptail --title "Security Onion Setup" --msgbox "$message" 10 75
|
||||
kill -SIGINT "$(ps --pid $$ -oppid=)"; exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Add /usr/sbin to everyone's path
|
||||
|
||||
Reference in New Issue
Block a user