[email protected]

How-to · Monitoring & Server Operations

Linux Server Hardening: Checklist Based on CIS and BSI

Editorial note: Versions, commands and prices may change. Please verify critical steps independently before production use. This guide does not replace individual professional, legal or tax advice.

Want to know how well your Linux servers are secured today? The server audit reviews hardening, patch level, access and backups and delivers a prioritised list of findings.

A freshly installed Linux server works, but it is not hardened. Distributions choose defaults that work on as many systems as possible. An internet-facing server is exposed to automated login attempts and scans. Hardening reduces the attack surface to what the server actually needs.

This checklist summarises the most important measures for Debian, Ubuntu and the RHEL family. Each measure has an audit command and a reference to the German BSI IT-Grundschutz. The CIS Benchmarks cover the same topics in detail and work well as an audit baseline.

Contents

References: CIS Benchmarks and BSI IT-Grundschutz

CIS Benchmarks BSI IT-Grundschutz
Publisher Center for Internet Security (USA) German Federal Office for Information Security (BSI)
Format configuration recommendations per product and version, free PDF modules with requirements, for Linux SYS.1.3 together with SYS.1.1
Levels Level 1 (base, low operational impact), Level 2 (defense in depth), STIG profile in some benchmarks basic, standard and elevated-protection requirements
Linux coverage separate benchmarks for Ubuntu, Debian, Red Hat Enterprise Linux and others distribution-independent
Automatable yes, via SCAP profiles and tools partly, e.g. with the ComplianceAsCode profile "BSI SYS.1.1 and SYS.1.3" for RHEL 9; mostly organisational implementation

Sources: CIS Benchmarks FAQ, CIS Ubuntu Linux, CIS Debian Linux, CIS Red Hat Enterprise Linux, BSI SYS.1.3 (German), BSI SYS.1.1 (German).

According to CIS, Level 1 is a base recommendation that can be implemented fairly promptly and has little performance impact. Level 2 is considered defense in depth for environments where security is paramount. For most business servers Level 1 is the realistic baseline, with individual Level 2 items added based on risk.

Checklist: hardening a Linux server

No. Measure Audit command BSI reference
1 Supported release, security updates current cat /etc/os-release, apt list --upgradable or dnf updateinfo list --security OPS.1.1.3.A15
2 Unneeded services and packages removed systemctl list-unit-files --state=enabled SYS.1.1.A6
3 Only required ports open ss -tulpn SYS.1.1.A6, SYS.1.1.A19
4 Local firewall allowing only required connections nft list ruleset, ufw status verbose or firewall-cmd --list-all SYS.1.1.A19
5 SSH with keys only, no root login with password sshd -T, values of permitrootlogin and passwordauthentication SYS.1.3.A8
6 Unique login names, UIDs and GIDs cut -d: -f1 /etc/passwd, cut -d: -f3 /etc/passwd, cut -d: -f3 /etc/group, each with sort and uniq -d SYS.1.3.A2
7 Only root with UID 0 awk -F: '$3 == 0' /etc/passwd SYS.1.3.A2
8 ASLR and NX active sysctl kernel.randomize_va_space (value 2), NX: search dmesg for "NX (Execute Disable)" SYS.1.3.A4
9 AppArmor or SELinux active with default profiles aa-status or getenforce SYS.1.3.A10
10 No automatic mounting of removable media check automount services and /etc/fstab SYS.1.3.A3
11 Security-relevant events logged journalctl, configuration of auditd or rsyslog SYS.1.1.A10
12 Time synchronisation active timedatectl prerequisite for usable logs
13 Server in monitoring alert on service failure, disk space, certificates SYS.1.1.A23
14 Regular security review Lynis or OpenSCAP at fixed intervals SYS.1.1.A24

Securing SSH

SSH is reachable from the internet on almost every server and therefore a frequent target of automated login attempts. In SYS.1.3.A8 the BSI requires interactive remote access to use SSH exclusively and authentication to rely primarily on certificates rather than passwords.

