Correction erreur de code dans le script de connexion ssh
Correction de la condition dans le script de connexion SSH. La condition avant modification ne permettait pas de connexion sans la configuration d'une méthode d'authentification, et ne vérifiait pas la présence du fichier contenant la clé privée lors de l'utilisation de la méthode key.
This commit is contained in:
parent
83916d00b8
commit
f19f8d718a
@ -4,7 +4,7 @@ FROM alpine:3.20.0 AS monosphere-builder
|
||||
|
||||
|
||||
#Setting default settings, please change them at run
|
||||
ARG MONOSPHERE_VERSION="1.0.2 Alpha"
|
||||
ARG MONOSPHERE_VERSION="1.0.3 Alpha"
|
||||
|
||||
|
||||
#Defining build settings
|
||||
|
||||
@ -49,9 +49,9 @@ function main_menu () {
|
||||
local selected_server
|
||||
selected_server="${server_map[$choice]}"
|
||||
echo "Connexion à $( echo "$selected_server" | cut -d " " -f -3)..."
|
||||
if [ -z "$(echo "$selected_server" | cut -d ' ' -f 4)" ] && [ -f "$AUTHORIZED_SERVERS_PATH"/"$(echo "$selected_server" | cut -d ' ' -f 5)" ]; then
|
||||
if [ -z "$(echo "$selected_server" | cut -d ' ' -f 4)" ]; then
|
||||
ttyrec -z --"$(echo "$selected_server" | cut -d ' ' -f 1)"-"$(echo "$selected_server" | cut -d ' ' -f 3)"-- -k 300 --warn-before-kill 60 -- ssh -o StrictHostKeyChecking=accept-new -p "$(echo "$selected_server" | cut -d ' ' -f 2)" "$(echo "$selected_server" | cut -d ' ' -f 3)"@"$(echo "$selected_server" | cut -d ' ' -f 1)"
|
||||
elif [ "$(echo "$selected_server" | cut -d ' ' -f 4)" == "key" ]; then
|
||||
elif [ "$(echo "$selected_server" | cut -d ' ' -f 4)" == "key" ] && [ -f "$AUTHORIZED_SERVERS_PATH"/"$(echo "$selected_server" | cut -d ' ' -f 5)" ]; then
|
||||
eval "$(ssh-agent)" > /dev/null
|
||||
trap 'kill $SSH_AGENT_PID' EXIT
|
||||
cat /"$AUTHORIZED_SERVERS_PATH"/"$(echo "$selected_server" | cut -d ' ' -f 5)" | ssh-add - > /dev/null
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user