Improve host key verification
还没有人认领这个 Issue。
评估
调研方向
首先跟踪 MakeConfig 到 crypto/ssh ClientConfig,并检查 fingerprint verification 如何连接到 host-key callback。比较可用的 HostKeyAlgorithms 配置选项和 FixedHostKey callback 选项;完成的标准是调用方可以限制 host-key 选择,或验证完整的公钥,而不依赖于更改默认值。
由索引模型根据 Issue 内容生成。
描述
Currently host key verification is done by checking if the host key fingerprint matches the expected one. This has a flaw in that it assumes that the server host key type will always be the one we are expecting. Servers can have multiple different host keys of different types. The host key selection is done based on the SSH protocol specification, from RFC4253 section 7.1:
server_host_key_algorithms
A name-list of the algorithms supported for the server host
key. The server lists the algorithms for which it has host
keys; the client lists the algorithms that it is willing to
accept. There MAY be multiple host keys for a host, possibly
with different algorithms.
Some host keys may not support both signatures and encryption
(this can be determined from the algorithm), and thus not all
host keys are valid for all key exchange methods.
Algorithm selection depends on whether the chosen key exchange
algorithm requires a signature or an encryption-capable host
key. It MUST be possible to determine this from the public key
algorithm name. The first algorithm on the client's name-list
that satisfies the requirements and is also supported by the
server MUST be chosen. If there is no such algorithm, both
sides MUST disconnect.
This means that the client can choose which host key will be selected based on the sorted list of host key algorithms it sends to the server. This is also described here: https://www.bitvise.com/ssh-server-guide-host-keys
crypto/ssh has a way to set this list in ClientConfig:
// HostKeyAlgorithms lists the key types that the client will
// accept from the server as host key, in order of
// preference. If empty, a reasonable default is used. Any
// string returned from PublicKey.Type method may be used, or
// any of the CertAlgoXxxx and KeyAlgoXxxx constants.
HostKeyAlgorithms []string
easyssh doesn't set this list so it relies on crypto/ssh defaults which may change in the future. This means a crypto/ssh version update may break existing programs that use easyssh with fingerprint verification.
An easy improvement would be to allow specifying this list via MakeConfig. "Any string returned from PublicKey.Type method may be used", these are probably constant. Thus the host key type would always be guaranteed to match the key fingerprint.
Another improvement would be to be able to use func FixedHostKey as HostKeyCallback to allow specifying the full host public key to verify, not just the fingerprint, which would also be more secure.
- 主要语言
- Go
- 星标
- 349
- 派生
- 64
- 平均合并
- 2 小时 29 分钟
- 30 天内合并 PR
- 2
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
appleboy/easyssh-proxy 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 42/100
appleboy/easyssh-proxy#100 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 30/100
appleboy/easyssh-proxy#92 ·
-
难度 3/5 1-2 天 新手友好度 35/100
appleboy/easyssh-proxy#88 ·
-
难度 2/5 1-3 小时 新手友好度 25/100
appleboy/easyssh-proxy#71 ·
-
难度 3/5 1-2 天 新手友好度 25/100
appleboy/easyssh-proxy#69 · 1 条评论 ·
查看 appleboy/easyssh-proxy 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
gruntwork-io/boilerplate#329 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
prime-radiant-inc/evener#3291 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
Netcracker/qubership-apihub-backend#582 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复