Disable legacy (BSD) PTY support
Requires the kernel to be built without CONFIG_LEGACY_PTYS=y, leaving only the modern Unix98 PTYs under /dev/pts.
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
CONFIG_LEGACY_PTYS enables the old BSD-style pseudo-terminal scheme (/dev/ptyXX and /dev/ttyXX), superseded by the Unix98 PTYs of /dev/pts. The legacy scheme allocates a fixed, static pool of PTY pairs with weaker isolation and a history of security problems, and adds unused terminal code to the kernel. Modern userspace uses only Unix98 PTYs, so building without CONFIG_LEGACY_PTYS removes dead, problematic code and shrinks attack surface.
What Pavois checks
Pavois reads the build configuration of the running kernel, /boot/config-$(uname -r) and the in-memory /proc/config.gz, and confirms CONFIG_LEGACY_PTYS is not set to y. Inspecting the booted kernel's real config (not a stale /boot/config-*) reflects whether the legacy PTY layer is actually compiled in.
describe command("C=/boot/config-$(uname -r); if [ -r \"$C\" ]; then cat \"$C\"; elif zcat /proc/config.gz 2>/dev/null | head -1 | grep -q .; then zcat /proc/config.gz; else echo PAVOIS_NO_KERNEL_CONFIG; fi | grep -E '^(CONFIG_LEGACY_PTYS=|PAVOIS_NO_KERNEL_CONFIG)'") do
its('stdout') { should_not match(/PAVOIS_NO_KERNEL_CONFIG/) }
its('stdout') { should_not match(/^CONFIG_LEGACY_PTYS=y$/) }
endHow to verify it is applied
Run grep '^CONFIG_LEGACY_PTYS=' /boot/config-$(uname -r). Expected: no match, or # CONFIG_LEGACY_PTYS is not set, the line CONFIG_LEGACY_PTYS=y must be absent. You can also confirm /dev/ptmx and /dev/pts are present while /dev/ptyp0 is not.
Inspect & investigate
No dedicated log. To confirm only modern PTYs are in use, list ls -l /dev/pts (Unix98) and check for the absence of legacy nodes with ls /dev/pty* 2>/dev/null. Allocated PTYs in use are visible via lsof /dev/pts/* 2>/dev/null or per-process ls -l /proc/*/fd | grep pts.
Remediation
No automated remediation: this is a kernel build-time option, not a runtime tunable. Pavois's harden plan is empty. To fix it you must boot a kernel compiled without CONFIG_LEGACY_PTYS, current distribution kernels already drop it; for a custom kernel, unset the option and rebuild, then reboot.
Pavois applies this with its own harden engine, the plan below, not a shell script:
| resource | kernel_build |
|---|
pavois harden plan localwhere the target is local, a user@host SSH alias, or a container , Docs
Impact & precautions
Removing legacy PTYs affects only very old software that hard-codes /dev/ptyXX device names; all modern terminals, SSH sessions, screen/tmux, and containers use Unix98 PTYs and are unaffected. Audit for ancient terminal-handling tools before applying. Because the change requires a different kernel, keep the previous kernel entry in the bootloader as a fallback.
Standards mapping
| Standard | Reference | Type | Version | Confidence |
|---|---|---|---|---|
| ANSSI BP-028 | R23 | direct | 2.0 | high |
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.