Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2020670

Summary: The sshd* rules talk about editing /etc/ssh/sshd_config when they in fact add stuff to /etc/ssh/sshd_config.d/00-complianceascode-hardening.conf or don't do anything
Product: Red Hat Enterprise Linux 9 Reporter: Jan Pazdziora (Red Hat) <jpazdziora>
Component: scap-security-guideAssignee: Watson Yuuma Sato <wsato>
Status: CLOSED ERRATA QA Contact: Milan Lysonek <mlysonek>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: ggasparb, jpazdziora, matyc, mhaicman, mlysonek, vpolasek
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: scap-security-guide-0.1.60-2.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-17 13:53:40 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 Jan Pazdziora (Red Hat) 2021-11-05 14:56:40 UTC
Description of problem:

The sshd* rules in OSPP profile like sshd_enable_warning_banner talk in description about the configuration to be added to /etc/ssh/sshd_config. However, the OVAL checks and especially the remediation work with /etc/ssh/sshd_config.d/00-complianceascode-hardening.conf, or due to the use of missing_parameter_pass: 'true' in rule.yml, no configuration is done.

So when remediation is run and reports fixed, checking the content of the configuration manually based on the description does not find the configuration there.

Also, the use of single 00-complianceascode-hardening.conf file for multiple rules seems weird.

Version-Release number of selected component (if applicable):

scap-security-guide-0.1.57-5.el9.noarch

How reproducible:

Deterministic.

Steps to Reproduce:
1. Make a backup of /etc/ssh:
   cp -rp /etc/ssh /etc/ssh.orig
2. Run oscap xccdf eval --remediate --profile xccdf_org.ssgproject.content_profile_ospp --report report.html /usr/share/xml/scap/ssg/content/ssg-rhel9-ds.xml
3. Open report.html in browser.
4. Click "Show all result details"
5. Search for "content_rule_sshd_" in the page and for each of those rules, read the description and check on disk (diff files /etc/ssh against /etc/ssh.orig) what was configured and where.

Actual results:

xccdf_org.ssgproject.content_rule_sshd_disable_empty_passwords:
Description talks only about configuring in /etc/ssh/sshd_config.
But no change is done due to missing_parameter_pass: 'true'.

xccdf_org.ssgproject.content_rule_sshd_disable_gssapi_auth:
Description talks only about configuring in /etc/ssh/sshd_config.
After remediation, /etc/ssh/sshd_config.d/50-redhat.conf still has GSSAPIAuthentication yes and no other configuration is done.

xccdf_org.ssgproject.content_rule_sshd_disable_kerb_auth:
Description talks only about configuring in /etc/ssh/sshd_config.
But no change is done due to missing_parameter_pass: 'true'.

xccdf_org.ssgproject.content_rule_sshd_disable_root_login:
Description talks only about configuring in /etc/ssh/sshd_config.
Actual configuration done in /etc/ssh/sshd_config.d/00-complianceascode-hardening.conf.

xccdf_org.ssgproject.content_rule_sshd_enable_strictmodes:
Description talks only about configuring in /etc/ssh/sshd_config.
But no change is done due to missing_parameter_pass: 'true'.

xccdf_org.ssgproject.content_rule_sshd_enable_warning_banner:
Description talks only about configuring in /etc/ssh/sshd_config.
Actual configuration done in /etc/ssh/sshd_config.d/00-complianceascode-hardening.conf.

xccdf_org.ssgproject.content_rule_sshd_rekey_limit:
Description talks only about configuring in /etc/ssh/sshd_config.
Configuration done in /etc/ssh/sshd_config, so this one matches -- yay!

xccdf_org.ssgproject.content_rule_sshd_use_directory_configuration:
Description talks only about configuring in /etc/ssh/sshd_config.
Configuration stays in /etc/ssh/sshd_config, so this one matches -- yay!

xccdf_org.ssgproject.content_rule_sshd_disable_empty_passwords:
Description talks only about configuring in /etc/ssh/sshd_config.
But no change is done due to missing_parameter_pass: 'true'.

Expected results:

If the config change will be done in /etc/ssh/sshd_config.d/00-complianceascode-hardening.conf, the description should say so.

If the config change will not be done (because the defaults are sufficient), the description should say so.

Additional info:

I actually like the missing_parameter_pass: 'true' and using the defaults. But then, the description should be updated to make it clear that not having that configuration anywhere is acceptable too since the compiled-in defaults take care of the problem.

I have concerns about using single 00-complianceascode-hardening.conf as a dumping place for all changes. This is not how drop-in snippets are supposed to work. Shouldn't each rule put their config line to separate file?

After all, for ssh client, /etc/ssh/ssh_config.d/02-rekey-limit.conf gets created for ssh_client_rekey_limit rule, so why don't sshd rules do the same?

Comment 3 Jan Pazdziora (Red Hat) 2021-11-08 10:46:12 UTC
(In reply to Vojtech Polasek from comment #2)

> WRT to the fact that everything is placed in one file... I believe that it
> could be possible to change this behavior and have one configuration file
> per rule. However, the benefit of this approach is still not clear to me.
> Better user experience?

The benefit is the better visibility and maintainability, as well as the possibility of having different levels of configuration (vendor, organization, deployment (prod/stage/devel)) that can all be configured at the same time and by using predictable order, the more specific configuration can override the more general one. For scanning tools like OpenSCAP, the benefit is stricter and hopefully easier to check rules "this exact file has to have this exact content", rather than checking for lines in files, dealing with order of those lines, etc.

And last but not least,

  https://github.com/ComplianceAsCode/content/blob/master/linux_os/guide/services/ssh/ssh_server/sshd_use_directory_configuration/rule.yml

says to

  distribute the service configuration to several files in the <tt>/etc/ssh/sshd_config.d</tt> directory.

so that rule itself assumes there will be multiple files there.

Comment 4 Watson Yuuma Sato 2021-12-01 14:05:58 UTC
https://github.com/ComplianceAsCode/content/pull/7919

Comment 9 Watson Yuuma Sato 2022-02-10 13:37:00 UTC
https://github.com/ComplianceAsCode/content/pull/8148

Comment 21 errata-xmlrpc 2022-05-17 13:53:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (new packages: scap-security-guide), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:2610