From 028ada295da5c18e1ec7dab621601153b1d923d7 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Fri, 7 Apr 2023 12:34:07 +0200 Subject: [PATCH] fix: [vps] make `vps install backup` compatible with latest ``openssh-client``'s version. --- bin/0km | 2 +- bin/vps | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/0km b/bin/0km index 8b25eeb..8899cb3 100755 --- a/bin/0km +++ b/bin/0km @@ -746,7 +746,7 @@ vps_install_backup() { key="${out%\'*}" key="${key##*\'}" - if ! [[ "$key" =~ ^"ssh-rsa "[a-zA-Z0-9/+]+" "[a-zA-Z0-9._-]+"@"[a-zA-Z0-9._-]+$ ]]; then + if ! [[ "$key" =~ ^"ssh-rsa "[a-zA-Z0-9/+=]+" "[a-zA-Z0-9._-]+"@"[a-zA-Z0-9._-]+$ ]]; then err "Unexpected output from 'vps install backup $server'. Can't find key." echo "$out" | prefix " ${GRAY}|$NORMAL " >&2 echo " Extracted key:" >&2 diff --git a/bin/vps b/bin/vps index 1ee0290..39ec2ad 100755 --- a/bin/vps +++ b/bin/vps @@ -421,7 +421,10 @@ EOF info "You can run this following command from an host having admin access to $dest:" echo " (Or send it to a backup admin of $dest)" >&2 - public_key=$(ssh-keygen -y -f <(e "$private_key"$'\n')) + ## We remove ending label (label will be added or not in the + ## private key, and thus here, depending on the version of + ## openssh-client) + public_key=$(ssh-keygen -y -f <(e "$private_key"$'\n') | sed -r 's/ [^ ]+@[^ ]+$//') echo "ssh ${ssh_options[@]} myadmin@$dest ssh-key add '$public_key compose@$host'" }