Book Image

Practical Linux Security Cookbook - Second Edition

By : Tajinder Kalsi
Book Image

Practical Linux Security Cookbook - Second Edition

By: Tajinder Kalsi

Overview of this book

Over the last few years, system security has gained a lot of momentum and software professionals are focusing heavily on it. Linux is often treated as a highly secure operating system. However, the reality is that Linux has its share of security ?aws, and these security ?aws allow attackers to get into your system and modify or even destroy your important data. But there’s no need to panic, since there are various mechanisms by which these ?aws can be removed, and this book will help you learn about different types of Linux security to create a more secure Linux system. With a step-by-step recipe approach, the book starts by introducing you to various threats to Linux systems. Then, this book will walk you through customizing the Linux kernel and securing local files. Next, you will move on to managing user authentication both locally and remotely and mitigating network attacks. Later, you will learn about application security and kernel vulnerabilities. You will also learn about patching Bash vulnerability, packet filtering, handling incidents, and monitoring system logs. Finally, you will learn about auditing using system services and performing vulnerability scanning on Linux. By the end of this book, you will be able to secure your Linux systems and create a robust environment.
Table of Contents (20 chapters)
Title Page
Copyright and Credits
Contributors
Packt Upsell
Preface
Index

Defining security controls


Securing a Linux server starts with the process of hardening the system, and to do this it's important to define a list of security controls. A security controls list (or security checklist) confirms that proper security controls have been implemented.

How to do it...

Let's have a look at various security control checklists.

Installation

Now we will look into each security control checklist:

  • Installation media such as CD-ROM/DVD/ISO should be checked by using checksum
  • A minimal base installation should be done when creating the server
  • It is good practice to create separate filesystems for /home, and /tmp
  • It is good practice to install minimum software on the server to minimize the chances of vulnerability
  • Always keep the Linux kernel and software up to date

Boot and disk

Now we will look into each security control checklist:

  • Encrypt partitions using disk encryption methods such as LUKS.
  • Limit access to BIOS by configuring a BIOS password.
  • Limit bootable devices and allow only devices such as disk to be booted.
  • Configure a password to access the single user mode boot loader.

Network and services

Now we will look into each security control checklist:

  • Determine the services running by checking the open network ports.
  • Use a firewall such as iptables/nftables to limit access to the services as per need.
  • Encrypt all data transmitted over the network.
  • Avoid using services such as FTP, Telnet, and Rlogin/Rsh.
  • Any unwanted services should be disabled.
  • A centralized authentication service should be used.

Intrusion detection and Denial of Service (DoS)

Now we will look into each security control checklist:

  • File integrity tools such as AIDE, Samhain, and AFICK should be installed and configured for monitoring important files.
  • Use a malware scanner such as CalmAV to protect against malicious scripts.
  • Configure system logging to a remote machine for the purpose of detection, forensics, and archiving.
  • Deter brute-force attacks by using anti brute-force tools for authentication attempts.

Auditing and availability

Now we will look into each security control checklist:

  • Read through logs to monitor for suspicious activity.
  • Configure auditd configuration to perform system accounting.
  • Ensure backup is working, and also check restores.

How it works...

Implementing these security controls minimizes the security risk to your Linux server. This helps protect your data from the hands of hackers.