Step sendkey: add ssh option to force Ipv4

This commit is contained in:
2021-01-03 01:42:39 +01:00
parent 066dcfcdcd
commit 4d925dbc4a

View File

@@ -27,30 +27,66 @@ step_3() {
} }
step_5_info() { step_5_info() {
shift
local arg
local sshOption="[OPTIONS] "
local userHost="<USER@HOST>" local userHost="<USER@HOST>"
local userPort=" [PORT]" local userPort=" [PORT]"
if [ ! -z $2 ] ; then userHost="$2"; userPort=":22"; fi
if [ ! -z $3 ] ; then userPort=":$3"; fi for arg in "$@" ; do
echo "Send key to remote host ${userHost}$userPort" case "$1" in
-4)
sshOption="-o Addressfamiliy=inet"
shift
;;
*)
break
;;
esac
done
if [ ! -z $1 ] ; then userHost="$1"; userPort=":22"; fi
if [ ! -z $2 ] ; then userPort=":$2"; fi
echo "Send key to remote host ${sshOption}${userHost}$userPort"
echoinfo "[OPTIONS]"
echoinfo " -4 : Force Ipv4"
} }
step_5_alias() { ALIAS="sendkey"; } step_5_alias() { ALIAS="sendkey"; }
step_5() { step_5() {
shift
local arg
local sshOption
local sshHost
local sshPort=22 local sshPort=22
if [ -z "$2" ] || [ "$2" == "" ] ; then for arg in "$@" ; do
case "$1" in
-4)
sshOption="-o Addressfamiliy=inet"
shift
;;
*)
break
;;
esac
done
if [ -z "$1" ] || [ "$1" == "" ] ; then
echoerr " [E] Host not provided." echoerr " [E] Host not provided."
return 1 return 1
else
sshHost="$1"
fi fi
exep "ssh-keygen -l -f $toolIdentity 2>>/dev/null" exep "ssh-keygen -l -f $toolIdentity 2>>/dev/null"
saveReturn $? saveReturn $?
endReturn -f "Key $(realpath $toolIdentity) not found.\n Create one first." endReturn -f "Key $(realpath $toolIdentity) not found.\n Create one first."
if [ ! -z "$3" ] && [ "$3" != "" ] ; then if [ ! -z "$2" ] && [ "$2" != "" ] ; then
sshPort=$3 sshPort=$2
fi fi
exe ssh-copy-id -p $sshPort $2 exe ssh-copy-id -p ${sshPort} ${sshOption} ${sshHost}
} }
step_10_info() { echo "Send command(ssh)/file(scp) list to remote(s) <CMDLIST> [USER:HOST]"; } step_10_info() { echo "Send command(ssh)/file(scp) list to remote(s) <CMDLIST> [USER:HOST]"; }