`ssh -Y`(可信X11转发)和`ssh -X`(不可信X11转发)有什么区别?

ssh -Y (可信X11转发)和ssh -X (不可信X11转发)有什么区别? 据我了解,它与安全性有关,但我没有掌握差异以及何时使用哪种。

这两个选项都与X11转发有关。 这意味着如果您启用此function,则可以通过SSH会话使用图形客户端(即使用Firefox或其他function)。

如果使用ssh -X remotemachine则远程计算机将被视为不受信任的客户端。 因此,您的本地客户端将命令发送到远程计算机并接收图形输出。 如果您的命令违反某些安全设置,则会收到错误。

但是,如果使用ssh -Y remotemachine ,远程计算机将被视为可信客户端。 最后一个选项可以解决安全问题。 因为其他图形(X11)客户端可以从远程机器嗅探数据(制作屏幕截图,做键盘记录和其他讨厌的东西),甚至可以改变这些数据。

如果您想了解有关这些内容的更多信息,我建议您阅读Xsecurity联机帮助页或X Security扩展规范 。 此外,您可以在/etc/ssh/ssh_config检查ForwardX11ForwardX11Trusted选项。

当您不需要远程运行X11程序时,请勿使用; 当你这样做时使用-X ; 并假设使用-Y如果您关心的X11程序使用-Y比使用-X更好。 但是目前(Ubuntu 15.10),-X与-Y相同,除非您编辑ssh_config以表示ForwardX11Trusted no 。 -X最初的目的是启用1990年代的X Security扩展,但这是旧的和不灵活的,并且会使一些程序崩溃,因此默认情况下会被忽略。

ssh -Y-X允许您在远程计算机上运行X11程序,其窗口显示在本地X监视器上。 问题是允许程序对其他程序的窗口以及X服务器本身执行的操作。

 local$ ssh -X remote remote$ xlogo # Runs xlogo on remote, but the logo pops up on the local screen. 

可信 -X11转发由-Y启用。 这是历史行为。 可访问显示器的程序受信任,可访问整个显示器。 它可以截图,键盘记录,并将输入注入其他程序的所有窗口。 它可以使用所有X服务器扩展,包括加速图形,这是安全风险。 这对于顺利运行有好处,但对安全性有害。 您相信远程程序与本地程序一样安全。

不受信任的 X11转发尝试限制远程程序仅访问自己窗口,并仅使用相对安全的X部分。 这听起来不错,但目前在实践中效果不佳。

-X的含义当前取决于您的ssh配置。

在Ubuntu 14.04 LTS上,除非你编辑你的ssh_config ,否则-X-Y之间没有区别。 “[B]因为太多程序目前在[不受信任]模式下崩溃了。”

 ubuntu1404$ man ssh ... -X Enables X11 forwarding. This can also be specified on a per-host basis in a configuration file. ... (Debian-specific: X11 forwarding is not subjected to X11 SECURITY extension restrictions by default, because too many programs cur‐ rently crash in this mode. Set the ForwardX11Trusted option to “no” to restore the upstream behavior. This may change in future depending on client-side improvements.) ubuntu1404$ grep ForwardX11Trusted /etc/ssh/ssh_config # ForwardX11Trusted yes 

如果ForwardX11Trusted no ,则-X启用不受信任的转发。 否则, -X被视为与-Y相同,相信具有显示访问权限的远程程序是友好的。

是。 -Y用于受信任的 X11转发,而-X用于不受信任的 X11转发。 X11转发只允许您通过SSH会话使用X11(即图形)应用程序。

我不确定受信任和不受信任的X11连接之间有什么明显的区别,但我确定它与服务器端配置(即ssh-config,sshd-config等)有关。 请咨询您的服务器或网络管理员,了解要使用的标志。

-X选项启用X11转发:

 -X Enables X11 forwarding. This can also be specified on a per-host basis in a configuration file. X11 forwarding should be enabled with caution. Users with the ability to bypass file permissions on the remote host (for the user's X authorization database) can access the local X11 display through the forwarded connection. An attacker may then be able to perform activities such as keystroke monitoring. For this reason, X11 forwarding is subjected to X11 SECURITY extension restrictions by default. Please refer to the ssh -Y option and the ForwardX11Trusted directive in ssh_config(5) for more information. 

与ssh_config(5)中的ForwardX11Trusted指令相对应的选项-Y更不安全,因为它删除了X11 SECURITY扩展控件。

 -Y Enables trusted X11 forwarding. Trusted X11 forwardings are not subjected to the X11 SECURITY extension controls. 

使用-x更安全

 -x Disables X11 forwarding.