Overall, the Linux operating system is very secure, but the applications, tools, and configurations administrators install create risks to the environment. Linux powers 75% of the internet, and it’s installed on 6.64 million web servers. Because Linux powers critical systems around the globe, it’s imperative that administrators take the necessary steps to harden the operating system’s security. Although Linux is inherently secure, several configurations and strategies help harden its defenses and reduce the risk of a compromise. This article goes over the following questions:
Linux security is important because Linux is so popular with web servers, attackers write custom scripts targeting the operating system to scan for known vulnerabilities and exploit them. For example, web server response headers return critical information about the host, including the server operating system, unless administrators follow the OWASP suggestion to hide this information.
With the Linux distribution and version in hand, attackers can then launch targeted attacks against a web server. If the Linux version has known vulnerabilities, an attacker can either download pre-made scripts or craft an exploit of their own. In other words, a combination of returning information about the Linux version running on the server and running outdated software leaves the web server open to exploits. Kernel vulnerabilities are serious threats to the stability of the web, and they can have critical consequences. Vulnerabilities such as Dirty Cow and SACK Panic gave attackers elevated privileges or a denial-of-service (DoS), and these issues were just two examples that could lead to critical data breaches or downtime.
Kernel vulnerabilities aren’t the only source of vulnerabilities. Third-party applications also introduce vulnerabilities and give attackers the opportunity to steal data. Heartbleed was discovered in 2014 and continues to be a problem for older unpatched Linux-based servers allowing threat actors to steal data in a buffer underflow exploit. The vulnerability was found in several older versions of OpenSSL, commonly used as an encryption library on Linux servers.
With numerous vulnerabilities open to attackers, it’s critical for administrators to be aware of their attack surface and the risks involved with default settings on Linux and any third-party applications that could cause issues. You can’t decrease risk by 100%, but you can take the right precautions and perform hardening on the operating system regardless of the distribution installed.
Generate cryptographic keys and upload them to your server using the following commands:
$ ssh-keygen -t rsa
$ ssh-copy-id <username>@ip_address
Using cryptographic keys instead of passwords makes it harder for a threat actor to use brute-force attacks on credentials.
After you generate and upload cryptographic keys, you can disable password authentication in the /etc/ssh/sshd_config file. The following two directives should be configured to “no” in the configuration file:
PasswordAuthentication no
PermitRootLogin no
# chmod 000 /media/
Note: This does not fully secure a system when the attacker has physical access to it.
$ sudo apt install ufw
After you install the firewall, use the following command to enable it:
$ sudo ufw enable
You can see the services enabled and running your server by using the following command:
$ sudo ufw status
The Linux operating system is secure, but the installation process configures it with default settings. Attackers are aware of each distribution’s default settings, and some settings make the server vulnerable to exploits. For example, the default settings for SSH weaken security on the system, which is why it’s important to harden security on a server that runs SSH.
With the default configurations in place, attackers know exactly how your server is set up and runs. The harder you make it for attackers to figure out how a server is configured, the more layers of security you add to your environment. Another example is disabling or reducing root privileges. Attackers target the root user account since it’s the well-known highest privileged user. When it’s reconfigured, you put a wrench in their works and force them to discover the alternative account.
Hardening the operating system is important for the security of your server and safeguarding user data. To stay ahead of attackers, configure Linux with custom configurations that make it more difficult for attackers to scan the system and exploit common vulnerabilities to add layers of security to your server. You can’t ensure 100% security on any system, but hardening the operating system greatly reduces risks associated with cyber-attacks. Learn how to take advantage of Linux server security with Imunify360 and discover how it is different from other security tools.