The relevant options in /etc/ssh/sshd_config according to the OpenSSH manual:

  • PasswordAuthentication no: the default is yes. Together with KbdInteractiveAuthentication no, login is restricted to keys. Test your own key access first.
  • PermitRootLogin no: the default is prohibit-password, which still allows root to log in with a key. With no, administration runs through personal accounts and sudo, which makes actions attributable to a person.
  • KbdInteractiveAuthentication no: prevents password prompts through keyboard-interactive; the default is yes.
  • AllowGroups: restricts login to members of specific groups.

After every change, sshd -t checks the syntax and sshd -T shows the effective configuration. A second open session prevents a mistake from locking you out.

Firewall and network services

SYS.1.1.A19 requires incoming and outgoing communication to be restricted by a rule set to the necessary partners, protocols and ports. Debian and Ubuntu offer nftables or ufw, the RHEL family firewalld.

Proven approach:

  1. List all listening services with ss -tulpn.
  2. Bind services that are only needed locally, such as databases and caches, to 127.0.0.1.
  3. Only allow inbound what must be reachable from outside, typically HTTP, HTTPS and SSH, with SSH ideally only from known networks or via VPN.
  4. Set the default policy for incoming connections to drop.

fail2ban or CrowdSec help against repeated login attempts by blocking suspicious sources based on logs. They replace neither key-based login nor the firewall. For the network firewall in front of the servers there is managed OPNsense firewall operations.

Accounts, privileges and kernel protection

  • Accounts: every person gets their own account; shared accounts are removed. Accounts of former staff and unused service accounts are deleted. SYS.1.3.A2 requires every UID and GID to occur only once.
  • sudo: grant privileges as narrowly as possible and edit /etc/sudoers only with visudo. SYS.1.3.A6 recommends the administration tools instead of editing /etc/passwd, /etc/shadow, /etc/group and /etc/sudoers directly.
  • Kernel protection: SYS.1.3.A4 requires ASLR and DEP/NX to be active. According to the kernel documentation, the value 2 for kernel.randomize_va_space additionally enables heap randomisation, i.e. full randomisation.
  • Mandatory access control: SYS.1.3.A10 recommends AppArmor or SELinux with the default profiles enabled. Ubuntu and Debian use AppArmor, the RHEL family SELinux. Disabling it to work around an application problem is a common finding.
  • File systems: separate partitions for /tmp or /var/log with options such as nodev, nosuid and noexec are among the CIS Benchmark recommendations and are easiest to implement during installation.

Logging, time and intrusion detection

SYS.1.1.A10 lists the minimum events: system starts and reboots, successful and failed logins, failed permission checks, blocked data flows (violations of ACLs or firewall rules), changes to users, groups and privileges, security-relevant error messages and warnings from security systems such as antivirus. Logs should additionally be sent to a central system so an attacker cannot delete them on the server itself.

Without synchronised time, events cannot be correlated across systems; timedatectl shows the status of systemd-timesyncd or chrony. For elevated protection requirements, SYS.1.1.A27 names host-based intrusion detection, for example with Wazuh for file integrity and event correlation.

Verifying hardening: Lynis, OpenSCAP and Ubuntu Security Guide

Tool License Checks against Note
Lynis GPLv3 its own tests with hardening suggestions runs locally with lynis audit system, no agent (CISOfy)
OpenSCAP with ComplianceAsCode OpenSCAP LGPL-2.1, ComplianceAsCode BSD-3-Clause SCAP profiles, including "CIS Red Hat Enterprise Linux 9 Benchmark for Level 1 - Server" and CIS profiles for Ubuntu produces reports, partly with remediation scripts (OpenSCAP, ComplianceAsCode)
Ubuntu Security Guide part of Ubuntu Pro (subscription) CIS and DISA-STIG for Ubuntu from Ubuntu 20.04, installed via the Pro client (USG, installation)

An automated report shows deviations. It does not decide which of them make sense in a given operation. Every deviation from the benchmark is therefore either implemented or documented with a justification, because SYS.1.1.A16 provides that decisions on security-relevant settings are documented and justified.

