mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +01:00
make sshcmd, scpcmd, ssh_copy_id_cmd global to so-functions;
This commit is contained in:
@@ -110,10 +110,6 @@ analyze_system() {
|
||||
}
|
||||
|
||||
accept_salt_key_remote() {
|
||||
|
||||
local automated=$1
|
||||
local sshcmd=get_ssh_cmd $automated
|
||||
|
||||
systemctl restart salt-minion
|
||||
|
||||
echo "Accept the key remotely on the manager" >> "$setup_log" 2>&1
|
||||
@@ -558,9 +554,6 @@ check_requirements() {
|
||||
}
|
||||
|
||||
compare_versions() {
|
||||
local automated=$1
|
||||
local sshcmd=get_ssh_cmd $automated
|
||||
|
||||
manager_ver=$("$sshcmd" -i /root/.ssh/so.key soremote@"$MSRV" cat /etc/soversion)
|
||||
|
||||
if [[ $manager_ver == "" ]]; then
|
||||
@@ -675,10 +668,6 @@ copy_salt_master_config() {
|
||||
|
||||
copy_minion_tmp_files() {
|
||||
|
||||
local automated=$1
|
||||
local sshcmd=get_ssh_cmd $automated
|
||||
local scpcmd=get_scp_cmd $automated
|
||||
|
||||
case "$install_type" in
|
||||
'MANAGER' | 'EVAL' | 'HELIXSENSOR' | 'MANAGERSEARCH' | 'STANDALONE' | 'IMPORT')
|
||||
echo "Copying pillar and salt files in $temp_install_dir to $local_salt_dir"
|
||||
@@ -706,9 +695,6 @@ copy_minion_tmp_files() {
|
||||
|
||||
copy_ssh_key() {
|
||||
|
||||
local automated=$1
|
||||
local sshcopyidcmd=get_ssh_copy_id_cmd $automated
|
||||
|
||||
echo "Generating SSH key"
|
||||
# Generate SSH key
|
||||
mkdir -p /root/.ssh
|
||||
@@ -985,9 +971,6 @@ docker_seed_registry() {
|
||||
}
|
||||
|
||||
download_repo_tarball() {
|
||||
local automated=$1
|
||||
local sshcmd=get_ssh_cmd $automated
|
||||
local scpcmd=get_scp_cmd $automated
|
||||
|
||||
mkdir -p /root/manager_setup/securityonion
|
||||
{
|
||||
@@ -1101,36 +1084,31 @@ get_scp_cmd() {
|
||||
local automated=$1
|
||||
|
||||
if [ $automated == yes ]; then
|
||||
local scpcmd='sshpass -p "automation" scp -o StrictHostKeyChecking=no'
|
||||
scpcmd='sshpass -p "automation" scp -o StrictHostKeyChecking=no'
|
||||
else
|
||||
local scpcmd='scp'
|
||||
scpcmd='scp'
|
||||
fi
|
||||
|
||||
echo $scpcmd
|
||||
}
|
||||
|
||||
get_ssh_cmd() {
|
||||
local automated=$1
|
||||
|
||||
if [ $automated == yes ]; then
|
||||
local sshcmd='sshpass -p "automation" ssh -o StrictHostKeyChecking=no'
|
||||
sshcmd='sshpass -p "automation" ssh -o StrictHostKeyChecking=no'
|
||||
else
|
||||
local sshcmd='ssh'
|
||||
sshcmd='ssh'
|
||||
fi
|
||||
|
||||
echo $sshcmd
|
||||
}
|
||||
|
||||
get_ssh_copy_id_cmd() {
|
||||
local automated=$1
|
||||
|
||||
if [ $automated == yes ]; then
|
||||
local sshcopyidcmd='sshpass -p "automation" ssh-copy-id -o StrictHostKeyChecking=no'
|
||||
sshcopyidcmd='sshpass -p "automation" ssh-copy-id -o StrictHostKeyChecking=no'
|
||||
else
|
||||
local sshcopyidcmd='ssh-copy-id'
|
||||
sshcopyidcmd='ssh-copy-id'
|
||||
fi
|
||||
|
||||
echo $sshcopyidcmd
|
||||
}
|
||||
|
||||
host_pillar() {
|
||||
@@ -1680,9 +1658,6 @@ remove_package() {
|
||||
# - securityonion/salt/salt/minion.defaults.yaml
|
||||
saltify() {
|
||||
|
||||
local automated=$1
|
||||
local scpcmd=get_scp_cmd $automated
|
||||
|
||||
# Install updates and Salt
|
||||
if [ $OS = 'centos' ]; then
|
||||
set_progress_str 5 'Installing Salt repo'
|
||||
@@ -2108,8 +2083,6 @@ set_hostname() {
|
||||
set_initial_firewall_policy() {
|
||||
|
||||
set_main_ip
|
||||
local automated=$1
|
||||
local sshcmd=get_ssh_cmd $automated
|
||||
|
||||
if [ -f $default_salt_dir/pillar/data/addtotab.sh ]; then chmod +x $default_salt_dir/pillar/data/addtotab.sh; fi
|
||||
if [ -f $default_salt_dir/salt/common/tools/sbin/so-firewall ]; then chmod +x $default_salt_dir/salt/common/tools/sbin/so-firewall; fi
|
||||
|
||||
@@ -108,6 +108,9 @@ if [[ -f automation/$automation && $(basename $automation) == $automation ]]; th
|
||||
echo "Preselecting variable values based on automated setup: $automation" >> $setup_log 2>&1
|
||||
source automation/$automation
|
||||
automated=yes
|
||||
get_scp_cmd $automated
|
||||
get_ssh_cmd $automated
|
||||
get_ssh_copy_id_cmd $automated
|
||||
|
||||
attempt=1
|
||||
attempts=60
|
||||
@@ -296,7 +299,7 @@ if ! [[ -f $install_opt_file ]]; then
|
||||
fi
|
||||
|
||||
if [[ $is_minion ]]; then
|
||||
copy_ssh_key $automated >> $setup_log 2>&1
|
||||
copy_ssh_key >> $setup_log 2>&1
|
||||
fi
|
||||
|
||||
if [[ $is_minion ]] && ! (compare_versions $automated); then
|
||||
@@ -307,7 +310,7 @@ if ! [[ -f $install_opt_file ]]; then
|
||||
"HOSTNAME=$HOSTNAME" \
|
||||
"MSRV=$MSRV" \
|
||||
"MSRVIP=$MSRVIP" > "$install_opt_file"
|
||||
download_repo_tarball $automated
|
||||
download_repo_tarball
|
||||
exec bash /root/manager_setup/securityonion/setup/so-setup "${original_args[@]}"
|
||||
fi
|
||||
|
||||
@@ -562,7 +565,7 @@ set_redirect >> $setup_log 2>&1
|
||||
|
||||
if [[ $is_minion ]]; then
|
||||
set_progress_str 1 'Configuring firewall'
|
||||
set_initial_firewall_policy $automated >> $setup_log 2>&1
|
||||
set_initial_firewall_policy >> $setup_log 2>&1
|
||||
fi
|
||||
|
||||
set_progress_str 2 'Updating packages'
|
||||
@@ -582,7 +585,7 @@ set_redirect >> $setup_log 2>&1
|
||||
fi
|
||||
|
||||
set_progress_str 5 'Installing Salt and dependencies'
|
||||
saltify $automated 2>> $setup_log
|
||||
saltify 2>> $setup_log
|
||||
|
||||
set_progress_str 6 'Installing Docker and dependencies'
|
||||
docker_install >> $setup_log 2>&1
|
||||
@@ -635,7 +638,7 @@ set_redirect >> $setup_log 2>&1
|
||||
|
||||
if [[ $is_minion ]]; then
|
||||
set_progress_str 20 'Accepting Salt key on manager'
|
||||
accept_salt_key_remote $automated >> $setup_log 2>&1
|
||||
accept_salt_key_remote >> $setup_log 2>&1
|
||||
fi
|
||||
|
||||
if [[ $is_manager || $is_import || $is_helix ]]; then
|
||||
@@ -644,7 +647,7 @@ set_redirect >> $setup_log 2>&1
|
||||
fi
|
||||
|
||||
set_progress_str 21 'Copying minion pillars to manager'
|
||||
copy_minion_tmp_files $automated >> $setup_log 2>&1
|
||||
copy_minion_tmp_files >> $setup_log 2>&1
|
||||
|
||||
if [[ $is_minion ]]; then
|
||||
set_progress_str 22 'Checking if the Salt Minion needs to be updated'
|
||||
@@ -656,7 +659,7 @@ set_redirect >> $setup_log 2>&1
|
||||
|
||||
if [[ $is_manager || $is_helix || $is_import ]]; then
|
||||
set_progress_str 25 'Configuring firewall'
|
||||
set_initial_firewall_policy $automated >> $setup_log 2>&1
|
||||
set_initial_firewall_policy >> $setup_log 2>&1
|
||||
|
||||
# create these so the registry state can add so-registry to /opt/so/conf/so-status/so-status.conf
|
||||
mkdir -p /opt/so/conf/so-status/ >> $setup_log 2>&1
|
||||
|
||||
Reference in New Issue
Block a user