Skip to content

Commit 5e6111c

Browse files
author
Lucas RAVAGNIER
committed
Maintain our own OpenSSH configuration
Redhat had their own configuration which could surpass ours, it will no longer be packaged. From now on, we keep maintaing the two configuration files with settings that do not regress to our previous version. Support for post-quantum algorithms is included, and brute-force protection remains enabled by default (hardening). The removal of the MOTD is due to the fact that PAM now handles it, rather than SSH. Signed-off-by: Lucas RAVAGNIER <lucas.ravagnier@vates.tech> Signed-off-by: Philippe Coval <philippe.coval@vates.tech>
1 parent a8a5e4e commit 5e6111c

3 files changed

Lines changed: 86 additions & 40 deletions

File tree

SOURCES/ssh_config

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# $OpenBSD: ssh_config,v 1.35 2020/07/17 03:43:42 dtucker Exp $
1+
# XCP-ng ssh client configuration
2+
# DO NOT MODIFY THIS FILE, IT WILL BE OVERWRITE AT EVERY UPDATE
3+
4+
5+
# $OpenBSD: ssh_config,v 1.36 2023/08/02 23:04:38 djm Exp $
6+
# Upstream: https://github.com/openssh/openssh-portable/blob/V_9_9/ssh_config
27

38
# This is the ssh client system-wide configuration file. See
49
# ssh_config(5) for more information. This file provides defaults for
@@ -17,17 +22,26 @@
1722
# list of available options, their meanings and defaults, please see the
1823
# ssh_config(5) man page.
1924

