fix: dont add ssh-rsa when with_openssl=0

This commit is contained in:
boypt
2025-12-26 17:54:54 +08:00
parent 8e9111f899
commit 619b1bfaec
3 changed files with 12 additions and 0 deletions

View File

@@ -361,13 +361,16 @@ mkdir -p -m755 $RPM_BUILD_ROOT%{_var}/empty/sshd
make install DESTDIR=$RPM_BUILD_ROOT
# Modify sshd config file.
cat << EOF >> $RPM_BUILD_ROOT/etc/ssh/sshd_config
%if %{with_openssl} > 0
PubkeyAcceptedAlgorithms +ssh-rsa
%endif
PermitRootLogin yes
PasswordAuthentication yes
UseDNS no
UsePAM yes
KexAlgorithms -diffie-hellman-group1-sha1,diffie-hellman-group1-sha256,diffie-hellman-group14-sha1,diffie-hellman-group14-sha256,diffie-hellman-group15-sha256,diffie-hellman-group15-sha512,diffie-hellman-group16-sha256,diffie-hellman-group16-sha512,diffie-hellman-group17-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha512
EOF
%if %{with_openssl} > 0
# Modify ssh config file, to ensure that traditional RSA-type key authentication is available to avoid git clone failures.
# See: https://support.genymotion.com/hc/en-us/articles/9500420360093-I-get-the-error-no-matching-host-key-type-found-Their-offer-ssh-rsa-when-trying-to-connect-with-SSH
cat << EOF >> $RPM_BUILD_ROOT/etc/ssh/ssh_config
@@ -375,6 +378,7 @@ Host *
HostKeyAlgorithms = +ssh-rsa
PubkeyAcceptedAlgorithms = +ssh-rsa
EOF
%endif
install -m755 contrib/ssh-copy-id $RPM_BUILD_ROOT%{_bindir}/
install -m644 contrib/ssh-copy-id.1 $RPM_BUILD_ROOT%{_mandir}/man1/

View File

@@ -304,13 +304,16 @@ make install DESTDIR=$RPM_BUILD_ROOT
sed -E -i 's/^#?( ?)*GSSAPIAuthentication.*$/GSSAPIAuthentication yes/' $RPM_BUILD_ROOT/etc/ssh/sshd_config
sed -E -i 's/^#?( ?)*GSSAPICleanupCredentials.*$/GSSAPICleanupCredentials no/' $RPM_BUILD_ROOT/etc/ssh/sshd_config
cat << EOF >> $RPM_BUILD_ROOT/etc/ssh/sshd_config
%if %{with_openssl} > 0
PubkeyAcceptedAlgorithms +ssh-rsa
%endif
PermitRootLogin yes
PasswordAuthentication yes
UseDNS no
UsePAM yes
KexAlgorithms -diffie-hellman-group1-sha1,diffie-hellman-group1-sha256,diffie-hellman-group14-sha1,diffie-hellman-group14-sha256,diffie-hellman-group15-sha256,diffie-hellman-group15-sha512,diffie-hellman-group16-sha256,diffie-hellman-group16-sha512,diffie-hellman-group17-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha512
EOF
%if %{with_openssl} > 0
# Modify ssh config file, to ensure that traditional RSA-type key authentication is available to avoid git clone failures.
# See: https://support.genymotion.com/hc/en-us/articles/9500420360093-I-get-the-error-no-matching-host-key-type-found-Their-offer-ssh-rsa-when-trying-to-connect-with-SSH
cat << EOF >> $RPM_BUILD_ROOT/etc/ssh/ssh_config
@@ -318,6 +321,7 @@ Host *
HostKeyAlgorithms = +ssh-rsa
PubkeyAcceptedAlgorithms = +ssh-rsa
EOF
%endif
install -m755 contrib/ssh-copy-id $RPM_BUILD_ROOT%{_bindir}/
install -m644 contrib/ssh-copy-id.1 $RPM_BUILD_ROOT%{_mandir}/man1/

View File

@@ -295,13 +295,16 @@ make install DESTDIR=$RPM_BUILD_ROOT
sed -E -i 's/^#?( ?)*GSSAPIAuthentication.*$/GSSAPIAuthentication yes/' $RPM_BUILD_ROOT/etc/ssh/sshd_config
sed -E -i 's/^#?( ?)*GSSAPICleanupCredentials.*$/GSSAPICleanupCredentials no/' $RPM_BUILD_ROOT/etc/ssh/sshd_config
cat << EOF >> $RPM_BUILD_ROOT/etc/ssh/sshd_config
%if %{with_openssl} > 0
PubkeyAcceptedAlgorithms +ssh-rsa
%endif
PermitRootLogin yes
PasswordAuthentication yes
UseDNS no
UsePAM yes
KexAlgorithms -diffie-hellman-group1-sha1,diffie-hellman-group1-sha256,diffie-hellman-group14-sha1,diffie-hellman-group14-sha256,diffie-hellman-group15-sha256,diffie-hellman-group15-sha512,diffie-hellman-group16-sha256,diffie-hellman-group16-sha512,diffie-hellman-group17-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha512
EOF
%if %{with_openssl} > 0
# Modify ssh config file, to ensure that traditional RSA-type key authentication is available to avoid git clone failures.
# See: https://support.genymotion.com/hc/en-us/articles/9500420360093-I-get-the-error-no-matching-host-key-type-found-Their-offer-ssh-rsa-when-trying-to-connect-with-SSH
cat << EOF >> $RPM_BUILD_ROOT/etc/ssh/ssh_config
@@ -309,6 +312,7 @@ Host *
HostKeyAlgorithms = +ssh-rsa
PubkeyAcceptedAlgorithms = +ssh-rsa
EOF
%endif
install -m755 contrib/ssh-copy-id $RPM_BUILD_ROOT%{_bindir}/
install -m644 contrib/ssh-copy-id.1 $RPM_BUILD_ROOT%{_mandir}/man1/