mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-08 18:22:47 +01:00
[fix] Only add entry to /etc/hosts if unable to resolve hostname
This commit is contained in:
@@ -103,6 +103,9 @@ add_manager_hostfile() {
|
|||||||
|
|
||||||
local exitstatus=$?
|
local exitstatus=$?
|
||||||
whiptail_check_exitstatus $exitstatus
|
whiptail_check_exitstatus $exitstatus
|
||||||
|
|
||||||
|
# Add manager to hosts file
|
||||||
|
echo "$MSRVIP $MSRV" >> /etc/hosts
|
||||||
}
|
}
|
||||||
|
|
||||||
addtotab_generate_templates() {
|
addtotab_generate_templates() {
|
||||||
@@ -1852,25 +1855,12 @@ set_default_log_size() {
|
|||||||
|
|
||||||
set_hostname() {
|
set_hostname() {
|
||||||
|
|
||||||
set_hostname_iso
|
|
||||||
|
|
||||||
if [[ ! $install_type =~ ^(MANAGER|EVAL|HELIXSENSOR|MANAGERSEARCH|STANDALONE|IMPORT)$ ]]; then
|
|
||||||
if ! getent hosts "$MSRV"; then
|
|
||||||
echo "$MSRVIP $MSRV" >> /etc/hosts
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
set_hostname_iso() {
|
|
||||||
|
|
||||||
hostnamectl set-hostname --static "$HOSTNAME"
|
hostnamectl set-hostname --static "$HOSTNAME"
|
||||||
echo "127.0.0.1 $HOSTNAME $HOSTNAME.localdomain localhost localhost.localdomain localhost4 localhost4.localdomain" > /etc/hosts
|
echo "127.0.0.1 $HOSTNAME $HOSTNAME.localdomain localhost localhost.localdomain localhost4 localhost4.localdomain" > /etc/hosts
|
||||||
echo "::1 $HOSTNAME $HOSTNAME.localdomain localhost localhost.localdomain localhost6 localhost6.localdomain6" >> /etc/hosts
|
echo "::1 $HOSTNAME $HOSTNAME.localdomain localhost localhost.localdomain localhost6 localhost6.localdomain6" >> /etc/hosts
|
||||||
echo "$HOSTNAME" > /etc/hostname
|
echo "$HOSTNAME" > /etc/hostname
|
||||||
|
|
||||||
hostname -F /etc/hostname
|
hostname -F /etc/hostname
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_initial_firewall_policy() {
|
set_initial_firewall_policy() {
|
||||||
|
|||||||
@@ -438,15 +438,18 @@ fi
|
|||||||
|
|
||||||
if [[ "$setup_type" == 'iso' ]]; then
|
if [[ "$setup_type" == 'iso' ]]; then
|
||||||
# Init networking so rest of install works
|
# Init networking so rest of install works
|
||||||
set_hostname_iso
|
set_hostname
|
||||||
set_management_interface
|
set_management_interface
|
||||||
fi
|
fi
|
||||||
|
|
||||||
disable_ipv6
|
disable_ipv6
|
||||||
disable_auto_start
|
disable_auto_start
|
||||||
|
|
||||||
|
if [[ "$setup_type" != 'iso' ]]; then
|
||||||
|
set_hostname >> $setup_log 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
{
|
{
|
||||||
set_hostname;
|
|
||||||
set_version;
|
set_version;
|
||||||
clear_manager;
|
clear_manager;
|
||||||
} >> $setup_log 2>&1
|
} >> $setup_log 2>&1
|
||||||
|
|||||||
Reference in New Issue
Block a user