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 <guilhem@libreoffice.org>
Tested-by: Hossein <hossein@libreoffice.org>
This commit is contained in:
Hossein
2021-09-29 09:34:21 +02:00
parent d4bd8b7b18
commit 22483334bf
+12 -1
View File
@@ -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