PortGate

Blueprints · Server Hardening

Production 10 min · Linux

Sysctl network baseline

Stages kernel network settings that drop redirects and ignore source-routed packets. It does not change SSH.

Baked-in protections

Step 1 · conf

Sysctl file

/root/portgate-blueprints/99-portgate-net.conf

Review it, then load it with sysctl --system when you are ready.

net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.tcp_syncookies = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.all.log_martians = 1

Step 2 · bash

Read-only check

/root/portgate-blueprints/sysctl-check.sh

Prints the current values. It does not write sysctl.

#!/bin/sh
set -eu
sysctl net.ipv4.tcp_syncookies net.ipv4.conf.all.accept_redirects