mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
reduce setting ssh commands down to 1 function and 1 function call
This commit is contained in:
@@ -1080,37 +1080,6 @@ get_minion_type() {
|
||||
echo "$minion_type"
|
||||
}
|
||||
|
||||
get_scp_cmd() {
|
||||
local automated=$1
|
||||
|
||||
if [ $automated == yes ]; then
|
||||
scpcmd='sshpass -p "automation" scp -o StrictHostKeyChecking=no'
|
||||
else
|
||||
scpcmd='scp'
|
||||
fi
|
||||
}
|
||||
|
||||
get_ssh_cmd() {
|
||||
local automated=$1
|
||||
|
||||
if [ $automated == yes ]; then
|
||||
sshcmd='sshpass -p "automation" ssh -o StrictHostKeyChecking=no'
|
||||
else
|
||||
sshcmd='ssh'
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
get_ssh_copy_id_cmd() {
|
||||
local automated=$1
|
||||
|
||||
if [ $automated == yes ]; then
|
||||
sshcopyidcmd='sshpass -p "automation" ssh-copy-id -o StrictHostKeyChecking=no'
|
||||
else
|
||||
sshcopyidcmd='ssh-copy-id'
|
||||
fi
|
||||
}
|
||||
|
||||
host_pillar() {
|
||||
|
||||
local pillar_file="$temp_install_dir"/pillar/minions/"$MINION_ID".sls
|
||||
@@ -2005,6 +1974,20 @@ set_progress_str() {
|
||||
"----" >> "$setup_log" 2>&1
|
||||
}
|
||||
|
||||
set_ssh_cmds() {
|
||||
local automated=$1
|
||||
|
||||
if [ $automated == yes ]; then
|
||||
sshcmd='sshpass -p "automation" ssh -o StrictHostKeyChecking=no'
|
||||
sshcopyidcmd='sshpass -p "automation" ssh-copy-id -o StrictHostKeyChecking=no'
|
||||
scpcmd='sshpass -p "automation" scp -o StrictHostKeyChecking=no'
|
||||
else
|
||||
sshcmd='ssh'
|
||||
sshcopyidcmd='ssh-copy-id'
|
||||
scpcmd='scp'
|
||||
fi
|
||||
}
|
||||
|
||||
sensor_pillar() {
|
||||
|
||||
local pillar_file=$temp_install_dir/pillar/minions/$MINION_ID.sls
|
||||
|
||||
@@ -146,9 +146,7 @@ case "$setup_type" in
|
||||
esac
|
||||
|
||||
#set ssh commands that will be used based on if this is an automated test install or not
|
||||
get_scp_cmd $automated
|
||||
get_ssh_cmd $automated
|
||||
get_ssh_copy_id_cmd $automated
|
||||
set_ssh_cmds $automated
|
||||
|
||||
# Allow execution of SO tools during setup
|
||||
local_sbin="$(pwd)/../salt/common/tools/sbin"
|
||||
|
||||
Reference in New Issue
Block a user