From 0373baef425a15eeaf72c7bd0c632f721c8e270d Mon Sep 17 00:00:00 2001 From: vapao Date: Wed, 20 Apr 2022 11:41:57 +0800 Subject: [PATCH] =?UTF-8?q?F=20=E4=BF=AE=E5=A4=8Dssh=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E6=80=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/libs/ssh.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spug_api/libs/ssh.py b/spug_api/libs/ssh.py index 989460e..33d46fc 100644 --- a/spug_api/libs/ssh.py +++ b/spug_api/libs/ssh.py @@ -3,12 +3,24 @@ # Released under the AGPL-3.0 License. from paramiko.client import SSHClient, AutoAddPolicy from paramiko.rsakey import RSAKey +from paramiko.transport import Transport from paramiko.ssh_exception import AuthenticationException from io import StringIO from uuid import uuid4 import time import re +Transport._preferred_pubkeys = ( + "ssh-ed25519", + "ecdsa-sha2-nistp256", + "ecdsa-sha2-nistp384", + "ecdsa-sha2-nistp521", + "ssh-rsa", + "rsa-sha2-256", + "rsa-sha2-512", + "ssh-dss", +) + class SSH: def __init__(self, hostname, port=22, username='root', pkey=None, password=None, default_env=None,