Paramiko - 不兼容的 SSH 服务器(没有可接受的 mac) [英] Paramiko - Incompatible SSH server (no acceptable macs)

查看:235
本文介绍了Paramiko - 不兼容的 SSH 服务器(没有可接受的 mac)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 paramiko 一段时间了,一切都按预期工作,但是当我离开测试环境时,在打开 ssh 会话时出现此错误

paramiko.ssh_exception.SSHException: 不兼容的 ssh 服务器(没有可接受的 mac)

追踪错误后,我注意到在我的远程服务器上,我的 /etc/ssh/sshd_config 文件中缺少一些条目.我的设置都没有列出这些 MAC:

  • HMAC-SHA1
  • HMAC-MD5
  • HMAC-SHA1-96
  • HMAC-MD5-96

然而,它适用于一个而不是另一个.什么可能导致这种情况?我没有在任何一个中保存 rsa 密钥(远程服务器不允许写入).

远程服务器的sshd_config

<预><代码>## 允许密码和 MAC#密码 aes256-ctr,aes192-ctr,aes128-ctr,arcfour256,arcfour128MAC umac-64@openssh.com,hmac-ripemd160,hmac-sha2-512,hmac-sha2-256

RemoteAccess.py

class RemoteAccess():def __init__(self, host="abc123", username="abc", password="123"):self.name = 主机self.client = paramiko.SSHClient()self.client.load_system_host_keys()self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())self.client.connect(主机,用户名=用户名,密码=密码)

我引用的链接:

Python - Paramiko - 不兼容的 ssh 服务器

paramiko 不兼容的 ssh peer(没有可接受的 kex 算法)

解决方案

出于某种原因,paramiko1.15.1 会抱怨 MAC 不兼容.paramiko1.16.0 没有.已通过将 1.16.0 文件复制到其安装位置来修复此问题.

/usr/lib/python2.7/site-packages/paramiko

paramiko 版本的更新日志可以在这里找到:http://www.paramiko.org/changelog.html

I've been using paramiko for a while and everything has worked as expected, but when I moved out of my testing environment, I got this error when opening an ssh session

paramiko.ssh_exception.SSHException: Incompatible ssh server (no acceptable macs)

After tracing down the error, I noticed that on my remote server, I'm missing some entries in my /etc/ssh/sshd_config file. Neither of my setups have these MACs listed:

  • HMAC-SHA1
  • HMAC-MD5
  • HMAC-SHA1-96
  • HMAC-MD5-96

However, it works in one and not the other. What could be causing this? I don't have rsa keys saved in either one (remote server does not allow for writing).

Remote server's sshd_config

#
# Allow Ciphers and MACs
#
Ciphers aes256-ctr,aes192-ctr,aes128-ctr,arcfour256,arcfour128
MACs umac-64@openssh.com,hmac-ripemd160,hmac-sha2-512,hmac-sha2-256

RemoteAccess.py

class RemoteAccess():
    def __init__(self, host="abc123", username="abc", password="123"):
        self.name = host
        self.client = paramiko.SSHClient()
        self.client.load_system_host_keys()
        self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        self.client.connect(host, username=username, password=password)

Links I've referenced:

Python - Paramiko - incompatible ssh server

paramiko Incompatible ssh peer (no acceptable kex algorithm)

解决方案

For some reason, paramiko1.15.1 would complain about incompatible MACs. paramiko1.16.0 did not. This was fixed by copying 1.16.0 files to its installation location.

/usr/lib/python2.7/site-packages/paramiko

Changelog for paramiko versions can be found here: http://www.paramiko.org/changelog.html

这篇关于Paramiko - 不兼容的 SSH 服务器(没有可接受的 mac)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