Closed duanjiong closed 10 months ago
If the ssh server asks you for 2FA, tssh
should support it.
2FA is generally implemented using keyboard interactive authentication
.
Could you provide more information about the 2FA you are using?
If the ssh server asks you for 2FA,
tssh
should support it. 2FA is generally implemented usingkeyboard interactive authentication
. Could you provide more information about the 2FA you are using?
I mean like auto-typing 2FA, the code for 2FA changes all the time, the ones in the docs are currently fixed inputs
2FA Dynamic values can be obtained by scripting oathtool --totp -b ****
Ref: https://www.iots.vip/post/iterm2-jumpserver-totp-autocomplete.html
OK, let's do it with:
Host xxx
OtpCommand1 oathtool --totp -b **** # similar to QuestionAnswer1
encOtpCommand2 23d7bc18fa6661567a43f6d0f26e314dda637b7bd38afa028f3d14fb80c085b666de1b8a05cb21f54a0b8e92c308def52ae967
otp636f64653a20 oathtool --totp -b **** # 636f64653a20 is hex of `code: `
encotp636f64653a20 23d7bc18fa6661567a43f6d0f26e314dda637b7bd38afa028f3d14fb80c085b666de1b8a05cb21f54a0b8e92c308def52ae967
OK, let's do it with:
Host xxx OtpCommand1 oathtool --totp -b **** # similar to QuestionAnswer1 encOtpCommand2 23d7bc18fa6661567a43f6d0f26e314dda637b7bd38afa028f3d14fb80c085b666de1b8a05cb21f54a0b8e92c308def52ae967 otp636f64653a20 oathtool --totp -b **** # 636f64653a20 is hex of `code: ` encotp636f64653a20 23d7bc18fa6661567a43f6d0f26e314dda637b7bd38afa028f3d14fb80c085b666de1b8a05cb21f54a0b8e92c308def52ae967
Is this a feature that will be implemented later? Or is it already supported?
Later, maybe this weekend.
Done in https://github.com/trzsz/trzsz-ssh/commit/f83d4e5f4ba96061fd0e7aa0329a8c051b7ae106
If ControlMaster
multiplexing is enabled or using Warp
terminal, configure as follows:
Host case1
#!! CtrlExpectCount 1
#!! CtrlExpectPattern1 token: # the password prompt
#!! CtrlExpectSendOtp1 oathtool --totp -b ****
Host case2
#!! CtrlExpectCount 1
#!! CtrlExpectPattern1 token: # the password prompt
#!! CtrlExpectSendEncOtp1 23d7bc18fa6661567a43f6d0f26e314dda637b7bd38afa028f3d14fb80c085b666de1b8a05cb21f54a0b8e92c308def52ae967
Good. It's working.
现在 main 分支支持直接配置 totp 的 secret 了,要在 v0.1.19 发布之后生效,或者这样安装 go install github.com/trzsz/trzsz-ssh/cmd/tssh@main
,安装的路径在 ~/go/bin/
。
配置对比: | otp command | totp secret |
---|---|---|
OtpCommand1 oathtool --totp -b **** | TotpSecret1 **** | |
encOtpCommand2 ... | encTotpSecret2 ... | |
otp636f64653a20 oathtool --totp -b **** | totp636f64653a20 **** | |
endotp636f64653a20 ... | enctotp636f64653a20 ... | |
ExpectSendOtp1 oathtool --totp -b **** | ExpectSendTotp1 **** | |
ExpectSendEncOtp1 ... | ExpectSendEncTotp1 ... | |
CtrlExpectSendOtp1 oathtool --totp -b **** | CtrlExpectSendTotp1 **** | |
CtrlExpectSendEncOtp1 ... | CtrlExpectSendEncTotp1 ... |
There is currently no relevant configuration from the documentation