On This Page
RHEL 8 SSH Hardening Guide
Description
Hardening the configuration of the SSH server is an important step in hardening your server.
RHEL 8 uses the system-wide crypto-policies framework to control SSH cryptographic algorithms. See Notes.
Relevant to
- RHEL 8.x - all versions
Prerequisites
-
TOS must be installed on the server prior to implementing this resolution.
-
Root or sudo access to the operating system.
Notes
Changes made directly to the following parameters in /etc/ssh/sshd_config may not be reflected in the algorithms advertised by the SSH daemon:
-
Ciphers
-
MACs
-
KexAlgorithms
-
HostKeyAlgorithms
The active OpenSSH server crypto-policy configuration can be viewed in: /etc/crypto-policies/back-ends/opensshserver.config.
Administrators should verify the effective SSH configuration after making cryptographic changes and confirm the advertised algorithms using standard OpenSSH diagnostic tools.
You will need to restart the sshd service after making the recommended changes. The service restart is included in the resolution steps below.
Resolution
-
Edit the file
/etc/ssh/sshd_config, and set the fields listed below to the values listed. You may have to delete the comment character ('#') from some entries.X11Forwarding no
Banner /etc/banner
ClientAliveInterval 3600
ClientAliveCountMax 0
AllowAgentForwarding no
AllowTcpForwarding no -
Remove deprecated SHA-1 SSH algorithms.
-
Restart the sshd service
-
Verify the resulting SSH algorithm set using standard OpenSSH diagnostic tools.
-
If required, restore the default RHEL crypto policy, and then restart the sshd service.
We recommend installing all official security updates and security patches for your RHEL 8 version.