Skip to content
All posts

· 8 min read

A practical checklist for hardening a fresh Rocky Linux server

The dozen things we do before a new server goes anywhere near production traffic — in order, with the actual commands.

Diganta Talukdar, Founder & Principal Engineer at DployHub

Diganta Talukdar

Founder & Principal Engineer

This is close to the actual checklist we run through on a fresh Rocky Linux box before it goes into a managed-hosting rotation. It's not exhaustive — compliance-driven environments need more — but it covers the gaps that actually get exploited.

1. Update, then set up automatic security patching

sudo dnf update -y
sudo dnf install -y dnf-automatic
sudo systemctl enable --now dnf-automatic-install.timer

2. Create a non-root sudo user, disable root SSH login

Every session as root is a session where one mistyped command has no safety margin. Create a named user with sudo, then in /etc/ssh/sshd_config:

PermitRootLogin no
PasswordAuthentication no

Key-based auth only. Password auth over SSH is the single most common thing we find still enabled on servers we inherit from another provider.

3. Firewall — default deny, allow only what's needed

sudo firewall-cmd --set-default-zone=drop
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload

4. fail2ban for SSH

Rate-limits brute-force attempts against SSH automatically. Cheap to set up, meaningfully cuts noise in your auth logs.

5. SELinux stays enforcing

setenforce 0 is not a fix, it's deferring the problem. If something's blocked by SELinux, find the actual policy that needs adjusting (audit2allow is your friend) rather than turning it off.

6. Centralised logging and monitoring, from day one

Ship logs off the box before you need them for an incident, not after. A server that only has local logs is a server where the evidence disappears if the disk fills or the box gets compromised.

What we add on top of this

For clients under a managed-hosting retainer, this baseline is the starting point, not the finish line — it's paired with scheduled patch windows, uptime monitoring with real alerting, and backup verification (a backup nobody's tested restoring isn't a backup, it's a hope).

LinuxRocky LinuxSecurity

Related deploy guides

  • Deploy a Node.js app from GitHub →

    Push a Node.js repo and DployHub detects npm, yarn or pnpm, your start script and port, then deploys it live with HTTPS and zero downtime.

  • Deploy a Next.js app from GitHub →

    Deploy Next.js with server rendering, API routes and middleware intact. We run next build and next start, with zero-downtime deploys and automatic HTTPS.

  • Deploy a Python app from GitHub →

    Deploy Python web apps from requirements.txt, pyproject.toml or a Pipfile on Python 3.12, with gunicorn or uvicorn installed for you and automatic HTTPS.

Rather not run servers at all?

DployHub builds your app from GitHub, puts it live at its own HTTPS address, and keeps it running.