From 2589737e1e39b93f516cae84624ac1cc1cbf4d5a Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Fri, 8 Jan 2021 13:33:22 -0500 Subject: [PATCH] Public key auth test passes. --- integration/test_sftp.py | 8 +++++--- integration/util.py | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/integration/test_sftp.py b/integration/test_sftp.py index f9a7830ac..51d3f15c3 100644 --- a/integration/test_sftp.py +++ b/integration/test_sftp.py @@ -19,6 +19,7 @@ from paramiko import SSHClient from paramiko.client import AutoAddPolicy from paramiko.sftp_client import SFTPClient from paramiko.ssh_exception import AuthenticationException +from paramiko.rsakey import RSAKey import pytest @@ -27,7 +28,8 @@ def connect_sftp(connect_args={"username": "alice", "password": "password"}): """Create an SFTP client.""" client = SSHClient() client.set_missing_host_key_policy(AutoAddPolicy) - client.connect("localhost", port=8022, look_for_keys=False, **connect_args) + client.connect("localhost", port=8022, look_for_keys=False, + allow_agent=False, **connect_args) sftp = SFTPClient.from_transport(client.get_transport()) def rmdir(path, delete_root=True): @@ -60,9 +62,9 @@ def test_bad_account_password_ssh_key(alice): def test_ssh_key_auth(alice): """It's possible to login authenticating with SSH public key.""" - key_filename = join(alice.node_dir, "private", "ssh_client_rsa_key") + key = RSAKey(filename=join(alice.node_dir, "private", "ssh_client_rsa_key")) sftp = connect_sftp(connect_args={ - "username": "alice2", "key_filename": key_filename + "username": "alice2", "pkey": key }) assert sftp.listdir() == [] diff --git a/integration/util.py b/integration/util.py index 0e8fea2be..d4c09d073 100644 --- a/integration/util.py +++ b/integration/util.py @@ -510,5 +510,5 @@ def await_client_ready(tahoe, timeout=10, liveness=60*2): def generate_ssh_key(path): """Create a new SSH private/public key pair.""" - check_call(["ckeygen", "--type", "rsa", "--no-passphrase", "--bits", "512", - "--file", path]) + check_call(["ckeygen", "--type", "rsa", "--no-passphrase", "--bits", "2048", + "--file", path, "--private-key-subtype", "v1"])