diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/ansible/shared.yml b/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/ansible/shared.yml new file mode 100644 index 00000000000..a64f731f32e --- /dev/null +++ b/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/ansible/shared.yml @@ -0,0 +1,7 @@ +# platform = multi_platform_all +# reboot = false +# strategy = restrict +# complexity = low +# disruption = low + +{{{ ansible_sshd_remediation(parameter="GSSAPIAuthentication", value="no", config_is_distributed=false) }}} diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/bash/shared.sh b/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/bash/shared.sh new file mode 100644 index 00000000000..1dd8ad398d8 --- /dev/null +++ b/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/bash/shared.sh @@ -0,0 +1,7 @@ +# platform = multi_platform_all +# reboot = false +# strategy = restrict +# complexity = low +# disruption = low + +{{{ bash_sshd_remediation(parameter="GSSAPIAuthentication", value="no", config_is_distributed="false") }}} diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/kubernetes/shared.yml b/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/kubernetes/shared.yml new file mode 100644 index 00000000000..bedec14667b --- /dev/null +++ b/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/kubernetes/shared.yml @@ -0,0 +1,15 @@ +# platform = multi_platform_ocp,multi_platform_rhcos +# reboot = false +# strategy = restrict +# complexity = low +# disruption = low + +# Remove any old dropin configs that may have been created +{{{ kubernetes_sshd_remove_dropin('00-complianceascode-GSSAPIAuthentication.conf') }}} +--- +{{{ kubernetes_sshd_remove_dropin('01-complianceascode-reinforce-os-defaults.conf') }}} +--- +{{{ kubernetes_sshd_remove_dropin('75-complianceascode-sshd_disable_gssapi_auth.conf') }}} +--- +# Modify the main sshd_config file directly (no version restriction) +{{{ kubernetes_sshd_set(ocp_version_range='') }}} diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/oval/shared.xml b/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/oval/shared.xml new file mode 100644 index 00000000000..f6a45c27bee --- /dev/null +++ b/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/oval/shared.xml @@ -0,0 +1,68 @@ + + + + Disable GSSAPI Authentication + + multi_platform_all + + Ensure 'GSSAPIAuthentication' is configured with value 'no' in /etc/ssh/sshd_config + + + + + {{% if product == "sle12" %}} + + {{% else %}} + + {{% endif %}} + + + + {{% if product == "sle12" %}} + + {{% else %}} + + {{% endif %}} + + + + + + + + + + + + + + + + + + /etc/ssh/sshd_config + ^[ \t]*(?i)GSSAPIAuthentication(?-i)[ \t]+(.+?)[ \t]*(?:$|#) + 1 + + + + ^no$ + + + + + + + + diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/rule.yml b/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/rule.yml index 355b98ed75c..8d5197bec9a 100644 --- a/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/rule.yml +++ b/linux_os/guide/services/ssh/ssh_server/sshd_disable_gssapi_auth/rule.yml @@ -47,11 +47,3 @@ fixtext: |- {{{ fixtext_sshd_lineinfile("GSSAPIAuthentication", "no") }}} srg_requirement: 'The {{{ full_name }}} SSH daemon must not allow GSSAPI authentication, except to fulfill documented and validated mission requirements.' - -template: - name: sshd_lineinfile - vars: - parameter: GSSAPIAuthentication - value: 'no' - datatype: string - is_default_value: 'true' diff --git a/shared/macros/10-kubernetes.jinja b/shared/macros/10-kubernetes.jinja index 15a7eea1529..c0a111e5f0d 100644 --- a/shared/macros/10-kubernetes.jinja +++ b/shared/macros/10-kubernetes.jinja @@ -248,6 +248,34 @@ spec: {{{ kubernetes_machine_config_file(path='/etc/ssh/sshd_config.d/' + config_basename, file_permissions_mode='0600', source=sshd_dropin_content, ocp_version_range=ocp_version_range) }}} {{%- endmacro -%}} +{{# + High level macro to generate Kubernetes remediation to remove SSH daemon configuration drop-in files. + This is used to clean up old or incorrectly named drop-in files. + Parameters: + config_basename: Basename of the drop-in file to remove (e.g., '00-complianceascode-GSSAPIAuthentication.conf') + ocp_version_range: Optional OpenShift version range (default: '>=4.13.0') +#}} +{{%- macro kubernetes_sshd_remove_dropin(config_basename, ocp_version_range='>=4.13.0') -%}} +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +{{%- if ocp_version_range|length > 0 %}} +metadata: + annotations: + complianceascode.io/ocp-version: '{{{ ocp_version_range }}}' +{{%- endif %}} +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - path: /etc/ssh/sshd_config.d/{{{ config_basename }}} + overwrite: true + contents: + source: data:, + mode: 0600 +{{%- endmacro -%}} + {{% macro usbguard_config_source() %}} #