Bug 2145026

Summary: 'Include /etc/ssh/sshd_config.d/*.conf' in /etc/ssh/sshd_config subjected to accidential removals
Product: Red Hat Enterprise Linux 9 Reporter: Robert Scheck <redhat-bugzilla>
Component: opensshAssignee: Dmitry Belyavskiy <dbelyavs>
Status: CLOSED NOTABUG QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.1CC: asosedki, jjelen, ravpatil, robert.scheck
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-29 14:06:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Robert Scheck 2022-11-22 23:48:31 UTC
Description of problem:
As of writing, the configuration file /etc/ssh/sshd_config contains the line 'Include /etc/ssh/sshd_config.d/*.conf' due to the patch https://gitlab.com/redhat/centos-stream/rpms/openssh/-/blob/c9s/openssh-7.7p1-redhat.patch. While I personally enjoy the possibilities of /etc/ssh/sshd_config.d/*.conf, this configuration option is, at least from my point of view, subjected to accidential removals (e.g. by reusing an old ansible playbook or role, which does not (yet) contain the Include option) - and practically nobody will notice the absence, except until you maybe start wondering during a security review why /etc/crypto-policies/back-ends/opensshserver.config doesn't get applied applied (or other settings in /etc/ssh/sshd_config.d/*.conf.

Version-Release number of selected component (if applicable):
openssh-8.7p1-24.el9

How reproducible:
Silently remove 'Include /etc/ssh/sshd_config.d/*.conf' from /etc/ssh/sshd_config (and wait until somebody else notices the consequences).

Actual results:
'Include /etc/ssh/sshd_config.d/*.conf' in /etc/ssh/sshd_config subjected to accidential removals.

Expected results:
Turn 'Include /etc/ssh/sshd_config.d/*.conf' from configuration file into C code (the directory likely needs to be configurable via a ./configure option) that is built-in directly into the OpenSSH binary.

Additional info:
Indeed, normally the 'Include /etc/ssh/sshd_config.d/*.conf' line shouldn't be absent and administrators need to pay attention, however I personally treat it as risky, because it might disable the crypto-policies completely, and most likely nobody will notice this absence.

Comment 1 Robert Scheck 2022-11-23 10:15:40 UTC
Cross-filed case #03368892 at the Red Hat customer portal.

Comment 2 Dmitry Belyavskiy 2022-11-29 14:06:23 UTC
It doesn't look like a OpenSSH bug to me. Yes, accidental change of the config may cause problems, but I don't see how to prevent it.

Comment 3 Robert Scheck 2022-11-29 19:34:40 UTC
Yes, it isn't an OpenSSH upstream bug, it's IMHO an issue caused by packaging on Red Hat side as a downstream. Instead of leveraging the 'Include' directive, a more nice but especially robust upstream solution could have been created by implementing something like a hardcoded include directly in the OpenSSH ELF binaries (as already mentioned in the last paragraph of my initial description).

Comment 7 Alexander Sosedkin 2023-02-07 18:32:41 UTC
Opting out of crypto-policies is a supported scenario, described in, say
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/security_hardening/using-the-system-wide-cryptographic-policies_security-hardening
Going for a hardcoded include would go against that,
or at the very least, make the procedure more complicated than it should be.

IMO, in general, making software hard to misconfigure is a rather futule goal.
And when performed downstream-only,
it becomes an extra source of confusion and frustration.
A distribution is supposed to configure OpenSSH
by leveraging the existing configuration facilities,
not hardcoding secret downstream ones with unclear interplay with the upstream ones.