OpenSSH


SSH(Secure Shell)是为解决这些缺陷而创建的协议。它在不安全的网络上建立安全连接。它采用客户端-服务器架构,客户端是指试图连接远程服务器的机器;SSH 对客户机和服务器进行身份验证。它规定了客户端和服务器如何就共享秘密达成一致,以便随后对数据包进行加密。最后,它还提供数据完整性保护。SSH 有两个版本:SSH-1 和 SSH-2,前者已经基本上放弃使用了,SSH-2 由 IETF 标准化。
OpenSSH 是一组用于安全地访问远程计算机的连接工具,它可以作为 rlogin、rsh、rcp 以及 telnet 的直接替代品使用。更进一步,其他任何TCP/IP连接都可以通过 SSH 安全地进行隧道和转发。OpenSSH 是 100% 完整的 SSH 协议 2.0 版本的实现,并且包括 sftp 客户端和服务器支持,它用于远程登录的主要连接工具。它对所有流量进行加密,避免窃听、连接劫持等攻击。此外它还提供了一整套安全隧道功能、多种身份验证方法和复杂的配置选项。采用C语言开发并在BSD协议下授权使用。
OpenSSH 对所有的传输进行加密,从而有效地阻止了窃听、连接劫持,以及其他网络级的攻击。它使用SSH透过计算机网络加密通讯的实现。它是取代由SSH Communications Security所提供的商用版本的开放源代码方案。目前OpenSSH是OpenBSD的子计划。其常常被误认以为与OpenSSL有关系,但实际上这两个计划的有不同的目的,不同的发展团队,名称相近只是因为两者有同样的软件发展目标--提供开放源代码的加密通信软件。OpenSSH是在1999年10月第一次在OpenBSD 2.6里出现,当初的计划是取代由SSH Communications Security所提供的SSH软件。
OpenSSH 由OpenBSD Project维护,它基于 SSH v1.2.12 并包含了最新的错误修复和更新,它同时兼容 SSH 协议的 1 和 2 两个版本。从 FreeBSD 4.0 开始,OpenSSH 成为了基本系统的一部分。通常使用 telnet 或 rlogin时,数据是以明码的形式发送的,并没有加密。在客户机和服务器之间的网络上运行的听包程序可以在会话中偷窃到传输的用户名、密码和数据,而 OpenSSH 提供了多种的身份验证和加密方法来防止这种情况的发生。
程序主要包括了几个部份:
* ssh
rlogin与Telnet的替代方案。
* scp、sftp
rcp的替代方案,将文件复制到其他电脑上。
* sshd
SSH服务器。
* ssh-keygen
产生RSA或DSA金钥,用来认证用。
* ssh-agent、ssh-add
帮助用户不需要每次都要输入金钥密码的工具。
* ssh-keyscan
扫描一群机器,并纪录其公钥。

OpenSSH is a FREE version of the SSH connectivity tools that technical users of the Internet rely on. Users of telnet, rlogin, and ftp may not realize that their password is transmitted across the Internet unencrypted, but it is. OpenSSH encrypts all traffic (including passwords) to effectively eliminate eavesdropping, connection hijacking, and other attacks. Additionally, OpenSSH provides secure tunneling capabilities and several authentication methods, and supports all SSH protocol versions.
The OpenSSH suite replaces rlogin and telnet with the ssh program, rcp with scp, and ftp with sftp. Also included is sshd (the server side of the package), and the other utilities like ssh-add, ssh-agent, ssh-keysign, ssh-keyscan, ssh-keygen and sftp-server.
OpenSSH is developed by the OpenBSD Project. The software is developed in countries that permit cryptography export and is freely useable and re-useable by everyone under a BSD license. However, development has costs, so if you find OpenSSH useful (particularly if you use it in a commercial system that is distributed) please consider donating to help fund the project.
OpenSSH is developed by two teams. One team does strictly OpenBSD-based development, aim to produce code that is as clean, simple, and secure as possible. We believe that simplicity without the portability "goop" allows for better code quality control and easier review. The other team then takes the clean version and makes it portable (adding the "goop") to make it run on many operating systems -- the so-called -p releases, ie "OpenSSH 5.8p1".
Please take note of our Who uses it page, which list just some of the vendors who incorporate OpenSSH into their own products -- as a critically important security / access feature -- instead of writing their own SSH implementation or purchasing one from another vendor. This list specifically includes companies like Cisco, Juniper, Apple, Red Hat, and Novell; but probably includes almost all router, switch or unix-like operating system vendors. In the 10 years since the inception of the OpenSSH project, these companies have contributed not even a dime of thanks in support of the OpenSSH project (despite numerous requests).
SSH 的三个主要层:传输层、验证层和连接层(图源于ByteByteGo,感谢原作者)。

