Skip to content

Latest commit

 

History

History
66 lines (45 loc) · 2.43 KB

File metadata and controls

66 lines (45 loc) · 2.43 KB

A Practical Host Security Baseline

← Guide index · Repository home

Overview

Host security is layered risk reduction: patching, least privilege, minimal services, strong authentication, protected secrets, constrained workloads, and useful audit evidence.

Caution

Inspect targets and understand impact before running privileged or mutating commands. Test changes in a safe environment first.

Operational Scenario

An internet-facing service should expose only required ports, run as an unprivileged identity, receive secrets through controlled channels, and have a documented patch and access-review process.

Core Concepts

# Working principle
1 Attack surface grows with installed software, listening services, privileges, and reachable interfaces.
2 sudo provides controlled elevation and an audit boundary when policy is narrow.
3 Mandatory access control and systemd sandboxing limit damage beyond discretionary permissions.

Investigation Commands

ss -lntup
systemctl --type=service --state=running
sudo -l
find / -xdev -perm -4000 -type f -print
systemd-analyze security order-api.service
last -a | head

Commands are examples for observation and controlled testing. Paths, process identifiers, interfaces, and service names must be adapted to the actual host.

Practical Workflow

  1. Define the symptom, affected users, and time window.
  2. Collect the smallest useful set of host and service evidence.
  3. Form one falsifiable hypothesis.
  4. Make the least disruptive test or change.
  5. Verify recovery and record what was learned.

Production Practices

  • Remove or disable services that have no owner or requirement.
  • Use key-based administration, MFA where supported, and reviewed sudo policy.
  • Automate security updates according to an explicit maintenance policy.

Common Mistakes

  • Disabling security controls to make deployment easier.
  • Storing secrets in shell history or world-readable environment files.
  • Applying a generic hardening script without compatibility testing.

Interview and Review Questions

  1. How would you reduce a server's attack surface?
  2. What is the security value of a non-root service account?
  3. How do you validate hardening without breaking availability?

References