sign_and_send_pubkey: no mutual signature supported (not in PubkeyAcceptedKeyTypes)

发布时间:2019-04-12作者:laosun阅读(8688)

sign_and_send_pubkey:

MacOS升级10.14.4 (18E226)后,SSH版本OpenSSH_7.9p1,不再支持dsa算法。使用iterm2远程免密登录跳板机(堡垒机)失败。 提示不支持相互签名。

    昨天看到了mac新版本的推送升级,忍不住手痒升级了。 结果却导致无法登录公司堡垒机。一直提示以下:

    localhost:.ssh sun$ ssh -i /Users/sun/.ssh/你猜这是啥 用户名@IP -p 端口
    sign_and_send_pubkey: no mutual signature supported

    提示不支持提示不支持相互签名,网上查找这个问题一直找不到答案。

    后来使用以下指令进行分析

    localhost:.ssh sun$ ssh -i /Users/sun/.ssh/你猜这是啥 用户名@IP -p 端口 -v
    打印了很多详细信息,其中包含以下一句话
    debug1: Skipping ssh-dss key 你猜这是啥 - not in PubkeyAcceptedKeyTypes

    后来经过网上查询资料,发现自己的mac使用的openssh版本是最新版本 7.9。

    localhost:.ssh sun$ ssh -V
    OpenSSH_7.9p1, LibreSSL 2.7.3

    下面我们来看下网上给出的解释:

    The new openssh version (7.0+) deprecated DSA keys and is not using DSA keys by default (not on server or client). The keys are not preferred to be used anymore, so if you can, I would recommend to use RSA keys where possible.
    
    If you really need to use DSA keys, you need to explicitly allow them in your client config using 
    ``` shell
    PubkeyAcceptedKeyTypes +ssh-dss
    ```
    Should be enough to put that line in ~/.ssh/config, as the verbose message is trying to tell you.

    大概意思就是:

    新的OpenSSH版本(7.0+)不推荐使用DSA密钥,默认情况下不使用DSA密钥(不在服务器或客户端上)。这些密钥不再被使用,因此如果可以,我建议尽可能使用RSA密钥。
    如果确实需要使用DSA密钥,则需要在客户端配置中使用
    PubKeyAcceptedKeyTypes+ssh-dss
    应该将该行放入~/.ssh/config中

    根据提示我们进入当前用户的根目录。

    localhost:.ssh sun$ cd ~/.ssh/
    localhost:.ssh sun$ vim config

    编辑创建一个文件,名字为config

    增加以下一句话:

    Host *
        PubkeyAcceptedKeyTypes=+ssh-dss

    保存退出,设置权限为600

    localhost:.ssh sun$ chmod 600 config   #权限太高了可是无法执行的

    现在再使用上边的语句进行登录

    localhost:.ssh sun$ ssh -i /Users/sun/.ssh/你猜这是啥 用户名@IP -p 端口
    Last login: Fri Apr 12 10:23:28 2019 from xxx.xxx.xxx.xxx
    
    Welcome to Alibaba Cloud Elastic Compute Service !
    
    Enter your Verifycode or exit:


    我的mac上之前好像也应该是openssh7以上的版本,我怀疑是mac本次升级对安全方面的操作进行了优化。所以去掉了dsa的支持!


    完美解决!

4 +1

版权声明

 Mac  电脑

 请文明留言

0 条评论