Azure Container Linux
TMA-AZURE-CONTAINER-LINUX-5.2.23
Ensure sshd granular forwarding is disabled
Descripción
As a supplement to the DisableForwarding directive, all individual SSH forwarding mechanisms should be disabled: AllowTcpForwarding, X11Forwarding, AllowAgentForwarding, AllowStreamLocalForwarding, and PermitTunnel. Setting the five granular directives allows a cluster to selectively re-enable one forwarding type (for example AllowTcpForwarding for kubectl port-forward) while keeping the others disabled.
Cómo se verifica
Método de auditoría: Comando de shell
alt0() { o=$(bash -c 'sshd -T | grep -iE '"'"'allowtcpforwarding|x11forwarding|allowagentforwarding|allowstreamlocalforwarding|p ermittunnel'"'"'' 2>&1); printf '%s\n' "$o" | tr -s ' \t' ' ' | sed 's/^ //;s/ $//' | grep -Fxq -- 'allowtcpforwarding no' || { echo step1: missing 'allowtcpforwarding no'; return 1; }; printf '%s\n' "$o" | tr -s ' \t' ' ' | sed 's/^ //;s/ $//' | grep -Fxq -- 'x11forwarding no' || { echo step1: missing 'x11forwarding no'; return 1; }; printf '%s\n' "$o" | tr -s ' \t' ' ' | sed 's/^ //;s/ $//' | grep -Fxq -- 'allowagentforwarding no' || { echo step1: missing 'allowagentforwarding no'; return 1; }; printf '%s\n' "$o" | tr -s ' \t' ' ' | sed 's/^ //;s/ $//' | grep -Fxq -- 'allowstreamlocalforwarding no' || { echo step1: missing 'allowstreamlocalforwarding no'; return 1; }; printf '%s\n' "$o" | tr -s ' \t' ' ' | sed 's/^ //;s/ $//' | grep -Fxq -- 'permittunnel no' || { echo step1: missing 'permittunnel no'; return 1; }; }; if alt0; then echo compliant; fi- Salida esperada
compliant
Cómo se corrige
Método de corrección: Guía o parche de infraestructura
Edit /etc/ssh/sshd_config (or a drop-in in /etc/ssh/sshd_config.d/) to set the following above any Include entry: AllowTcpForwarding no X11Forwarding no AllowAgentForwarding no AllowStreamLocalForwarding no PermitTunnel no Note: First occurrence of an option takes precedence.
Propiedades
- Sistemas operativos
- Cualquiera
- Etiquetas
- azure-container-linuxcis-converted
- Referencia
- CIS Azure Container Linux Benchmark v1.0.0 - 5.2.23 Ensure sshd granular forwarding is disabled
Verificar este host
Ejecute esto en un equipo que tenga permiso para auditar. El escaneo es de solo lectura.
tmaegis scan --target azure-container-linux --level 2