]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
sshd: Do not generate new RSA host key on first boot
authorPeter Müller <peter.mueller@ipfire.org>
Fri, 20 Sep 2024 14:20:18 +0000 (14:20 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 22 Sep 2024 14:42:41 +0000 (14:42 +0000)
This patch will also ensure the maximum supported key length
is used for ECDSA. Existing installations will remain unaffected.

Note that the key size for ED25519 is fixed, and explicitly
setting it to 521 bytes will not have any impact.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/initscripts/system/sshd

index fa40bc11d5b807b098dbfa10ad95c0dc786cc2ac..e5a9931afad29d4986a2b3abe2fd01549fe98963 100644 (file)
@@ -2,7 +2,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2022  IPFire Team  <info@ipfire.org>                     #
+# Copyright (C) 2007-2024  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
 
 case "$1" in
     start)
-       for algo in rsa ecdsa ed25519; do
+       for algo in ecdsa ed25519; do
                keyfile="/etc/ssh/ssh_host_${algo}_key"
 
                # If the key already exists, there is nothing to do.
                [ -e "${keyfile}" ] && continue
 
                boot_mesg "Generating SSH key (${algo})..."
-               ssh-keygen -qf "${keyfile}" -N '' -t ${algo}
+               ssh-keygen -qf "${keyfile}" -N '' -b 521 -t ${algo}
                evaluate_retval
        done