1、传输层
传输层提供加密、完整性和数据保护,确保客户端和服务器之间的通信安全。
第 1 步 - 建立 TCP 连接
客户端启动与 SSH 服务器的 TCP 连接,通常是在 22 端口。
第 2 步 - 协议版本交换
客户端和服务器交换包含各自支持的 SSH 协议版本的标识字符串。
第 3 步 - 算法协商
客户端和服务器就加密、密钥交换、MAC(消息验证码)和压缩所使用的加密算法达成一致。
第 4 步 - 密钥交换
密钥交换算法(如 Diffie-Hellman)用于安全生成共享秘密。这一过程可确保双方在不直接传输的情况下获得相同的会话密钥。
第 5 步 - 会话密钥推导
会话密钥是从共享秘密和其他交换信息中推导出来的。这些密钥用于加密和解密通信。
第 6 步 - 密码初始化
双方使用导出的会话密钥初始化各自选择的加密和 MAC 算法。
第 7 步 - 数据完整性和加密
传输层为客户端和服务器之间的所有后续通信提供数据完整性检查和加密。
2、验证层
验证层验证客户端的身份,确保只有授权用户才能访问服务器。
第 1 步 - 服务请求
客户端请求 "ssh-userauth "服务。
第 2 步 - 身份验证方法广告
服务器公布可用的身份验证方法(如密码、公钥、键盘交互)。
第 3 步 - 客户端身份验证
客户端尝试使用一种或多种可用方法进行身份验证。常见方法包括:
密码验证:客户端向服务器发送密码,由服务器进行验证。
公钥验证:客户端证明拥有与先前注册的公钥相对应的私钥。
键盘交互式身份验证:服务器向客户端发送提示,客户端回复所需的信息(如 OTP、安全问题)。
第 4 步 - 身份验证成功/失败
如果客户端的凭据有效,服务器将允许访问。否则,客户端可尝试其他认证方法或关闭连接。
3、连接层
连接层将加密和认证通信复用为多个逻辑通道。
第 1 步 - 创建通道
客户端请求为各种类型的通信(如 shell 会话、文件传输、端口转发)打开通道。
第 2 步 - 信道请求
每个通道请求包括所需服务类型和任何附加参数等详细信息。
第 3 步 - 信道数据传输
数据通过已建立的信道传输。每个通道独立运行,允许多个服务在一个 SSH 连接上同时运行。
第 4 步 - 关闭通道
通道可以相互独立关闭,而不会影响整个 SSH 连接。关闭所有通道后,客户端即可终止 SSH 会话。
第 5 步 - 全局请求
连接层还支持全局请求,全局请求会影响整个连接而不是单个通道(例如,重新加密钥会话)。
OpenSSH 增加对存储在 RAM 中的私钥的保护
Google 的 OpenBSD 开发人员和安全研究员 Damien Miller 对 OpenSSH 进行修改,增加了对存储在 RAM 中的私钥的保护,让攻击者更难利用硬件漏洞的侧通道攻击来提取私钥。他解释说,用于保护内存中私钥的对称密钥来自由随机数据(目前是 16 KB)组成的一个相对较大的 prekey。而工作方式是,密钥在加载到内存中时被加密,并在需要签名或必须保存时解密。虽然这种预防措施并不是应对硬件攻击的完整解决方案,但它确实会使攻击者更难获得成功。Damien Miller 分析说,“攻击者必须以高精度恢复整个 prekey,然后才能尝试解密被屏蔽的私钥,但是目前的攻击具有比特错误率,要想累加到整个prekey,这显然是不可能的。”这并不是长久之计,Damien 表示,当计算机架构变得安全的时候,才可以彻底消除这个问题。
OpenSSH更新记录集
OpenSSH中高危漏洞集合
项目主页:http://www.openssh.com/
OpenSSH 是一组用于安全地访问远程计算机的连接工具,它可以作为 rlogin、rsh、rcp 以及 telnet 的直接替代品使用。更进一步,其他任何TCP/IP连接都可以通过 SSH 安全地进行隧道和转发。OpenSSH 是 100% 完整的 SSH 协议 2.0 版本的实现,并且包括 sftp 客户端和服务器支持,它用于远程登录的主要连接工具。它对所有流量进行加密,避免窃听、连接劫持等攻击。此外它还提供了一整套安全隧道功能、多种身份验证方法和复杂的配置选项。采用C语言开发并在BSD协议下授权使用。
OpenSSH 对所有的传输进行加密,从而有效地阻止了窃听、连接劫持,以及其他网络级的攻击。它使用SSH透过计算机网络加密通讯的实现。它是取代由SSH Communications Security所提供的商用版本的开放源代码方案。目前OpenSSH是OpenBSD的子计划。其常常被误认以为与OpenSSL有关系,但实际上这两个计划的有不同的目的,不同的发展团队,名称相近只是因为两者有同样的软件发展目标--提供开放源代码的加密通信软件。OpenSSH是在1999年10月第一次在OpenBSD 2.6里出现,当初的计划是取代由SSH Communications Security所提供的SSH软件。
OpenSSH 由OpenBSD Project维护,它基于 SSH v1.2.12 并包含了最新的错误修复和更新,它同时兼容 SSH 协议的 1 和 2 两个版本。从 FreeBSD 4.0 开始,OpenSSH 成为了基本系统的一部分。通常使用 telnet 或 rlogin时,数据是以明码的形式发送的,并没有加密。在客户机和服务器之间的网络上运行的听包程序可以在会话中偷窃到传输的用户名、密码和数据,而 OpenSSH 提供了多种的身份验证和加密方法来防止这种情况的发生。
程序主要包括了几个部份:
* ssh
rlogin与Telnet的替代方案。
* scp、sftp
rcp的替代方案,将文件复制到其他电脑上。
* sshd
SSH服务器。
* ssh-keygen
产生RSA或DSA金钥,用来认证用。
* ssh-agent、ssh-add
帮助用户不需要每次都要输入金钥密码的工具。
* ssh-keyscan
扫描一群机器,并纪录其公钥。

