From 343a98560b5ecd34e0a9a4393e5501b570fd819d Mon Sep 17 00:00:00 2001 From: Michael OBrien Date: Wed, 5 Apr 2023 15:34:57 -0700 Subject: [PATCH 1/4] Check for both default rsa and ed25519 ssh public key files --- plugins/git/internal-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/internal-functions b/plugins/git/internal-functions index f54d10ff0..b896a119a 100755 --- a/plugins/git/internal-functions +++ b/plugins/git/internal-functions @@ -257,7 +257,7 @@ cmd-git-public-key() { local cmd="git:public-key" [[ "$1" == "$cmd" ]] && shift 1 - if [[ ! -f "$DOKKU_ROOT/.ssh/id_rsa.pub" ]]; then + if [[ ! -f "$DOKKU_ROOT/.ssh/id_rsa.pub" ]] && [[ ! -f "$DOKKU_ROOT/.ssh/id_ed25519.pub" ]] ; then fn-git-auth-error fi From 2cac8718dd47f186554b3f8aea987f81c115b38d Mon Sep 17 00:00:00 2001 From: Michael OBrien Date: Wed, 5 Apr 2023 18:52:36 -0700 Subject: [PATCH 2/4] Improve ed25519 + rsa ssh key search and presentation --- plugins/git/internal-functions | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/git/internal-functions b/plugins/git/internal-functions index b896a119a..2833af430 100755 --- a/plugins/git/internal-functions +++ b/plugins/git/internal-functions @@ -257,11 +257,13 @@ cmd-git-public-key() { local cmd="git:public-key" [[ "$1" == "$cmd" ]] && shift 1 - if [[ ! -f "$DOKKU_ROOT/.ssh/id_rsa.pub" ]] && [[ ! -f "$DOKKU_ROOT/.ssh/id_ed25519.pub" ]] ; then + if [[ -f "$DOKKU_ROOT/.ssh/id_ed25519.pub" ]] ; then + cat "$DOKKU_ROOT/.ssh/id_ed25519.pub" + elif [[ -f "$DOKKU_ROOT/.ssh/id_rsa.pub" ]]; then + cat "$DOKKU_ROOT/.ssh/id_rsa.pub" + else fn-git-auth-error fi - - cat "$DOKKU_ROOT/.ssh/id_rsa.pub" } cmd-git-report() { From b11d9bc3a0fe470d4acb959903b3f25b45975af0 Mon Sep 17 00:00:00 2001 From: josegonzalez Date: Tue, 11 Apr 2023 22:43:37 -0400 Subject: [PATCH 3/4] fix: correct shfmt issue and fallback to default case --- plugins/git/internal-functions | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/git/internal-functions b/plugins/git/internal-functions index 2833af430..6a4235ca6 100755 --- a/plugins/git/internal-functions +++ b/plugins/git/internal-functions @@ -257,13 +257,13 @@ cmd-git-public-key() { local cmd="git:public-key" [[ "$1" == "$cmd" ]] && shift 1 - if [[ -f "$DOKKU_ROOT/.ssh/id_ed25519.pub" ]] ; then + if [[ -f "$DOKKU_ROOT/.ssh/id_ed25519.pub" ]]; then cat "$DOKKU_ROOT/.ssh/id_ed25519.pub" elif [[ -f "$DOKKU_ROOT/.ssh/id_rsa.pub" ]]; then cat "$DOKKU_ROOT/.ssh/id_rsa.pub" - else - fn-git-auth-error fi + + fn-git-auth-error } cmd-git-report() { From ca04c2dc48fdad398bc48682414a8ccd32bb5e35 Mon Sep 17 00:00:00 2001 From: josegonzalez Date: Thu, 27 Apr 2023 22:54:14 -0400 Subject: [PATCH 4/4] fix: return after showing the contents of the public key file --- plugins/git/internal-functions | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/internal-functions b/plugins/git/internal-functions index 6a4235ca6..bb58a2111 100755 --- a/plugins/git/internal-functions +++ b/plugins/git/internal-functions @@ -259,8 +259,10 @@ cmd-git-public-key() { if [[ -f "$DOKKU_ROOT/.ssh/id_ed25519.pub" ]]; then cat "$DOKKU_ROOT/.ssh/id_ed25519.pub" + return elif [[ -f "$DOKKU_ROOT/.ssh/id_rsa.pub" ]]; then cat "$DOKKU_ROOT/.ssh/id_rsa.pub" + return fi fn-git-auth-error