From b5fa5be05c09041886ca575afbbb2f41b2ea24ac Mon Sep 17 00:00:00 2001 From: Joshua Rogers Date: Fri, 12 Jan 2024 00:21:22 +0700 Subject: [PATCH] Pick up optional SSH errors better. --- Snake.nocomments.sh | 4 ++-- Snake.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) mode change 100755 => 100644 Snake.nocomments.sh diff --git a/Snake.nocomments.sh b/Snake.nocomments.sh old mode 100755 new mode 100644 index 0c68e3e..4c798c5 --- a/Snake.nocomments.sh +++ b/Snake.nocomments.sh @@ -388,10 +388,10 @@ local ssh_extra_options local ssh_extra_option ssh_extra_options=(-oHostkeyAlgorithms=+ssh-rsa -oKexAlgorithms=+diffie-hellman-group1-sha1) for ssh_extra_option in "${ssh_extra_options[@]}"; do -[[ $(ssh "$ssh_extra_option" 2>&1) =~ Bad\ protocol\ 2\ host\ key\ algorithms|Bad\ SSH2\ KexAlgorithms|Bad\ key\ types ]] || ssh_options+=("$ssh_extra_option") +[[ "$(ssh "$ssh_extra_option" 2>&1)" =~ Bad\ protocol\ 2\ host\ key\ algorithms|Bad\ SSH2\ KexAlgorithms|Bad\ key\ types|diffie-hellman-group1-sha1|ssh-rsa ]] || ssh_options+=("$ssh_extra_option") done ssh_extra_options="-oPubkeyAcceptedKeyTypes=+ssh-rsa" -[[ $(ssh "$ssh_extra_option" 2>&1) =~ Bad\ configuration\ option|pubkeyacceptedkeytypes ]] || ssh_options+=("$ssh_extra_option") +[[ "$(ssh "$ssh_extra_option" 2>&1)" =~ Bad\ configuration\ option|pubkeyacceptedkeytypes ]] || ssh_options+=("$ssh_extra_option") } init_current_ips() { local current_ip diff --git a/Snake.sh b/Snake.sh index f8c74fe..a875f04 100755 --- a/Snake.sh +++ b/Snake.sh @@ -662,10 +662,10 @@ check_ssh_options() { ssh_extra_options=(-oHostkeyAlgorithms=+ssh-rsa -oKexAlgorithms=+diffie-hellman-group1-sha1) for ssh_extra_option in "${ssh_extra_options[@]}"; do - [[ $(ssh "$ssh_extra_option" 2>&1) =~ Bad\ protocol\ 2\ host\ key\ algorithms|Bad\ SSH2\ KexAlgorithms|Bad\ key\ types ]] || ssh_options+=("$ssh_extra_option") + [[ "$(ssh "$ssh_extra_option" 2>&1)" =~ Bad\ protocol\ 2\ host\ key\ algorithms|Bad\ SSH2\ KexAlgorithms|Bad\ key\ types|diffie-hellman-group1-sha1|ssh-rsa ]] || ssh_options+=("$ssh_extra_option") done ssh_extra_options="-oPubkeyAcceptedKeyTypes=+ssh-rsa" - [[ $(ssh "$ssh_extra_option" 2>&1) =~ Bad\ configuration\ option|pubkeyacceptedkeytypes ]] || ssh_options+=("$ssh_extra_option") + [[ "$(ssh "$ssh_extra_option" 2>&1)" =~ Bad\ configuration\ option|pubkeyacceptedkeytypes ]] || ssh_options+=("$ssh_extra_option") } # Determining the ip address of the current destination is difficult because it may have multiple ip addresses, and we are likely to connect to both of them eventually (including 127.0.0.1 for example).