OpenSSH:控制端口转发?

OpenSSH:控制端口转发?

是否可以使用 OpenSSH 限制端口转发?我想让用户ssh -R使用端口6000..7000,但我想阻止ssh -Dssh -L

答案1

sshd_config 的配置指令您感兴趣的内容包括:

AllowTcpForwarding
PermitOpen

在限制允许的端口转发类型方面似乎没有任何粒度。

但是,请注意 AllowTCPForwarding 选项的文档:

 AllowTcpForwarding
         Specifies whether TCP forwarding is permitted.  The default is
         ``yes''.  Note that disabling TCP forwarding does not improve
         security unless users are also denied shell access, as they can
         always install their own forwarders.

概念是,如果您的用户有 shell 访问权限,那么他们使用 netcat 等实用程序登录后,设置自己的转发就很简单了。这将绕过任何 sshd 配置设置。

答案2

您还可以使用iptables它来对允许连接和/或转发的端口进行细粒度的控制。

答案3

http://www.manpagez.com/man/8/sshd/ 搜寻许可证Open

我愿意:

Match User Blah
PermitOpen BlahComputer:3389

相关内容