1. 问题描述

JumpServer 网关转发失败

2. 问题处理

# 检查配置项
sudo sshd -T | grep -Ei 'allowtcpforwarding|disableforwarding|permitopen'

# 目标结果
allowtcpforwarding yes
permitopen any

# 发现有一项不符合禁止通过 SSH 做 TCP 端口转发(隧道)
AllowTcpForwarding no 
# 备份
cp -a /etc/ssh/sshd_config /etc/ssh/sshd_config.bak.$(date +%Y%m%d-%H%M%S)

# 修改
sed -i 's/^[[:space:]]*AllowTcpForwarding[[:space:]]\+no/AllowTcpForwarding yes/' /etc/ssh/sshd_config

# 查看修改内容
grep -n 'AllowTcpForwarding' /etc/ssh/sshd_config

# 检查SSH语法
sshd -t

# 重载
systemctl reload sshd

# 检查实际配置
sshd -T | grep -Ei 'allowtcpforwarding|disableforwarding|permitopen'