Common mistakes

  • Hardening without repetition: a server hardened once drifts with every change. SYS.1.1.A24 requires regular security reviews.
  • Level 2 everywhere: strict profiles without testing break applications. Level 1 as the base, Level 2 selectively.
  • SELinux or AppArmor switched off instead of adjusting the profile.
  • Database listening on all interfaces and reachable from the internet.
  • Backup stored on the same server, lost together with it on encryption or disk failure.
  • No more updates: hardening does not protect against known flaws in an unsupported release, see Linux end of life.

Our approach at WZ-IT

The server audit from 290 euros net one-time reviews security and hardening, backup configuration and system health and delivers a findings overview with prioritised measures. The audit works from the inside and is not a penetration test.

Implementation and ongoing maintenance are covered by Linux server management from 149.90 euros net per month for the first server: updates in maintenance windows, 24/7 monitoring, backup verification with up to 250 GB of backup storage per server and operations documentation of patches, alerts and backup status. We manage servers remotely at the existing provider or on-premises.

Further guides

Status and methodology

  • Collected: 26 October 2026.
  • References: BSI IT-Grundschutz Compendium edition 2023, modules SYS.1.1, SYS.1.3 and OPS.1.1.3; CIS Benchmarks FAQ on profiles and distribution. The content of individual CIS Benchmarks is not reproduced, because the download requires registration.
  • Defaults: OpenSSH according to the official manual, kernel according to the kernel documentation.
  • Licenses: license files of the project repositories; Ubuntu Security Guide according to Canonical documentation.
  • Not included: hardening of applications such as web servers and databases, Windows Server, container platforms.

Sources

Rather have it operated?

You'd rather not run Monitoring & Server Operations yourself? WZ-IT handles setup, operations and maintenance - privacy-focused from Germany.

Enquiry

Assess Linux server management and monitoring

Choose between monitoring only and ongoing Linux server management with maintenance and response. We take over existing systems after a technical assessment.

  • Straight with Timo and Robin - no sales team, no pitch
  • A professional assessment of your situation
  • Concrete next steps for infrastructure, software or AI

The conversation is free and non-binding.

WZ-IT provided very competent support in implementing our server and virtualization infrastructure. As part of the project, a Proxmox-based virtualization environment was set up along with a virtual machine for our application systems. Additionally, a structured backup concept was implemented. A particular focus was on security: the setup of a VPN tunnel and the clean implementation of encryption and access concepts were professionally executed. The structured consulting as well as the reliable and swift implementation deserve special mention. We are very satisfied with the services provided and are happy to recommend WZ-IT.
John HellmerichsManaging Director, AInergy GmbH
Timo and Robin, founders of WZ-IT

Assess Linux server management and monitoring

WZ-IT provided very competent support in implementing our server and virtualization infrastructure. As part of the project, a Proxmox-based virtualization environment was set up along with a virtual machine for our application systems. Additionally, a structured backup concept was implemented. A particular focus was on security: the setup of a VPN tunnel and the clean implementation of encryption and access concepts were professionally executed. The structured consulting as well as the reliable and swift implementation deserve special mention. We are very satisfied with the services provided and are happy to recommend WZ-IT.
John HellmerichsManaging Director, AInergy GmbH

Frequently Asked Questions

Answers to the most important questions

Companies worldwide trust WZ-IT

  • Stadtwerke Brühl
  • DGHO e.V.
  • solarwerkstatt berlin
  • Krüger Dirndl
  • ABCO Water Systems
  • Golem.de
  • EVADXB
  • nextGYM
  • AInergy
  • ml&s
  • Odiseo Solutions
  • Annota
  • ARGE
  • SweetConnect GmbH
  • Aphy AG
  • CORGOS
  • Rekorder
  • SolidProof
  • Yonju
  • Keymate
  • Paritel
  • Mr. Clipart
  • Millenium
  • Negosh
  • Führerscheinmacher
  • BTI
  • Deutsche Gesellschaft für Datenschutz
Read client reviews