Update OpenSSH to Version 9.0p1 (Buster/Bullseye/Bookworm)

Seit Ende Februar 2026 gibt es bei RPiOS-Installationen älterer Bauart (Buster/Bullseye/Bookworm) folgenden SSH-Hinweis:
** WARNING: connection is not using a post-quantum key exchange algorithm.
** This session may be vulnerable to „store now, decrypt later“ attacks.
** The server may need to be upgraded. See https://openssh.com/pq.html
Linux datev 5.10.103-v7+ #1529 SMP Tue Mar 8 12:21:37 GMT 2022 armv7l
Das betrifft alle SSH-Versionen vor 9.0 und die war erst ab Oktober 2023 Standard, das betrifft also alle Buster-, alle Bullseye- und sogar einige ältere Bookworm-Versionen, siehe die Version-History. Anbei Skript, was ich bei mindestens 3 Installationen erfolgreich angewendet habe, auf diversen RPi-Zeros und RPi-3A+-Geräten. Wenn man das Skript über ssh selbst ausführt (was möglich ist), muss man aber den letzten Schritt („Cleaning Up“) manuell ausführen, weil die ssh-Session natürlich vorher beendet wird, bzw. neugestartet, aber man wird nicht abgemeldet. Wichtig: Repos müssen aktuell sein, siehe Kommentar am Anfang des Skriptes.


#!/bin/bash

# set buster repo to
# deb http://legacy.raspbian.org/raspbian/ buster main contrib non-free rpi
# in /etc/apt/sources.list

set -e

OPENSSH_VERSION="9.0p1"
OPENSSH_TAR="openssh-${OPENSSH_VERSION}.tar.gz"
OPENSSH_URL="https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/${OPENSSH_TAR}"

echo "=== Updating system packages ==="
apt update
apt install -y build-essential zlib1g-dev libssl-dev \
               libpam0g-dev libselinux1-dev libedit-dev \
               wget curl

echo "=== Downloading OpenSSH ${OPENSSH_VERSION} ==="
cd /usr/local/src
wget -q ${OPENSSH_URL}

echo "=== Extracting ==="
tar -xzf ${OPENSSH_TAR}
cd openssh-${OPENSSH_VERSION}

echo "=== Configuring build ==="
./configure \
    --prefix=/usr \
    --sysconfdir=/etc/ssh \
    --with-md5-passwords \
    --with-pam

echo "=== Compiling ==="
make -j$(nproc)

echo "=== Installing ==="
make install

echo "=== Restarting SSH service ==="
systemctl restart ssh

echo "=== Cleaning up ==="
cd /usr/local/src
rm -rf openssh-${OPENSSH_VERSION} ${OPENSSH_TAR}

echo "=== Done ==="
ssh -V