Disable SSH TCP Forwarding
Forces AllowTcpForwarding no so authenticated SSH clients cannot tunnel arbitrary TCP connections through the server.
Checked against the resolved running state (e.g. sshd -T, sysctl, systemctl show), catches drop-ins and Includes a file read would miss. Caveat: runtime ≠ persistence; a value correct now may not survive a reboot.
Pavois asserts the effective configuration, the live, resolved state, not a file. File-based scanners (OVAL/SCAP, Lynis) miss Includes, drop-ins and runtime defaults; this check sees what is actually applied.
A mapping is a cross-reference to where each standard places this requirement, anchored and cross-validated, not a claim of equivalence. A passing check is evidence toward these references, how to read it.
Why this rule matters
TCP forwarding (ssh -L/-R/-D) lets an authenticated user turn the SSH server into a relay: it can be used to pivot into otherwise-unreachable internal hosts, bypass firewall segmentation, or build a back-door tunnel for exfiltration. Unless there is an operational requirement, disabling TCP forwarding removes this tunneling and lateral-movement capability.
What Pavois checks
Pavois reads the effective value from sshd -T, after all Includes, /etc/ssh/sshd_config.d/ drop-ins and Match blocks. A Match stanza can re-enable forwarding for specific users; only the resolved output reveals that, unlike a read of /etc/ssh/sshd_config.
describe command('sshd -T') do
its('stdout') { should match(/^allowtcpforwarding\s+no$/i) }
endHow to verify it is applied
Run sshd -T | grep -i '^allowtcpforwarding'. Expected output is allowtcpforwarding no.
Inspect & investigate
Refused forward requests are logged via journalctl -u sshd or in /var/log/secure, e.g. lines mentioning refused local port forward when a client attempts a tunnel.
Remediation
Pavois's harden plan writes the sshd_setting directive AllowTcpForwarding no in a managed drop-in, validates with sshd -t, then reloads the ssh service. Apply it with pavois harden apply.
Pavois applies this with its own harden engine, the plan below, not a shell script:
| directive | allowtcpforwarding |
|---|---|
| notify | action: reload, service: ssh.service |
| resource | sshd_setting |
| value | no |
| verify | sshd -t -f %{path} |
pavois harden plan localwhere the target is local, a user@host SSH alias, or a container , Docs
Impact & precautions
Before applying, confirm no workflow relies on SSH tunnels: database access via ssh -L, SOCKS proxying via ssh -D, remote-forward callbacks via ssh -R, or tools that proxy through a jump host. If any are needed, scope an exception with a Match block rather than re-enabling globally. Plain shell logins are unaffected and the reload keeps current sessions alive.
Standards mapping
| Standard | Reference | Type | Version | Confidence |
|---|---|---|---|---|
| PCI DSS | 2.2.6 | supporting | 4.0.1 | medium |
Each reference is a cross-reference anchored in the upstream benchmark and cross-validated against the SCAP Security Guide and ansible-lockdown, not a claim of equivalence. Direct = a prescriptive, line-level requirement; supporting = an abstract control family (NIST) the check provides evidence toward. How to read a mapping.