Sunucu sertleştirme, denetim sınıfı vs gerçeklik
Linux için CIS Benchmarks 200+ sayfadır. Çoğu gerçekten faydalı; bir kısmı modern container ortamlarında demode veya ters etki yapar. Aşağıda öncelikli liste.Katman 1 — mutlak yapılması gereken
- Parola SSH yok; sadece key auth.
- Root SSH yok; loglamalı sudo.
- Default-deny firewall, host üzerinde.
- Otomatik patch'ler, planlanmış reboot'lar.
- Fiziksel erişim olası olan yerlerde disk şifreleme.
Bunlar olmadan gerisi önemsizdir.
Katman 2 — süreç ve runtime
- AppArmor / SELinux — enforcing modda etkin.
- Namespaces / cgroups — ayrıcalıksız user-space kod çalıştıran her servis için. Container'laştırma bunu bedava verir.
- Capabilities — tümünü düşür, sadece gerekeni ekle.
- Seccomp — syscall filtreleme. Runc/podman varsayılan profilleri çoğu durumu kapsar.
- No-new-privs flag — setuid saldırılarını etkisiz kılar.
Katman 3 — supply chain
Üretim sunucusundaki her binary bir yerden geldi. Zincir:- İmza doğrulamalı upstream repo'lardan OS paketleri.
- Özel registry'den imzalı container image'leri (cosign / sigstore).
- Kendi CI'nızdan imzalı uygulama binary'leri.
- Kaydedilmiş build provenance (SLSA, in-toto).
Saldırganların giderek hedef aldığı alan — bağımlılık, tehlikeye girmiş maintainer, typosquat paketi yoluyla supply chain compromise.
Katman 4 — runtime tespit
- Falco — kernel düzeyi kural tabanlı davranışsal tespit. Açık kaynak, olgun.
- Tetragon — eBPF tabanlı, benzer rol, daha performant.
- auditd — kernel düzeyi audit loglama. Daha düşük seviye sinyal, yorumlama gerekir.
Katman 5 — segmentasyon
- Ağ segmentasyonu — üretim sunucuları doğrudan internet-erişilemez VPC/subnet'te.
- Admin erişimi için güçlü kimlik doğrulamalı bastion / jump-box.
- Servis-servis kimlik doğrulama — her dahili çağrı doğrulanmış.
- Veritabanı izolasyonu — sadece uygulama sunucuları DB'ye ulaşır.
Sıkça dahil edilen ama iğneyi hareket ettirmeyenler
- Kullanılmayan TCP / IPv6 özelliklerini devre dışı bırakma.
- /tmp izinlerini özel sertleştirme.
- Agresif sysctl ayarlamaları (bazıları demode).
- Kernel sürüm banner'larını gizleme.
Uyumluluktan CIS Benchmark mandate'i varsa script'i çalıştırın. Yoksa yukarıdaki katmanları önceliklendirin.
Container sertleştirme
- Read-only root filesystem.
- Tüm capabilities'i düşür; sadece gerekeni ekle.
- Non-root olarak çalıştır.
- Resource limits (cpu, memory).
- Build'de + registry pull'da image tarama.
- :latest değil, image digest'i pin'le.
- Distroless veya minimal base image'ler.
Cloud'a özel
- IAM least-privilege — çoğu cloud breach over-permissioned IAM ile başlar.
- Kodda uzun ömürlü API kimlik bilgisi yok; OIDC federation veya kısa ömürlü token.
- VPC flow logs etkin.
- CloudTrail / Cloud Audit Logs / Activity Logs retention ile etkin.
- Açıkça kasıtlı olmadıkça herkese açık okunabilir storage bucket yok.
"Compromise" tabletop'u
Her altı ayda bir tabletop egzersizi:- "Saldırgan bir üretim sunucusunda shell'e sahip. Neye erişebilir?"
- "Saldırgan bir IAM user'ı tehlikeye attı. Ne yapabilir?"
- "Saldırganın bir geliştirici laptop'u var. Hangi kimlik bilgilerine sahip?"
Uyaracağımız bir desen
Ekibin işletemeyeceği sertleştirme. Mühendislerin sorun gideremediği kilitli kutu sonraki incident sırasında kilidi açılan kutudur.Her zaman karşılığını veren bir desen
Sertleştirilmiş şeyleri ve onlarla güvenle nasıl etkileşim kurulacağını belgelemek. Incident sırasında saatler kazandırır.Hangi sertleştirme öğesi gerçek bir incident'ta sizi kurtardı?
Server hardening, audit-grade vs reality
The CIS Benchmarks for Linux are 200+ pages. Most of it is genuinely useful; some of it is dated or counterproductive in modern containerised environments. Below is the prioritised list.Layer 1 — the must-do
- No password SSH; key auth only.
- No root SSH; sudo with logging.
- Default-deny firewall, on-host.
- Patches automatic, reboots scheduled.
- Disk encryption where physical access is plausible.
Without these, the rest doesn't matter.
Layer 2 — process and runtime
- AppArmor / SELinux — enabled, in enforcing mode.
- Namespaces / cgroups — for any service running unprivileged user-space code. Containerisation gives this for free.
- Capabilities — drop all, add only what's needed.
- Seccomp — syscall filtering. Default profiles from runc / podman cover most cases.
- No-new-privs flag — defangs setuid attacks.
Layer 3 — supply chain
Every binary on the production server got there from somewhere. The chain:- OS packages from upstream repos with signature verification.
- Container images from a private registry, signed (cosign / sigstore).
- Application binaries from your own CI, signed.
- Build provenance recorded (SLSA, in-toto).
This is the area attackers increasingly target — supply chain compromise via a dependency, a compromised maintainer, a typosquat package.
Layer 4 — runtime detection
- Falco — kernel-level rule-based behavioural detection. Open-source, mature.
- Tetragon — eBPF-based, similar role, more performant.
- auditd — kernel-level audit logging. Lower-level signal, requires interpretation.
Layer 5 — segmentation
- Network segmentation — production servers in a VPC / subnet that's not directly internet-reachable.
- Bastion / jump-box for admin access, with strong authentication.
- Service-to-service auth — every internal call authenticated.
- Database isolation — only application servers reach the DB.
Things often included that don't move the needle much
- Disabling unused TCP / IPv6 features.
- Custom hardening of /tmp permissions.
- Aggressive sysctl tweaks (some are dated).
- Hiding kernel version banners.
If you have a CIS Benchmark mandate from compliance, run the script. If not, prioritise the layers above.
Container hardening
- Read-only root filesystem.
- Drop all capabilities; add only what's needed.
- Run as non-root.
- Resource limits (cpu, memory).
- Image scanning at build + at registry pull.
- Pin image digest, not :latest.
- Distroless or minimal base images.
Cloud-specific
- IAM principle-of-least-privilege — most cloud breaches start with over-permissioned IAM.
- No long-lived API credentials in code; OIDC federation or short-lived tokens.
- VPC flow logs enabled.
- CloudTrail / Cloud Audit Logs / Activity Logs enabled with retention.
- No publicly-readable storage buckets unless explicitly intentional.
The "compromise" tabletop
Every six months, run a tabletop exercise:- "An attacker has shell on one production server. What can they reach?"
- "An attacker has compromised one IAM user. What can they do?"
- "An attacker has a developer's laptop. What credentials do they have?"
One pattern we'd warn about
Hardening that the team can't operate. A locked-down box that engineers can't troubleshoot is a box that gets unlocked during the next incident.One pattern that always pays off
Documenting what's hardened and how to interact with it safely. Saves hours during incidents.What hardening item has actually saved you in a real incident?