Linux security hardening checklist

29/12/2020
This tutorial enumerates initial security measures both for desktop users and sysadmins managing servers. The tutorial specifies when a recommendation aims to home or professional users. Despite there is not deep explanation or instructions to apply each item at the end of each you’ll find useful links with tutorials.

Policy Home user Server
Disable SSH x
Disable SSH root access x
Change SSH port x
Disable SSH password login x
Iptables
IDS (Intrusion Detection System) x
BIOS Security
Disk Encryption x/✔
System update
VPN (Virtual Private Network) x
Enable SELinux
Common Practices

SSH Access

Home users:

Home users do not really use ssh, dynamic IP addresses and router NAT configurations made alternatives with reverse connection like TeamViewer more attractive. When a service is unused the port must be closed both by disabling or removing the service and by applying restrictive firewall rules.

Servers:
Contrary to domestic users workers accessing different servers, network administrators are frequent ssh/sftp users. If you must keep your ssh service enabled you can take the following measures:

  • Disable root access through SSH.
  • Disable password login.
  • Change the SSH port.

Common SSH Configuration Options Ubuntu

Iptables

Iptables is the interface to manage netfilter to define firewall rules. Home users may trend to UFW (Uncomplicated Firewall) which is a frontend for iptables to make firewall rules creation easy. Independent of the interface the point is immediately after the setup the firewall is among the first changes to apply. Depending on your desktop or server needs the most recommended for security concerns are restrictive policies allowing only what you need while blocking the rest. Iptables will be used to redirect the SSH port 22 to a different one, to block unnecessary ports, filter services and set rules for known attacks.

For more information on iptables check: Iptables for beginners

Intrusion Detection System (IDS)

Due the high resources they require IDS are not used by home users but they are a must on servers exposed to attacks. IDS brings the security to the next level allowing to analyze packets. Most known IDS are Snort and OSSEC, both previously explained at LinuxHint. IDS analyzes traffic over the network looking for malicious packets or anomalies, it is a network monitoring tool oriented to security incidents. For instructions on installation and configuration for the most 2 popular IDS solutions check: Configure Snort IDS and Create Rules

Getting started with OSSEC (Intrusion Detection System)

BIOS Security

Rootkits, malwares and server BIOS with remote access represent additional vulnerabilities for servers and desktops. The BIOS can be hacked through code executed from the OS or through update channels to get unauthorized access or forget information like security backups.

Keep BIOS update mechanisms updated. Enable BIOS Integrity Protection.

Understanding the Boot process — BIOS vs UEFI

Hard disk Encryption

This is a measure more relevant to Desktop users who may lose their computer, or be theft victim, it is especially useful for laptop users. Today almost every OS supports Disk and partition encryption, distributions like Debian allow to encrypt the hard disk during the installation process. For instructions on disk encryption check: How to Encrypt a Drive on Ubuntu 18.04

System update

Both desktop users and sysadmin must keep the system up to date to prevent vulnerable versions from offering unauthorized access or execution.  Additionally to using the OS provided package manager to check for available updates running vulnerability scans may help to detect vulnerable software which wasn’t updated on official repositories or vulnerable code which needs to be rewritten. Below some tutorials on updates:

VPN (Virtual Private Network)

Internet users must be aware that ISPs monitor all their traffic and the only way to afford this is using a VPN service. The ISP is able to monitor the traffic to the VPN server but not from the VPN to destinations. Due speed issues paid services are the most recommendable, but there are free good alternatives like https://protonvpn.com/.

Enable SELinux (Security-Enhanced Linux)

SELinux is a set of the Linux Kernel modifications focused on managing security aspects related to security policies by adding MAC (Mechanism Access Control), RBAC (Role Based Access Control), MLS (Multi Level Security) and Multi Category Security (MCS).  When SELinux is enabled an application can only access the resources it needs specified on a security policy for the application. Access to ports, processes, files and directories are controlled through rules defined on SELinux which allows or denies operations based on the security  policies. Ubuntu uses AppArmor as alternative.

Common Practices

Almost always security failures are due to user negligence. Additionally to all points numerated previously follow the next practices:

  • Do not use root unless necessary.
  • Never use X Windows or browsers as root.
  • Use password managers like LastPass.
  • Use strong and unique passwords only.
  • Try no to install non-free packages or packages unavailable at official repositories.
  • Disable unused modules.
  • On servers enforce strong passwords and prevent users from using old passwords.
  • Uninstall unused software.
  • Don’t use same passwords for different accesses.
  • Change all default access usernames.
Policy Home user Server
Disable SSH x
Disable SSH root access x
Change SSH port x
Disable SSH password login x
Iptables
IDS (Intrusion Detection System) x
BIOS Security
Disk Encryption x/✔
System update
VPN (Virtual Private Network) x
Enable SELinux
Common Practices

I hope you found this article useful to increase your security. Keep following LinuxHint for more tips and updates on Linux and networking.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Getting started with OSSEC (Intrusion Detection System)

OSSEC markets itself as the world’s most widely used Intrusion Detection System. An Intrusion Detection System (commonly...
29/12/2020

Managing sudo privileges on Linux

sudo is a command which grants superuser privileges to non root users. Using sudo is a practice for safety purposes, by...
29/12/2020

Book Review: Mastering Linux Security and Hardening

Written by: By Donald A. Tevault, and published by Packt Publishing. Secure your Linux server and protect it from intruders,...
29/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024

Mua proxy Onet uy tín tại Onet.com.vn
03/06/2024

Thuê mua IPv4 giá rẻ, tốc độ nhanh, uy tín #1
28/05/2024

Thuê địa chỉ IPv4 IPv6 trọn gói ở đâu chất lượng, giá RẺ nhất?
27/05/2024