Skip to content

Sle16 sshd lineinfile related fixes#14458

Open
teacup-on-rockingchair wants to merge 9 commits intoComplianceAsCode:masterfrom
teacup-on-rockingchair:sle16_sshd_lineinfile_fixes
Open

Sle16 sshd lineinfile related fixes#14458
teacup-on-rockingchair wants to merge 9 commits intoComplianceAsCode:masterfrom
teacup-on-rockingchair:sle16_sshd_lineinfile_fixes

Conversation

@teacup-on-rockingchair
Copy link
Contributor

Description:

  • Make sure oval checks and remediations cover the case where default sshd config is in /usr subdir in rules
    • sshd_use_strong_kex
    • sshd_set_idle_timeout
    • sshd_limit_user_access
    • sshd_set_login_grace_time
    • sshd_set_max_auth_tries
    • sshd_set_max_sessions
    • sshd_set_maxstartups
  • Added tests to cover the new functionality

Rationale:

General rule for all SSH server configuration changes

  • if /etc/ssh/sshd_config exists: check /etc/ssh/sshd_config, /etc/ssh/sshd_config.d/*.conf, /usr/etc/ssh/sshd_config.d/*.conf
  • if /etc/ssh/sshd_config does not exists: check /usr/etc/ssh/sshd_config, /etc/ssh/sshd_config.d/*.conf, /usr/etc/ssh/sshd_config.d/*.conf

Regarding remedations

  • remediations copy /usr/etc/ssh/sshd_config to /etc/ssh/sshd_config(if /etc/ssh/sshd_config does not exist),
    configs are added to /etc/ssh/sshd_config.d/*.conf(1st Include in sshd_config)

…shd config is in /usr subdir

Add macros for ansible, bash and oval to check and set sshd config parameters for case where config can be both in /usr and /etc
…nd subfolders for sshd_set_idle_timeout rule
…nd subfolders for sshd_set_login_grace_time rule
…nd subfolders for sshd_set_max_auth_tries rule
…nd subfolders for sshd_set_max_sessions rule
@teacup-on-rockingchair teacup-on-rockingchair added Ansible Ansible remediation update. OVAL OVAL update. Related to the systems assessments. labels Feb 26, 2026
@teacup-on-rockingchair teacup-on-rockingchair added the Bash Bash remediation update. label Feb 26, 2026
@teacup-on-rockingchair teacup-on-rockingchair added the SLES SUSE Linux Enterprise Server product related. label Feb 26, 2026
@teacup-on-rockingchair teacup-on-rockingchair added the Update Template Issues or pull requests related to Templates updates. label Feb 26, 2026
@teacup-on-rockingchair teacup-on-rockingchair added this to the 0.1.81 milestone Feb 26, 2026
@github-actions
Copy link

This datastream diff is auto generated by the check Compare DS/Generate Diff

Click here to see the full diff
bash remediation for rule 'xccdf_org.ssgproject.content_rule_sshd_set_keepalive' differs.
--- xccdf_org.ssgproject.content_rule_sshd_set_keepalive
+++ xccdf_org.ssgproject.content_rule_sshd_set_keepalive
@@ -2,7 +2,6 @@
 if rpm --quiet -q kernel-core; then
 
 var_sshd_set_keepalive=''
-
 
 if [ -e "/etc/ssh/sshd_config" ] ; then
     

bash remediation for rule 'xccdf_org.ssgproject.content_rule_sshd_set_idle_timeout' differs.
--- xccdf_org.ssgproject.content_rule_sshd_set_idle_timeout
+++ xccdf_org.ssgproject.content_rule_sshd_set_idle_timeout
@@ -2,7 +2,6 @@
 if rpm --quiet -q kernel-core; then
 
 sshd_idle_timeout_value=''
-
 
 if [ -e "/etc/ssh/sshd_config" ] ; then
     

bash remediation for rule 'xccdf_org.ssgproject.content_rule_sshd_disable_compression' differs.
--- xccdf_org.ssgproject.content_rule_sshd_disable_compression
+++ xccdf_org.ssgproject.content_rule_sshd_disable_compression
@@ -2,7 +2,6 @@
 if rpm --quiet -q kernel-core; then
 
 var_sshd_disable_compression=''
-
 
 if [ -e "/etc/ssh/sshd_config" ] ; then
     

bash remediation for rule 'xccdf_org.ssgproject.content_rule_sshd_set_login_grace_time' differs.
--- xccdf_org.ssgproject.content_rule_sshd_set_login_grace_time
+++ xccdf_org.ssgproject.content_rule_sshd_set_login_grace_time
@@ -2,7 +2,6 @@
 if rpm --quiet -q kernel-core; then
 
 var_sshd_set_login_grace_time=''
-
 
 if [ -e "/etc/ssh/sshd_config" ] ; then
     

bash remediation for rule 'xccdf_org.ssgproject.content_rule_sshd_set_max_auth_tries' differs.
--- xccdf_org.ssgproject.content_rule_sshd_set_max_auth_tries
+++ xccdf_org.ssgproject.content_rule_sshd_set_max_auth_tries
@@ -2,7 +2,6 @@
 if rpm --quiet -q kernel-core; then
 
 sshd_max_auth_tries_value=''
-
 
 if [ -e "/etc/ssh/sshd_config" ] ; then
     

bash remediation for rule 'xccdf_org.ssgproject.content_rule_sshd_set_max_sessions' differs.
--- xccdf_org.ssgproject.content_rule_sshd_set_max_sessions
+++ xccdf_org.ssgproject.content_rule_sshd_set_max_sessions
@@ -2,7 +2,6 @@
 if rpm --quiet -q kernel-core; then
 
 var_sshd_max_sessions=''
-
 
 if [ -e "/etc/ssh/sshd_config" ] ; then
     

bash remediation for rule 'xccdf_org.ssgproject.content_rule_sshd_set_maxstartups' differs.
--- xccdf_org.ssgproject.content_rule_sshd_set_maxstartups
+++ xccdf_org.ssgproject.content_rule_sshd_set_maxstartups
@@ -2,7 +2,6 @@
 if rpm --quiet -q kernel-core; then
 
 var_sshd_set_maxstartups=''
-
 
 if [ -e "/etc/ssh/sshd_config" ] ; then
     

bash remediation for rule 'xccdf_org.ssgproject.content_rule_sshd_use_priv_separation' differs.
--- xccdf_org.ssgproject.content_rule_sshd_use_priv_separation
+++ xccdf_org.ssgproject.content_rule_sshd_use_priv_separation
@@ -2,7 +2,6 @@
 if rpm --quiet -q kernel-core && { ( rpm --quiet -q openssh-server && { real="$(epoch=$(rpm -q --queryformat '%{EPOCH}' openssh-server); version=$(rpm -q --queryformat '%{VERSION}' openssh-server); [ "$epoch" = "(none)" ] && echo "0:$version" || echo "$epoch:$version")"; expected="0:7.5"; [[ "$real" != "$expected" ]] && printf "%s\n%s" "$real" "$expected" | sort -VC; } ); }; then
 
 var_sshd_priv_separation=''
-
 
 if [ -e "/etc/ssh/sshd_config" ] ; then
     

bash remediation for rule 'xccdf_org.ssgproject.content_rule_sshd_use_strong_kex' differs.
--- xccdf_org.ssgproject.content_rule_sshd_use_strong_kex
+++ xccdf_org.ssgproject.content_rule_sshd_use_strong_kex
@@ -2,8 +2,6 @@
 if rpm --quiet -q kernel-core; then
 
 sshd_strong_kex=''
-
-
 
 if [ -e "/etc/ssh/sshd_config" ] ; then
     

@svet-se svet-se self-assigned this Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ansible Ansible remediation update. Bash Bash remediation update. OVAL OVAL update. Related to the systems assessments. SLES SUSE Linux Enterprise Server product related. Update Template Issues or pull requests related to Templates updates.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants