Endpoint Protection · Topic 4 of 9
Linux Security Concerns, Patching and Hardening
Understand Linux security concerns, secure installation and patching with package managers, and hardening with permissions, firewalls and SELinux.
- 4 min
- Minimal install plus patching is the first step in Linux hardening.
- apt for Debian and Ubuntu, dnf or yum for Red Hat family, zypper for SUSE.
- SELinux (Red Hat family) and AppArmor (Debian and SUSE) provide mandatory access control.
What it is
Linux runs most servers, cloud workloads and many network appliances. It is secure by design in many respects, but a default install still has risks: weak passwords, exposed services, unpatched packages and loose permissions. The defender's job is to install it minimally, patch it on a schedule and harden it to a standard.
How it works
Linux OS and its security concerns
| Concern | Example |
|---|---|
| Unpatched software | Known flaws in the kernel or services |
| Weak authentication | Default or guessable passwords, exposed SSH |
| Excess privilege | Everything run as root, loose sudo rules |
| Unneeded services | Telnet, FTP or a database listening on all interfaces |
| Misconfigured permissions | World writable files, unnecessary SUID programs |
| Untrusted software | Packages or scripts from unverified sources |
| Poor logging | No record of what happened |
Because everything in Linux is a file with an owner, group and permission set, permission mistakes are among the most common flaws.
Linux installation and patching
Secure installation
- Install only the packages the role needs (a minimal install).
- Use separate partitions for /boot, /home, /tmp and /var, with options such as noexec and nosuid on /tmp where suitable.
- Encrypt disks with LUKS.
- Set a strong root and bootloader password, and create a normal administrative user.
- Install from verified media, checking checksums or signatures.
Patching
| Family | Package manager |
|---|---|
| Debian, Ubuntu | apt |
| Red Hat, CentOS, Fedora, Rocky | dnf (older: yum) |
| SUSE | zypper |
Package managers verify GPG signatures on packages and use trusted repositories. Patch cycle: refresh the package list, review available security updates, test on a staging system, apply, and reboot when the kernel or core libraries changed. Unattended upgrades can apply security updates automatically on low risk systems. Live kernel patching reduces reboots on critical servers.
Linux OS hardening techniques
- Remove or disable unneeded services and close unneeded ports.
- Host firewall: iptables or nftables, or the front ends ufw and firewalld, with default deny inbound.
- File permissions: follow least privilege. Permissions are read (4), write (2) and execute (1) for owner, group and others, so 640 means owner read and write, group read, others nothing. Review SUID and SGID files and world writable files regularly.
- Mandatory access control: SELinux (Red Hat family) and AppArmor (Debian, Ubuntu, SUSE) confine programs even if they are compromised. SELinux modes are enforcing, permissive (logs only) and disabled.
- Kernel parameters (sysctl) to ignore source routed packets, ICMP redirects and enable SYN cookies.
- Auditing: the Linux Audit framework (auditd) and syslog or journald forwarded to a central server.
- File integrity monitoring with tools such as AIDE.
- Remove compilers and tools that are not needed on production servers.
- Secure boot loader with a GRUB password and restricted console access.
- Apply a baseline: CIS Benchmarks, DISA STIGs, or scan with OpenSCAP.
A worked example
A new web server is built from a minimal image on an encrypted disk. Only ports 22 and 443 are allowed by the firewall, SELinux is in enforcing mode, the web content directory is owned by a non privileged account and auditd logs changes under the configuration directory. A scheduled job applies security updates, and a weekly OpenSCAP scan compares the server to the CIS Benchmark.
How the exam asks about this
- "Which Linux mandatory access control system is used on Red Hat based distributions?" → SELinux.
- "What does a package manager use to confirm a package is authentic?" → GPG signatures from a trusted repository.
- "What does permission 644 mean?" → Owner read and write, group and others read only.
What to remember for the exam
- Minimal install plus patching is the first step in Linux hardening.
- apt for Debian and Ubuntu, dnf or yum for Red Hat family, zypper for SUSE.
- SELinux (Red Hat family) and AppArmor (Debian and SUSE) provide mandatory access control.
- Review SUID and world writable files.
- CIS Benchmarks and OpenSCAP provide a baseline and a way to scan against it.
Do not disable SELinux just because it blocks something. Fix the policy or context instead, or you remove a major protection.
Common mistakes
Running services as root. A flaw in the service then gives root access. Use a dedicated service account.
Patching without a reboot. A new kernel or library is not in use until the system restarts.
Trusting any repository. Adding an unverified source can install malicious packages.
Check yourself
Why do package managers use GPG signatures?
To verify that packages come from the trusted source and were not altered.
What does SELinux permissive mode do?
It logs policy violations without blocking them.
What mount options help protect the /tmp partition?
noexec and nosuid, which stop programs running from it and ignore SUID bits.
Topic 4 of 9 in Endpoint Protection
Test yourself on Endpoint Protection
The full EC-Council 312-38 question bank has 800 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by EC-Council. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.