Skip to content

tssh和ssh连接算法有差异,openssh可以连,但tssh连不上 #208

@ViCrack

Description

@ViCrack

我发现某次连接ssh,tss连接不上,但是OpenSSH是可以连的

我执行了--debug和ssh -vv进行对比日志,下面是AI说的,不知道是不是这个算法选的原因

同一台服务器、同一把 RSA 密钥

对比两份日志的关键差异:

✅ 普通 ssh 成功时

关键行:

Server accepts key: default RSA SHA256:xxxxxxxxx...
signing using rsa-sha2-512
Authenticated ... using "publickey"


也就是说:

使用的 key:SHA256:xxxxxxxxx...

签名算法:rsa-sha2-512

认证成功

❌ tssh 失败时

关键行:

sign with algorithm [rsa-sha2-256]
unable to authenticate


也就是说:

使用的 key:同一把(SHA256:xxxxxxxxx...)

签名算法:rsa-sha2-256

服务器拒绝

🎯 结论

问题不是 key。
问题是 签名算法不同。

普通 ssh 使用:

rsa-sha2-512


而 tssh 使用:

rsa-sha2-256


服务器虽然在 KEX 阶段声明支持:

rsa-sha2-512,rsa-sha2-256


但实际 authorized_keys 校验时,很可能存在限制(例如旧 sshd 或策略限制)。

OpenSSH 在 9.x 中默认优先使用 rsa-sha2-512。
tssh 当前版本优先使用 rsa-sha2-256。

这就是认证失败的原因。

tssh日志如下(有修改)

debug: tssh version: trzsz ssh 0.1.24-4d86ba8
debug: open C:\Users\cdgfa.tssh.conf success
debug: Language = Chinese
debug: open config [C:\Users\cdgfa.ssh\config] success
debug: decode config [C:\Users\cdgfa.ssh\config] success
debug: extended config [C:\Users\cdgfa.ssh\password] does not exist
debug: no extended config [DnsSrvName] for [example.com]
debug: no extended config [UdpMode] for [example.com]
debug: new ssh agent client [\.\pipe\openssh-ssh-agent] success
debug: will attempt key: ssh-agent ssh-rsa SHA256:sdfdsjiogfkoprejtihierbgytretertrt
debug: add auth method: public key authentication
debug: disable auth method: gssapi-with-mic authentication
debug: add auth method: keyboard interactive authentication
debug: add auth method: password authentication
debug: add UserKnownHostsFile: C:\Users\cdgfa.ssh\known_hosts
debug: UserKnownHostsFile [C:\Users\cdgfa.ssh\known_hosts2] does not exist
debug: GlobalKnownHostsFile [/etc/ssh/ssh_known_hosts] does not exist
debug: GlobalKnownHostsFile [/etc/ssh/ssh_known_hosts2] does not exist
debug: login to [example.com] addr: example.com:22
debug: sign with algorithm [rsa-sha2-256]: SHA256:sdfdsjiogfkoprejtihierbgytretertrt
login to [example.com] new conn [example.com:22] failed: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

ssh日志如下

debug1: Server accepts key: default RSA SHA256:xxxx...
debug3: sign_and_send_pubkey: using publickey-hostbound-v00@openssh.com with RSA SHA256:xxxxx...
debug3: sign_and_send_pubkey: signing using rsa-sha2-512 SHA256:xxxxx...

可以看到tssh日志中使用了rsa-sha2-256,ssh中使用了rsa-sha2-512

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions