logerrit |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 22483334bf897160494a7223992c5f4a301c82f8
Author:     Hossein <hoss...@libreoffice.org>
AuthorDate: Wed Sep 29 00:12:17 2021 +0200
Commit:     Hossein <hoss...@libreoffice.org>
CommitDate: Wed Sep 29 09:34:21 2021 +0200

    Use ed25519 as default for ssh key pair generation
    
    Use ed25519 algorithms as the default key pair generation algorithm
    for the public key cryptography used by ssh in order to submit
    patches via 'logerrit' script. If ed25519 is not available, RSA is
    used.
    
    List of supported algorithms in OpenSSH can be obtained by invoking
    this command:
    
        ssh -Q key
    
    Change-Id: I12ebcbb62d0752c94b8c2d5225223ceb69b7fe79
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122765
    Reviewed-by: guilhem <guil...@libreoffice.org>
    Tested-by: Hossein <hoss...@libreoffice.org>

diff --git a/logerrit b/logerrit
index 630d5f4113e5..8432acde79f5 100755
--- a/logerrit
+++ b/logerrit
@@ -98,7 +98,18 @@ case "$1" in
            echo "Hit enter to generate an ssh key - you will need to enter a 
pass-phrase"
            echo
            read -r
-           ssh-keygen -t rsa -f "$ssh_home/id_rsa" # default type as of 
OpenSSH 8.1
+        all_algo="$(ssh -Q key)"
+        if grep -q -x ssh-ed25519 <<< "$all_algo"
+        then
+            algo="ed25519"
+        elif grep -q -x ssh-rsa <<< "$all_algo"
+        then
+            algo="rsa"
+        else
+            echo "Could not find 'ssh-ed25519' or 'ssh-rsa' in the output from 
'ssh -Q key'"
+            exit 1
+        fi
+        ssh-keygen -t "$algo" # Generate the key pair using the selected 
algorithm
        fi
     if test -d "$ssh_home"; then
         # order algos based on the PubkeyAcceptedKeyTypes option from OpenSSH 
8.1

Reply via email to