AlmaLinux OS 9 SSH server must be configured to use only Message Authentication Codes (MACs) employing FIPS 140-3 validated cryptographic hash algorithms.

STIG ID: ALMA-09-003540  |  SRG: SRG-OS-000250-GPOS-00093 |  Severity: medium |  CCI: CCI-001453 |  Vulnerability Id: V-269119

Vulnerability Discussion

Without cryptographic integrity protections, information can be altered by unauthorized users without detection.

Remote access (e.g., RDP) is access to DOD nonpublic information systems by an authorized user (or an information system) communicating through an external, nonorganization-controlled network. Remote access methods include, for example, dial-up, broadband, and wireless.

Cryptographic mechanisms used for protecting the integrity of information include, for example, signed hash functions using asymmetric cryptography enabling distribution of the public key to verify the hash information while maintaining the confidentiality of the secret key used to generate the hash.

AlmaLinux OS 9 incorporates systemwide crypto policies by default. The SSH configuration file has no effect on the ciphers, MACs, or algorithms unless specifically defined in the /etc/sysconfig/sshd file. The employed algorithms can be viewed in the /etc/crypto-policies/back-ends/opensshserver.config file.

Check

Verify the SSH server is configured to use only MACs employing FIPS 140-3 approved algorithms with the following command:

First, ensure that FIPS mode is enabled with the following command:

$ cat /proc/sys/crypto/fips_enabled
1

If the command does not return a "1", then the systemwide crypto policy is not set to FIPS, and this is a finding.

To verify the MACs in the systemwide SSH configuration file, use the following command:

$ sudo grep -i macs /etc/crypto-policies/back-ends/opensshserver.config
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512,hmac-sha2-256

If the MACs entries in the "opensshserver.config" file have any hashes other than "hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512,hmac-sha2-256", the order differs from the example above, or they are missing or commented out, this is a finding.

Fix

Configure the AlmaLinux OS 9 SSH server to use only MACs employing FIPS 140-3 approved algorithms by updating the "/etc/crypto-policies/back-ends/opensshserver.config" file with the following commands:

Note: Before enabling FIPS mode, ensure that the dracut-fips package is installed on the system.

Enable FIPS mode by updating the system's crypto policy with the following command:
$ sudo update-crypto-policies --set FIPS

Note: If FIPS mode has never been enabled on the system, additional steps will need to be conducted. Refer to vendor documentation.

To manually update the MACs in the systemwide SSH configuration, use the following command:
$ sudo sed -i -E '/^MACs/s/.*/MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512,hmac-sha2-256/' "$(readlink -f /etc/crypto-policies/back-ends/opensshserver.config)"

A reboot is required for the changes to take effect.