Przejdź do treści
Biblioteka skilli
Bezpieczeństwo · Automatyzacja

server-hardening

/server-hardening

Utwardza obsługiwany host z Linuksem: konfigurację SSH, zaporę z domyślną odmową i automatyczne aktualizacje bezpieczeństwa, z weryfikacją każdego elementu na maszynie.

Repozytorium
agent-config ↗
Licencja
MIT
Ostatnia zmiana repozytorium
26.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
2
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 26.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Utwardza obsługiwany host z Linuksem: konfigurację SSH, zaporę z domyślną odmową i automatyczne aktualizacje bezpieczeństwa, z weryfikacją każdego elementu na maszynie.

Oryginalny opis (EN)

Use when hardening a Linux host you operate — SSH posture, a default-deny firewall baseline, and unattended security upgrades, each verified on the box rather than assumed from a config file.

Jak działa

  1. When to use
  2. The three surfaces
  3. Procedure: Harden a host
  4. Output format
  5. Gotcha
  6. Do NOT
  7. Auto-trigger keywords
Sekcje z nagłówków SKILL.md, w oryginale · 150 linii, 1 003 słów
Podgląd SKILL.md
---
model_tier: medium
name: server-hardening
description: "Use when hardening a Linux host you operate — SSH posture, a default-deny firewall baseline, and unattended security upgrades, each verified on the box rather than assumed from a config file."
domain: devops
workspaces:
  - engineering
packs:
  - engineering-base
---

# server-hardening

## When to use

Use when a host is yours to operate — a VPS, a bare-metal box, a long-lived VM —
and its own security posture is the question. Three surfaces: who may log in, what
may reach the network, and how patches arrive.

Do NOT use when:
- The workload runs on a managed runtime with no host you control — there is no
  host posture to set, and `operational-readiness` records that as `unavailable`
  with that reason
- Auditing application code for vulnerabilities (use `security-audit`)
- Application-level auth and authorization (use `security`, `authz-review`)
- Provisioning cloud infrastructure (use `terraform`, `aws-infrastructure`)
- Container image hardening (use `docker`)

## The three surfaces

### 1. SSH posture

The one remote-entry door. Harden in this order, and **keep an open session while
you change it** — a mistake here locks you out of the machine you are fixing.

| Setting | Target | Why |
|---|---|---|
| `PasswordAuthentication` | `no` | Ends credential-stuffing against the host outright |
| `PubkeyAuthentication` | `yes` | The replacement must work before passwords are removed |
| `PermitRootLogin` | `no` (or `prohibit-password`) | Forces an audit trail through a named account |
| `AllowUsers` / `AllowGroups` | Explicit allow-list | Default is every account on the box |
| Port | Non-default is optional | Cuts log noise, not risk — never the primary control |

Verify from a **second** connection before closing the first:

```bash
sudo sshd -t                                  # config parses; do this before reload
sudo systemctl reload ssh                     # or sshd, per distro
sudo sshd -T | grep -Ei 'passwordauth|permitrootlogin|pubkeyauth'
```

`sshd -T` prints the **effective** configuration. A file under
`sshd_config.d/` or a `Match` block can override what you just edited, so the
file you wrote is not evidence — the effective dump is.

### 2. Firewall baseline

Default-deny inbound, allow-list outbound where the workload permits.

```bash
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow OpenSSH                        # before enabling, or you are locked out
sudo ufw enable
sudo ufw status verbose                       # the verification, not the intent
```

Two traps worth naming. A container runtime can write its own forwarding rules
that bypass the host firewall entirely — check the actual rule table
(`sudo iptables -S` / `sudo nft list ruleset`), not just the friendly front-end.
And a cloud security group sits *in front* of the host: both must agree, and the
narrower one is the effective policy.

Optionally add an SSH brute-force throttle (`fail2ban` or equivalent). It is
noise reduction and a small real gain once password auth is already off — never
a substitute for it.

### 3. Unattended security upgrades

Patches that require a human are patches that arrive late.

```bash
sudo apt install unattended-upgrades          # Debian/Ubuntu family
sudo dpkg-reconfigure -plow unattended-upgrades
sudo unattended-upgrade --dry-run --debug     # proves it would act
```

Decide and record two things, because the default is silence: whether the host
**reboots automatically** when a patch needs it, and where the **failure
notification** goes. An upgrade timer that has been failing for six weeks is
indistinguishable from one that is working, unless something reports it.