OpenSSH is a FREE version of the SSH connectivity tools that technical users of the Internet rely on. Users of telnet, rlogin, and ftp may not realize that their password is transmitted across the Internet unencrypted, but it is. OpenSSH encrypts all traffic (including passwords) to effectively eliminate eavesdropping, connection hijacking, and other attacks. Additionally, OpenSSH provides secure tunneling capabilities and several authentication methods, and supports all SSH protocol versions.
The OpenSSH suite replaces rlogin and telnet with the ssh program, rcp with scp, and ftp with sftp. Also included is sshd (the server side of the package), and the other utilities like ssh-add, ssh-agent, ssh-keysign, ssh-keyscan, ssh-keygen and sftp-server.
OpenSSH is developed by the OpenBSD Project. The software is developed in countries that permit cryptography export and is freely useable and re-useable by everyone under a BSD license. However, development has costs, so if you find OpenSSH useful (particularly if you use it in a commercial system that is distributed) please consider donating to help fund the project.
OpenSSH is developed by two teams. One team does strictly OpenBSD-based development, aim to produce code that is as clean, simple, and secure as possible. We believe that simplicity without the portability "goop" allows for better code quality control and easier review. The other team then takes the clean version and makes it portable (adding the "goop") to make it run on many operating systems -- the so-called -p releases, ie "OpenSSH 5.8p1".
Please take note of our Who uses it page, which list just some of the vendors who incorporate OpenSSH into their own products -- as a critically important security / access feature -- instead of writing their own SSH implementation or purchasing one from another vendor. This list specifically includes companies like Cisco, Juniper, Apple, Red Hat, and Novell; but probably includes almost all router, switch or unix-like operating system vendors. In the 10 years since the inception of the OpenSSH project, these companies have contributed not even a dime of thanks in support of the OpenSSH project (despite numerous requests).
SSH 的三个主要层:传输层、验证层和连接层(图源于ByteByteGo,感谢原作者)。

