SSH-7408 - SSH configuration

(SSH)

This information is provided as part of the Lynis community project. It is related to Lynis control SSH-7408 and should be considered as-is and without guarantees. Any advice and commands should be tested before implementing them in production environments.

Description

Proper hardening of your SSH configuration can reduce known weaknesses

How to solve

The secure shell, or SSH, is one of the most used services. Nearly all machines have a SSH daemon running, to allow system administrators connect and manage the system. SSH is not limited to interactive system administration via the shell. Things like backups, remote configuration, and data transfers are common other uses as well.

Since SSH has an important function on the system, and firewalls are often opened up to allow traffic, proper hardening of the service is needed. Lynis checks for several key options and helps to avoid weak configurations. With every system having a different role, the right combination of settings needs to be configured.

Harden your SSH configuration with the specified configuration option listed in the Lynis output. Consult the SSH documentation for the meaning of each option, and select the best possible option for your system. Where possible choose the most strict option, to increase your security defenses.

The specific configuration settings to harden are listed in the log file (/var/log/lynis.log) and your report file (/var/log/lynis-report.dat).

Notes

TCP forwarding

A note from the SSH man page: Note that disabling TCP forwarding does not improve security unless users are also denied shell access, as they can always install their own forwarders.

Additional resources

Need more details?

Consider an upgrade to Lynis Enterprise to receive more guidance. The Enterprise version helps to you with daily health checks of your environment, learn in-depth system hardening, and resources to protect your systems better.

See demo

About

Lynis is a technical security auditing tool for Unix flavors like Linux, macOS, AIX, Solaris, and *BSD. It is open source software and free to use. Typical usage include system hardening, compliance testing, and vulnerability scanning. The project has an active community, including development via GitHub.

Lynis Enterprise

Do you need to collect data from multiple systems or compliance reporting? Lynis Enterprise uses Lynis to collect the data and make your work easier.

Benefits: automate security audits, detailed reporting, compliance testing.

  • Centralized management
  • Improvement plan with priorities
  • Reporting
  • Dashboards
  • Predefined policies
  • Integration (API)
  • Improvement snippets for tools like Ansible, Chef, Cfengine, Puppet, and SaltStack
Take the Tour