Skip to content

Commit 5e7c5f3

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 5e7c5f3

3 files changed

Lines changed: 80 additions & 39 deletions

File tree

SOURCES/ssh_config

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
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 $
26

37
# This is the ssh client system-wide configuration file. See
48
# ssh_config(5) for more information. This file provides defaults for
@@ -17,17 +21,26 @@
1721
# list of available options, their meanings and defaults, please see the
1822
# ssh_config(5) man page.
1923

24+
# To modify the system-wide ssh client configuration, create *.conf file(s) under
25+
# /etc/ssh/ssh_config.d/ which will be automatically included below
26+
Include /etc/ssh/ssh_config.d/*.conf
27+
28+
Host *
29+
# Send locale-related environment variables
30+
SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
31+
SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
32+
SendEnv LC_IDENTIFICATION LC_ALL LANGUAGE
33+
SendEnv XMODIFIERS
34+
2035
# Host *
2136
# ForwardAgent no
2237
# ForwardX11 no
2338
# PasswordAuthentication yes
2439
# HostbasedAuthentication no
2540
# GSSAPIAuthentication no
2641
# GSSAPIDelegateCredentials no
27-
# GSSAPIKeyExchange no
28-
# GSSAPITrustDNS no
2942
# BatchMode no
30-
# CheckHostIP yes
43+
# CheckHostIP no
3144
# AddressFamily any
3245
# ConnectTimeout 0
3346
# StrictHostKeyChecking ask
@@ -46,16 +59,4 @@
4659
# ProxyCommand ssh -q -W %h:%p gateway.example.com
4760
# RekeyLimit 1G 1h
4861
# 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
62+

SOURCES/sshd_config

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
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 $
26

37
# This is the sshd server system-wide configuration file. See
@@ -19,17 +23,16 @@ Include /etc/ssh/sshd_config.d/*.conf
1923
#ListenAddress 0.0.0.0
2024
#ListenAddress ::
2125

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
26+
#HostKey /etc/ssh/ssh_host_rsa_key
27+
#HostKey /etc/ssh/ssh_host_ecdsa_key
28+
#HostKey /etc/ssh/ssh_host_ed25519_key
3129

30+
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes128-ctr
31+
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256
32+
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
33+
HostKeyAlgorithms ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256
3234

35+
# Ciphers and keying
3336
#RekeyLimit default none
3437

3538
# Logging
@@ -40,6 +43,7 @@ SyslogFacility AUTHPRIV
4043

4144
#LoginGraceTime 2m
4245
PermitRootLogin yes
46+
PrintMotd no
4347
#StrictModes yes
4448
#MaxAuthTries 6
4549
#MaxSessions 10
@@ -78,32 +82,27 @@ ChallengeResponseAuthentication no
7882
#KerberosOrLocalPasswd yes
7983
#KerberosTicketCleanup yes
8084
#KerberosGetAFSToken no
81-
#KerberosUseKuserok yes
8285

8386
# GSSAPI options
8487
GSSAPIAuthentication no
8588
GSSAPICleanupCredentials no
86-
#GSSAPIStrictAcceptorCheck yes
87-
#GSSAPIKeyExchange no
88-
#GSSAPIEnablek5users no
8989

9090
# Set this to 'yes' to enable PAM authentication, account processing,
9191
# and session processing. If this is enabled, PAM authentication will
9292
# be allowed through the KbdInteractiveAuthentication and
9393
# PasswordAuthentication. Depending on your PAM configuration,
9494
# PAM authentication via KbdInteractiveAuthentication may bypass
95-
# the setting of "PermitRootLogin without-password".
95+
# the setting of "PermitRootLogin prohibit-password".
9696
# If you just want the PAM account and session checks to run without
9797
# PAM authentication, then enable this but set PasswordAuthentication
9898
# and KbdInteractiveAuthentication to 'no'.
99-
# WARNING: 'UsePAM no' is not supported in Fedora and may cause several
100-
# problems.
10199
UsePAM yes
102100

103101
#AllowAgentForwarding yes
104102
#AllowTcpForwarding yes
105103
#GatewayPorts no
106-
#X11Forwarding no
104+
# XCP-ng does not support X11Forwarding
105+
X11Forwarding no
107106
#X11DisplayOffset 10
108107
#X11UseLocalhost yes
109108
#PermitTTY yes
@@ -131,14 +130,11 @@ AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
131130
AcceptEnv XMODIFIERS
132131

133132
# override default of no subsystems
134-
Subsystem sftp /usr/libexec/sftp-server
133+
Subsystem sftp /usr/libexec/openssh/sftp-server
135134

136135
# Example of overriding settings on a per-user basis
137136
#Match User anoncvs
138137
# X11Forwarding no
139138
# AllowTcpForwarding no
140139
# PermitTTY no
141140
# 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)