Article Archive

Reference checklists and reproducible snippets kept intentionally minimal.

Linux Security

Practical systemd Service Sandboxing Without Breaking Daemons

When deploying lightweight Go or Rust HTTP servers on Debian, there is rarely a reason to run the main process as UID 0. Pairing a dedicated system account with AmbientCapabilities=CAP_NET_BIND_SERVICE and ProtectSystem=full limits blast radius while preserving automatic certificate storage writes.

[Service]
User=www-service
Group=www-service
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=full

Always verify reload behavior with systemctl reload after tightening unit permissions so certificate rotation never silently fails.

Networking BBR

Why Fair Queueing Matters When Enabling TCP BBR

BBR relies on accurate packet pacing to estimate bottleneck bandwidth and minimum RTT. On Linux 6.x kernels, pairing net.core.default_qdisc=fq with net.ipv4.tcp_congestion_control=bbr gives noticeably steadier tail latency across long-haul links.

cat <<'EOF' > /etc/sysctl.d/99-tcp-bbr.conf
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
EOF
sysctl --system
PostgreSQL Storage

Tuning PostgreSQL Autovacuum for Append-Heavy Event Tables

For append-only telemetry tables, set a fixed insert threshold instead of waiting for a percentage of total rows to accumulate. This keeps visibility maps fresh for index-only scans.

ALTER TABLE service_events SET (
  autovacuum_vacuum_insert_threshold = 200000,
  autovacuum_vacuum_insert_scale_factor = 0.0
);