25+
# To modify the system-wide ssh client configuration, create *.conf file(s) under
26+
# /etc/ssh/ssh_config.d/ which will be automatically included below
27+
Include /etc/ssh/ssh_config.d/*.conf
28+
29+
Host *
30+
# Send locale-related environment variables
31+
SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
32+
SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
33+
SendEnv LC_IDENTIFICATION LC_ALL LANGUAGE
34+
SendEnv XMODIFIERS
35+
2036
# Host *
2137
# ForwardAgent no
2238
# ForwardX11 no
2339
# PasswordAuthentication yes
2440
# HostbasedAuthentication no
2541
# GSSAPIAuthentication no
2642
# GSSAPIDelegateCredentials no
27-
# GSSAPIKeyExchange no
28-
# GSSAPITrustDNS no
2943
# BatchMode no
30-
# CheckHostIP yes
44+
# CheckHostIP no
3145
# AddressFamily any
3246
# ConnectTimeout 0
3347
# StrictHostKeyChecking ask
@@ -46,16 +60,4 @@
4660
# ProxyCommand ssh -q -W %h:%p gateway.example.com
4761
# RekeyLimit 1G 1h
4862
# UserKnownHostsFile ~/.ssh/known_hosts.d/%k
49-
#
50-
Host *
51-
GSSAPIAuthentication yes
52-
# Send locale-related environment variables
53-
SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
54-
SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
55-
SendEnv LC_IDENTIFICATION LC_ALL LANGUAGE
56-
SendEnv XMODIFIERS
57-
58-
Ciphers aes128-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
59-
MACs hmac-sha2-256,hmac-sha2-512,hmac-sha1
60-
KexAlgorithms curve25519-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
61-
HostKeyAlgorithms ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-rsa
63+

SOURCES/sshd_config

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
# XCP-ng sshd server configuration.
2+
# DO NOT MODIFY THIS FILE, IT WILL BE OVERWRITE AT EVERY UPDATE
3+
4+
15
# $OpenBSD: sshd_config,v 1.104 2021/07/02 05:11:21 dtucker Exp $
6+
# Upstream: https://github.com/openssh/openssh-portable/blob/V_9_9/sshd_config
27

38
# This is the sshd server system-wide configuration file. See
49
# sshd_config(5) for more information.
@@ -19,17 +24,16 @@ Include /etc/ssh/sshd_config.d/*.conf
1924
#ListenAddress 0.0.0.0
2025
#ListenAddress ::
2126

22-
HostKey /etc/ssh/ssh_host_rsa_key
23-
HostKey /etc/ssh/ssh_host_ecdsa_key
24-
HostKey /etc/ssh/ssh_host_ed25519_key
25-
26-
# Ciphers, MACs, KEX Algorithms & HostKeyAlgorithms
27-
Ciphers aes128-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
28-
MACs hmac-sha2-256,hmac-sha2-512,hmac-sha1
29-
KexAlgorithms curve25519-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
30-
HostKeyAlgorithms ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-rsa
27+
#HostKey /etc/ssh/ssh_host_rsa_key
28+
#HostKey /etc/ssh/ssh_host_ecdsa_key
29+
#HostKey /etc/ssh/ssh_host_ed25519_key
3130

31+
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes128-ctr
32+
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256
33+
KexAlgorithms mlkem1024nistp384-sha384,mlkem768x25519-sha256,mlkem768nistp256-sha256,sntrup761x25519-sha512,sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512
34+
HostKeyAlgorithms ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256
3235

36+
# Ciphers and keying
3337
#RekeyLimit default none
3438

3539
# Logging
@@ -40,8 +44,10 @@ SyslogFacility AUTHPRIV
4044

4145
#LoginGraceTime 2m
4246
PermitRootLogin yes
47+
PrintMotd no
4348
#StrictModes yes
44-
#MaxAuthTries 6
49+
# XCP-ng hardening
50+
MaxAuthTries 3
4551
#MaxSessions 10
4652

4753
#PubkeyAuthentication yes
@@ -78,32 +84,29 @@ ChallengeResponseAuthentication no
7884
#KerberosOrLocalPasswd yes
7985
#KerberosTicketCleanup yes
8086
#KerberosGetAFSToken no
81-
#KerberosUseKuserok yes
8287

8388
# GSSAPI options
8489
GSSAPIAuthentication no
8590
GSSAPICleanupCredentials no
86-
#GSSAPIStrictAcceptorCheck yes
87-
#GSSAPIKeyExchange no
88-
#GSSAPIEnablek5users no
8991

9092
# Set this to 'yes' to enable PAM authentication, account processing,
9193
# and session processing. If this is enabled, PAM authentication will
9294
# be allowed through the KbdInteractiveAuthentication and
9395
# PasswordAuthentication. Depending on your PAM configuration,
9496
# PAM authentication via KbdInteractiveAuthentication may bypass
95-
# the setting of "PermitRootLogin without-password".
97+
# the setting of "PermitRootLogin prohibit-password".
9698
# If you just want the PAM account and session checks to run without
9799
# PAM authentication, then enable this but set PasswordAuthentication
98100
# and KbdInteractiveAuthentication to 'no'.
99-
# WARNING: 'UsePAM no' is not supported in Fedora and may cause several
100-
# problems.
101101
UsePAM yes
102102

103103
#AllowAgentForwarding yes
104104
#AllowTcpForwarding yes
105105
#GatewayPorts no
106-
#X11Forwarding no
106+
# XCP-ng does not support X11Forwarding
107+
X11Forwarding no
108+
# XCP-ng disable Forwarding for hardening
109+
DisableForwarding yes
107110
#X11DisplayOffset 10
108111
#X11UseLocalhost yes
109112
#PermitTTY yes
@@ -131,14 +134,11 @@ AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
131134
AcceptEnv XMODIFIERS
132135

133136
# override default of no subsystems
134-
Subsystem sftp /usr/libexec/sftp-server
137+
Subsystem sftp /usr/libexec/openssh/sftp-server
135138

136139
# Example of overriding settings on a per-user basis
137140
#Match User anoncvs
138141
# X11Forwarding no
139142
# AllowTcpForwarding no
140143
# PermitTTY no
141144
# ForceCommand cvs server
142-
143-
PerSourcePenalties=no
144-

SPECS/openssh.spec

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# XCP-ng build condition
22
%bcond_without xcpng
33
# XCP-ng sub release number
4-
%define xcpng_subrel 1
4+
%define xcpng_subrel 2
55

66
# Do we want SELinux & Audit
77
%if 0%{?!noselinux:1}
@@ -84,6 +84,8 @@ Source20: ssh-host-keys-migration.sh
8484
Source21: ssh-host-keys-migration.service
8585
Source22: parallel_test.sh
8686
Source23: parallel_test.Makefile
87+
Source24: sshd_config
88+
Source25: ssh_config
8789

8890
#https://bugzilla.mindrot.org/show_bug.cgi?id=2581
8991
Patch100: openssh-6.7p1-coverity.patch
@@ -355,7 +357,12 @@ BuildRequires: gnupg2
355357
%package clients
356358
Summary: An open source SSH client applications
357359
Requires: openssh = %{version}-%{release}
360+
# XCP-ng does not have that, and we don't support it.
361+
# This is used to set a global policies for all the platform.
362+
# This is not mandatory as we do the custom config
363+
%if %{without xcpng}
358364
Requires: crypto-policies >= 20220824-1
365+
%endif
359366

360367
%package keysign
361368
Summary: A helper program used for host-based authentication
@@ -366,7 +373,12 @@ Summary: An open source SSH server daemon
366373
Requires: openssh = %{version}-%{release}
367374
Requires(pre): /usr/sbin/useradd
368375
Requires: pam >= 1.0.1-3
376+
# XCP-ng does not have that, and we don't support it.
377+
# This is used to set a global policies for all the platform.
378+
# This is not mandatory as we do the custom config
379+
%if %{without xcpng}
369380
Requires: crypto-policies >= 20220824-1
381+
%endif
370382
%{?systemd_requires}
371383

372384
%package keycat
@@ -641,9 +653,18 @@ install -d $RPM_BUILD_ROOT%{_libexecdir}/openssh
641653
install -m644 %{SOURCE2} $RPM_BUILD_ROOT/etc/pam.d/sshd
642654
install -m644 %{SOURCE6} $RPM_BUILD_ROOT/etc/pam.d/ssh-keycat
643655
install -m644 %{SOURCE7} $RPM_BUILD_ROOT/etc/sysconfig/sshd
656+
# XCP-ng has its own rules; let's not package rules that could conflict with them.
657+
%if %{without xcpng}
644658
install -m644 ssh_config_redhat $RPM_BUILD_ROOT%{_sysconfdir}/ssh/ssh_config.d/50-redhat.conf
645659
install -m644 sshd_config_redhat_cp $RPM_BUILD_ROOT%{_sysconfdir}/ssh/sshd_config.d/40-redhat-crypto-policies.conf
646660
install -m644 sshd_config_redhat $RPM_BUILD_ROOT%{_sysconfdir}/ssh/sshd_config.d/50-redhat.conf
661+
%else
662+
# XCP-ng ships its own hardened sshd_config/ssh_config in place of the
663+
# upstream defaults; these fully replace them and are
664+
# reinstalled on every package upgrade.
665+
install -m644 %{SOURCE25} $RPM_BUILD_ROOT%{_sysconfdir}/ssh/ssh_config
666+
install -m600 %{SOURCE24} $RPM_BUILD_ROOT%{_sysconfdir}/ssh/sshd_config
667+
%endif
647668
install -d -m755 $RPM_BUILD_ROOT/%{_unitdir}
648669
install -m644 %{SOURCE9} $RPM_BUILD_ROOT/%{_unitdir}/sshd@.service
649670
install -m644 %{SOURCE10} $RPM_BUILD_ROOT/%{_unitdir}/sshd.socket
@@ -760,9 +781,18 @@ fi
760781
%attr(0644,root,root) %{_mandir}/man1/ssh.1*
761782
%attr(0755,root,root) %{_bindir}/scp
762783
%attr(0644,root,root) %{_mandir}/man1/scp.1*
784+
%if %{with xcpng}
785+
# Not marked %%config on purpose: this is the XCP-ng policy file and
786+
# must be unconditionally overwritten on every upgrade
787+
%attr(0644,root,root) %{_sysconfdir}/ssh/ssh_config
788+
%else
763789
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/ssh/ssh_config
790+
%endif
764791
%dir %attr(0755,root,root) %{_sysconfdir}/ssh/ssh_config.d/
792+
# XCP-ng has its own rules; let's not package rules that could conflict with them.
793+
%if %{without xcpng}
765794
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/ssh/ssh_config.d/50-redhat.conf
795+
%endif
766796
%attr(0644,root,root) %{_mandir}/man5/ssh_config.5*
767797
%attr(0755,root,root) %{_bindir}/ssh-agent
768798
%attr(0755,root,root) %{_bindir}/ssh-add
@@ -795,10 +825,19 @@ fi
795825
%attr(0644,root,root) %{_mandir}/man5/moduli.5*
796826
%attr(0644,root,root) %{_mandir}/man8/sshd.8*
797827
%attr(0644,root,root) %{_mandir}/man8/sftp-server.8*
828+
%if %{with xcpng}
829+
# Not marked %%config on purpose: this is the XCP-ng policy file and
830+
# must be unconditionally overwritten on every upgrade
831+
%attr(0600,root,root) %{_sysconfdir}/ssh/sshd_config
832+
%else
798833
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/ssh/sshd_config
834+
%endif
799835
%dir %attr(0700,root,root) %{_sysconfdir}/ssh/sshd_config.d/
836+
# XCP-ng has its own rules; let's not package rules that could conflict with them.
837+
%if %{without xcpng}
800838
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/ssh/sshd_config.d/40-redhat-crypto-policies.conf
801839
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/ssh/sshd_config.d/50-redhat.conf
840+
%endif
802841
%attr(0644,root,root) %config(noreplace) /etc/pam.d/sshd
803842
%attr(0640,root,root) %config(noreplace) /etc/sysconfig/sshd
804843
%attr(0644,root,root) %{_unitdir}/sshd.service
@@ -827,6 +866,11 @@ fi
827866
%attr(0755,root,root) %{_libdir}/sshtest/sk-dummy.so
828867

829868
%changelog
869+
* Mon Aug 31 2026 Lucas Ravagnier <lucas.ravagnier@vates.tech> - 9.9p1-30.2
870+
- XCP-ng must not package redhat confs and must apply its own.
871+
- Create first xcpng conf with pq (post-quantum) support,
872+
protection from bruteforce is by default.
873+
830874
* Wed Aug 26 2026 Lucas Ravagnier <lucas.ravagnier@vates.tech> - 9.9p1-30.1
831875
- CVE-2026-59998 is only a documentation update.
832876
- Fix of CVE-2026-60000

0 commit comments

Comments
 (0)