mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
SSH: Replace old RSA keys with a new set
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
@@ -47,6 +47,9 @@ sed -i /etc/ssh/sshd_config \
|
|||||||
|
|
||||||
# Move away old and unsupported keys
|
# Move away old and unsupported keys
|
||||||
mv -f /etc/ssh/ssh_host_dsa_key{,.old}
|
mv -f /etc/ssh/ssh_host_dsa_key{,.old}
|
||||||
|
# Regenerating weak RSA keys
|
||||||
|
mv -f /etc/ssh/ssh_host_key{,.old}
|
||||||
|
mv -f /etc/ssh/ssh_host_rsa_key{,.old}
|
||||||
|
|
||||||
# Start services
|
# Start services
|
||||||
/etc/init.d/dnsmasq start
|
/etc/init.d/dnsmasq start
|
||||||
|
|||||||
@@ -12,24 +12,12 @@
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
if [ ! -e "/etc/ssh/ssh_host_key" ]; then
|
|
||||||
boot_mesg "Generating SSH host key..."
|
|
||||||
ssh-keygen -qf /etc/ssh/ssh_host_key -N '' -t rsa1
|
|
||||||
evaluate_retval
|
|
||||||
fi
|
|
||||||
|
|
||||||
for algo in rsa ecdsa ed25519; do
|
for algo in rsa ecdsa ed25519; do
|
||||||
keyfile="/etc/ssh/ssh_host_${algo}_key"
|
keyfile="/etc/ssh/ssh_host_${algo}_key"
|
||||||
|
|
||||||
# If the key already exists, there is nothing to do.
|
# If the key already exists, there is nothing to do.
|
||||||
[ -e "${keyfile}" ] && continue
|
[ -e "${keyfile}" ] && continue
|
||||||
|
|
||||||
case "${algo}" in
|
|
||||||
rsa)
|
|
||||||
algo="rsa1"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
boot_mesg "Generating SSH key (${algo})..."
|
boot_mesg "Generating SSH key (${algo})..."
|
||||||
ssh-keygen -qf "${keyfile}" -N '' -t ${algo}
|
ssh-keygen -qf "${keyfile}" -N '' -t ${algo}
|
||||||
evaluate_retval
|
evaluate_retval
|
||||||
|
|||||||
Reference in New Issue
Block a user