1、传输层
传输层提供加密、完整性和数据保护,确保客户端和服务器之间的通信安全。
第 1 步 - 建立 TCP 连接
客户端启动与 SSH 服务器的 TCP 连接,通常是在 22 端口。
第 2 步 - 协议版本交换
客户端和服务器交换包含各自支持的 SSH 协议版本的标识字符串。
第 3 步 - 算法协商
客户端和服务器就加密、密钥交换、MAC(消息验证码)和压缩所使用的加密算法达成一致。
第 4 步 - 密钥交换
密钥交换算法(如 Diffie-Hellman)用于安全生成共享秘密。这一过程可确保双方在不直接传输的情况下获得相同的会话密钥。
第 5 步 - 会话密钥推导
会话密钥是从共享秘密和其他交换信息中推导出来的。这些密钥用于加密和解密通信。
第 6 步 - 密码初始化
双方使用导出的会话密钥初始化各自选择的加密和 MAC 算法。
第 7 步 - 数据完整性和加密
传输层为客户端和服务器之间的所有后续通信提供数据完整性检查和加密。
2、验证层
验证层验证客户端的身份,确保只有授权用户才能访问服务器。
第 1 步 - 服务请求
客户端请求 "ssh-userauth "服务。
第 2 步 - 身份验证方法广告
服务器公布可用的身份验证方法(如密码、公钥、键盘交互)。
第 3 步 - 客户端身份验证
客户端尝试使用一种或多种可用方法进行身份验证。常见方法包括:
密码验证:客户端向服务器发送密码,由服务器进行验证。
公钥验证:客户端证明拥有与先前注册的公钥相对应的私钥。
键盘交互式身份验证:服务器向客户端发送提示,客户端回复所需的信息(如 OTP、安全问题)。
第 4 步 - 身份验证成功/失败
如果客户端的凭据有效,服务器将允许访问。否则,客户端可尝试其他认证方法或关闭连接。
3、连接层
连接层将加密和认证通信复用为多个逻辑通道。
第 1 步 - 创建通道
客户端请求为各种类型的通信(如 shell 会话、文件传输、端口转发)打开通道。
第 2 步 - 信道请求
每个通道请求包括所需服务类型和任何附加参数等详细信息。
第 3 步 - 信道数据传输
数据通过已建立的信道传输。每个通道独立运行,允许多个服务在一个 SSH 连接上同时运行。
第 4 步 - 关闭通道
通道可以相互独立关闭,而不会影响整个 SSH 连接。关闭所有通道后,客户端即可终止 SSH 会话。
第 5 步 - 全局请求
连接层还支持全局请求,全局请求会影响整个连接而不是单个通道(例如,重新加密钥会话)。
OpenSSH 增加对存储在 RAM 中的私钥的保护
Google 的 OpenBSD 开发人员和安全研究员 Damien Miller 对 OpenSSH 进行修改,增加了对存储在 RAM 中的私钥的保护,让攻击者更难利用硬件漏洞的侧通道攻击来提取私钥。他解释说,用于保护内存中私钥的对称密钥来自由随机数据(目前是 16 KB)组成的一个相对较大的 prekey。而工作方式是,密钥在加载到内存中时被加密,并在需要签名或必须保存时解密。虽然这种预防措施并不是应对硬件攻击的完整解决方案,但它确实会使攻击者更难获得成功。Damien Miller 分析说,“攻击者必须以高精度恢复整个 prekey,然后才能尝试解密被屏蔽的私钥,但是目前的攻击具有比特错误率,要想累加到整个prekey,这显然是不可能的。”这并不是长久之计,Damien 表示,当计算机架构变得安全的时候,才可以彻底消除这个问题。
OpenSSH更新记录集
OpenSSH中高危漏洞集合
项目主页:http://www.openssh.com/
该文章最后由 阿炯 于 2024-08-10 22:00:12 更新,目前是第 2 版。