Security patches only. Automatic *feature* upgrades change behaviour under you,
which is a different risk with a different owner.

## Procedure: Harden a host

1. **Confirm the host is yours to harden.** Managed runtime with no shell → stop;
   there is no posture here, and that is a recordable `unavailable`.
2. **Open a second session and keep it open** for the whole SSH and firewall
   work. This is the entire rollback mechanism.
3. **Set the SSH posture**, then verify with `sshd -T` from the second session —
   effective config, not the file.
4. **Set the firewall baseline**, allowing SSH *before* enabling. Verify with
   `ufw status verbose` and against the raw rule table.
5. **Enable unattended security upgrades**, then prove with `--dry-run` that it
   would act. Record the reboot policy and the failure destination.
6. **Re-verify from a fresh connection.** Close every old session and reconnect.
   A posture that only holds inside an already-authenticated session is
   unverified.
7. **Report each surface as met, unmet or uninspected.** Uninspected is not met —
   `operational-readiness` reads an uninspected host posture as a red.

### Validate

- Verify `sshd -T` reports `passwordauthentication no`.
- Verify `sshd -T` reports `permitrootlogin no` or `prohibit-password`.
- Verify a key-based login succeeds from a **fresh** connection.
- Verify the firewall default is deny-inbound and SSH is explicitly allowed.
- Verify the raw rule table agrees with the front-end.
- Verify `unattended-upgrade --dry-run` reports it would act.
- Confirm the reboot policy and the failure-notification destination are recorded.

## Output format

1. One row per surface — SSH, firewall, unattended upgrades — with met / unmet /
   uninspected and the verifying command's output.
2. The reboot policy and where upgrade failures are reported.
3. Anything left unmet, with what would close it.

## Gotcha

- Changing SSH without a second open session is how a host becomes unreachable.
- The config file is not the posture. `sshd -T` is; a drop-in or `Match` block
  silently wins.
- Enabling a firewall before allowing SSH locks you out immediately.
- A container runtime's own rules can bypass the host firewall.
- A cloud security group and the host firewall must both allow a port; the
  narrower wins.
- A silently failing upgrade timer looks exactly like a working one.
- A non-default SSH port reduces log volume, not risk.

## Do NOT

- Do NOT disable password authentication before a key login is proven to work.
- Do NOT enable the firewall before allowing SSH.
- Do NOT enable automatic feature upgrades — security patches only.
- Do NOT treat an installed package as an enabled control; prove it acts.
- Do NOT report an uninspected surface as met.
- Do NOT rely on a non-default port as a control.

## Auto-trigger keywords

- server hardening
- host hardening
- ssh hardening
- firewall baseline
- unattended upgrades
- fail2ban
Pliki w paczce (2)
  • SKILL.md 7 KB
  • evals/triggers.json 2 KB

Wersje

W bazie nie ma innych skilli o nazwie server-hardening.

Migawka bazy z 13.11.2026 · wersja paczki 30fdf58fa449 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 2 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100linux-server-hardening
    Prowadzi autoryzowanego operatora przez usuwanie zweryfikowanych luk bezpieczeństwa na serwerze Linux: SSH, zapora, kontrola dostępu, usługi, uprawnienia i aktualizacje.
  • 100linux-server-hardening
    Pomaga autoryzowanemu administratorowi usuwać zweryfikowane luki Linuksa w SSH, zaporze, MAC, usługach, uprawnieniach i aktualizacjach.
  • 100healthcheck
    Utwardza zabezpieczenia hosta i ustawia tolerancję ryzyka dla wdrożeń OpenClaw: audyty bezpieczeństwa, firewall, SSH, aktualizacje, przegląd ekspozycji, cykliczne kontrole w cronie i status wersji.
  • 100linux-hardening
    Zabezpiecza serwery Linux według benchmarków CIS: konfiguracja SSH, zarządzanie użytkownikami, reguły zapory i funkcje bezpieczeństwa, pod produkcję lub wymogi zgodności.
  • 90jolitz-security
    Przeprowadza audyt bezpieczeństwa serwera: utwardzenie SSH, zaporę, konta, nasłuchujące usługi, uprawnienia plików i fail2ban.
  • 100healthcheck
    Utwardza bezpieczeństwo hosta i konfiguruje tolerancję ryzyka dla wdrożeń OpenClaw: audyty bezpieczeństwa, zapora, SSH, aktualizacje, przegląd ekspozycji i okresowe kontrole przez cron.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.