Skip to content

Commit e942b1a

Browse files
author
Lucas RAVAGNIER
committed
Adding our own OpenSSH configuration
Redhat had their own configuration which could surpass ours, it will no longer be packaged. We created two configuration files with settings similar 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>
1 parent 2aa5339 commit e942b1a

3 files changed

Lines changed: 247 additions & 1 deletion

File tree

SOURCES/xcpng_ssh_config

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
7+
# This is the ssh client system-wide configuration file. See
8+
# ssh_config(5) for more information. This file provides defaults for
9+
# users, and the values can be changed in per-user configuration files
10+
# or on the command line.
11+
12+
# Configuration data is parsed as follows:
13+
# 1. command line options
14+
# 2. user-specific file
15+
# 3. system-wide file
16+
# Any configuration value is only changed the first time it is set.
17+
# Thus, host-specific definitions should be at the beginning of the
18+
# configuration file, and defaults at the end.
19+
20+
# Site-wide defaults for some commonly used options. For a comprehensive
21+
# list of available options, their meanings and defaults, please see the
22+
# ssh_config(5) man page.
23+
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+
GSSAPIAuthentication yes
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+
36+
# Host *
37+
# ForwardAgent no
38+
# ForwardX11 no
39+
# PasswordAuthentication yes
40+
# HostbasedAuthentication no
41+
# GSSAPIAuthentication no
42+
# GSSAPIDelegateCredentials no
43+
# BatchMode no
44+
# CheckHostIP no
45+
# AddressFamily any
46+
# ConnectTimeout 0
47+
# StrictHostKeyChecking ask
48+
# IdentityFile ~/.ssh/id_rsa
49+
# IdentityFile ~/.ssh/id_dsa
50+
# IdentityFile ~/.ssh/id_ecdsa
51+
# IdentityFile ~/.ssh/id_ed25519
52+
# Port 22
53+
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
54+
# MACs hmac-md5,hmac-sha1,umac-64@openssh.com
55+
# EscapeChar ~
56+
# Tunnel no
57+
# TunnelDevice any:any
58+
# PermitLocalCommand no
59+
# VisualHostKey no
60+
# ProxyCommand ssh -q -W %h:%p gateway.example.com
61+
# RekeyLimit 1G 1h
62+
# UserKnownHostsFile ~/.ssh/known_hosts.d/%k

SOURCES/xcpng_sshd_config

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# XCP-ng sshd server configuration.
2+
# DO NOT MODIFY THIS FILE, IT WILL BE OVERWRITE AT EVERY UPDATE
3+
4+
5+
# $OpenBSD: sshd_config,v 1.104 2021/07/02 05:11:21 dtucker Exp $
6+
7+
# This is the sshd server system-wide configuration file. See
8+
# sshd_config(5) for more information.
9+
10+
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
11+
12+
# The strategy used for options in the default sshd_config shipped with
13+
# OpenSSH is to specify options with their default value where
14+
# possible, but leave them commented. Uncommented options override the
15+
# default value.
16+
17+
# To modify the system-wide sshd configuration, create *.conf file(s) under
18+
# /etc/ssh/sshd_config.d/ which will be automatically included below
19+
Include /etc/ssh/sshd_config.d/*.conf
20+
21+
#Port 22
22+
#AddressFamily any
23+
#ListenAddress 0.0.0.0
24+
#ListenAddress ::
25+
26+
#HostKey /etc/ssh/ssh_host_rsa_key
27+
#HostKey /etc/ssh/ssh_host_ecdsa_key
28+
#HostKey /etc/ssh/ssh_host_ed25519_key
29+
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,umac-128@openssh.com
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
34+
35+
# Ciphers and keying
36+
#RekeyLimit default none
37+
38+
# Logging
39+
SyslogFacility AUTHPRIV
40+
#LogLevel INFO
41+
42+
# Authentication:
43+
44+
#LoginGraceTime 2m
45+
PermitRootLogin yes
46+
PrintMotd no
47+
#StrictModes yes
48+
#MaxAuthTries 6
49+
#MaxSessions 10
50+
51+
#PubkeyAuthentication yes
52+
53+
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
54+
# but this is overridden so installations will only check .ssh/authorized_keys
55+
AuthorizedKeysFile .ssh/authorized_keys
56+
57+
#AuthorizedPrincipalsFile none
58+
59+
#AuthorizedKeysCommand none
60+
#AuthorizedKeysCommandUser nobody
61+
62+
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
63+
#HostbasedAuthentication no
64+
# Change to yes if you don't trust ~/.ssh/known_hosts for
65+
# HostbasedAuthentication
66+
#IgnoreUserKnownHosts no
67+
# Don't read the user's ~/.rhosts and ~/.shosts files
68+
#IgnoreRhosts yes
69+
70+
# To disable tunneled clear text passwords, change to no here!
71+
#PasswordAuthentication yes
72+
#PermitEmptyPasswords no
73+
74+
# Change to no to disable s/key passwords
75+
#KbdInteractiveAuthentication yes
76+
KbdInteractiveAuthentication no
77+
#ChallengeResponseAuthentication yes
78+
ChallengeResponseAuthentication no
79+
80+
# Kerberos options
81+
#KerberosAuthentication no
82+
#KerberosOrLocalPasswd yes
83+
#KerberosTicketCleanup yes
84+
#KerberosGetAFSToken no
85+
86+
# GSSAPI options
87+
GSSAPIAuthentication no
88+
GSSAPICleanupCredentials no
89+
90+
# Set this to 'yes' to enable PAM authentication, account processing,
91+
# and session processing. If this is enabled, PAM authentication will
92+
# be allowed through the KbdInteractiveAuthentication and
93+
# PasswordAuthentication. Depending on your PAM configuration,
94+
# PAM authentication via KbdInteractiveAuthentication may bypass
95+
# the setting of "PermitRootLogin prohibit-password".
96+
# If you just want the PAM account and session checks to run without
97+
# PAM authentication, then enable this but set PasswordAuthentication
98+
# and KbdInteractiveAuthentication to 'no'.
99+
UsePAM yes
100+
101+
#AllowAgentForwarding yes
102+
#AllowTcpForwarding yes
103+
#GatewayPorts no
104+
# XCP-ng does not support X11Forwarding
105+
X11Forwarding no
106+
#X11DisplayOffset 10
107+
#X11UseLocalhost yes
108+
#PermitTTY yes
109+
#PrintMotd yes
110+
#PrintLastLog yes
111+
#TCPKeepAlive yes
112+
#PermitUserEnvironment no
113+
#Compression delayed
114+
#ClientAliveInterval 0
115+
#ClientAliveCountMax 3
116+
#UseDNS no
117+
#PidFile /var/run/sshd.pid
118+
#MaxStartups 10:30:100
119+
#PermitTunnel no
120+
#ChrootDirectory none
121+
#VersionAddendum none
122+
123+
# no default banner path
124+
#Banner none
125+
126+
# Accept locale-related environment variables
127+
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
128+
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
129+
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
130+
AcceptEnv XMODIFIERS
131+
132+
# override default of no subsystems
133+
Subsystem sftp /usr/libexec/openssh/sftp-server
134+
135+
# Example of overriding settings on a per-user basis
136+
#Match User anoncvs
137+
# X11Forwarding no
138+
# AllowTcpForwarding no
139+
# PermitTTY no
140+
# ForceCommand cvs server

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: xcpng_sshd_config
88+
Source25: xcpng_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+
* Wed Aug 26 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)