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
8484Source21: ssh-host-keys-migration.service
8585Source22: parallel_test.sh
8686Source23: parallel_test.Makefile
87+ Source24: xcpng_sshd_config
88+ Source25: xcpng_ssh_config
8789
8890#https://bugzilla.mindrot.org/show_bug.cgi?id=2581
8991Patch100: openssh-6.7p1-coverity.patch
@@ -355,7 +357,12 @@ BuildRequires: gnupg2
355357%package clients
356358Summary: An open source SSH client applications
357359Requires: 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}
358364Requires: crypto-policies >= 20220824-1
365+ %endif
359366
360367%package keysign
361368Summary: A helper program used for host-based authentication
@@ -366,7 +373,12 @@ Summary: An open source SSH server daemon
366373Requires: openssh = %{version }-%{release }
367374Requires(pre): /usr/sbin/useradd
368375Requires: 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}
369380Requires: crypto-policies >= 20220824-1
381+ %endif
370382%{?systemd_requires }
371383
372384%package keycat
@@ -641,9 +653,18 @@ install -d $RPM_BUILD_ROOT%{_libexecdir}/openssh
641653install -m644 %{SOURCE2 } $RPM_BUILD_ROOT/etc/pam.d/sshd
642654install -m644 %{SOURCE6 } $RPM_BUILD_ROOT/etc/pam.d/ssh-keycat
643655install -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}
644658install -m644 ssh_config_redhat $RPM_BUILD_ROOT%{_sysconfdir }/ssh/ssh_config.d/50-redhat.conf
645659install -m644 sshd_config_redhat_cp $RPM_BUILD_ROOT%{_sysconfdir }/ssh/sshd_config.d/40-redhat-crypto-policies.conf
646660install -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
647668install -d -m755 $RPM_BUILD_ROOT/%{_unitdir }
648669install -m644 %{SOURCE9 } $RPM_BUILD_ROOT/%{_unitdir }/sshd@.service
649670install -m644 %{SOURCE10 } $RPM_BUILD_ROOT/%{_unitdir }/sshd.socket
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
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
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