1. Access and accounts #
Knowing who does what.
Rules #
- Named accounts, never direct root login or shared accounts.
- SSH key-based authentication only, keys protected by a passphrase, bastion for access from the Internet.
- sudo limited to the necessary commands, edited with
visudoin/etc/sudoers.d/. - Service accounts without a shell, one per application.
- Quarterly review of accounts, groups and
authorized_keys.
2. System and services #
A predictable server.
Rules #
- Distribution with long-term support, minimal installation.
- Automatic security fixes; scheduled reboots when
/var/run/reboot-requiredexists. - Services managed by systemd, with
Restart=on-failureand sandboxing options. - Never modify units shipped by packages:
systemctl edit. - systemd timers rather than cron for logging and catch-up.
- Synchronized time (
timedatectl, chrony): essential for correlating logs.
3. Storage, network and security #
Avoidable sources of incidents.
Rules #
- LVM with free space in the VG; UUID and
nofailin fstab;mount -abefore any reboot. - Separate data (
/var/lib,/srv) from the system so that filling up does not block the OS. - Default-deny firewall, only the necessary ports open, and only to the necessary sources.
- Internal services listening on
127.0.0.1or on the private network. - SELinux or AppArmor in enforcing mode.
- fail2ban on exposed services, centralized authentication logs.
4. Operations #
Lasting.
Rules #
- 3-2-1 backups, encrypted, with regular restore tests.
- Monitoring of disks, memory, services, backups and certificates, with actionable alerts.
- All configuration described in Git and applied by Ansible: the server must be rebuildable.
- Scripts with
set -euo pipefail, checked by ShellCheck. - Every intervention traced (ticket, commands), with a rollback plan.
Reference diagram and quick check #
Checklist.
Checklist #
cat /etc/os-release ; uname -r ; uptime
sudo apt list --upgradable 2>/dev/null | wc -l ; ls /var/run/reboot-required 2>/dev/null
sudo sshd -T | grep -E 'permitrootlogin|passwordauthentication'
sudo ufw status verbose || sudo firewall-cmd --list-all
ss -tlnp
systemctl --failed
df -h ; df -i ; free -h
sudo journalctl -p err -b --no-pager | tail
getent group sudo ; sudo ls /etc/sudoers.d
systemctl list-timers | grep -i backup ; restic snapshots --latest 1
timedatectl | grep synchronized
getenforce 2>/dev/null || sudo aa-status | head -3