paramiko/transport.py | 4 +++- tests/test_client.py | 19 +++++++++---------- tests/test_kex_gss.py | 7 +++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/paramiko/transport.py b/paramiko/transport.py index 98cdae03..0795b543 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -843,7 +843,9 @@ class Transport(threading.Thread, ClosingContextManager): """ Transport._modulus_pack = ModulusPack() # places to look for the openssh "moduli" file - file_list = ["/etc/ssh/moduli", "/usr/local/etc/moduli"] + file_list = ["/etc/ssh/moduli", + "/etc/openssh/moduli", + "/usr/local/etc/moduli"] if filename is not None: file_list.insert(0, filename) for fn in file_list: diff --git a/tests/test_client.py b/tests/test_client.py index 21ecd72a..0cae4ab4 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -33,7 +33,6 @@ import weakref from tempfile import mkstemp import pytest -from pytest_relaxed import raises from unittest.mock import patch, Mock import paramiko @@ -810,11 +809,11 @@ class PasswordPassphraseTests(ClientTest): # TODO: more granular exception pending #387; should be signaling "no auth # methods available" because no key and no password - @raises(SSHException) @requires_sha1_signing def test_passphrase_kwarg_not_used_for_password_auth(self): - # Using the "right" password in the "wrong" field shouldn't work. - self._test_connection(passphrase="pygmalion") + with pytest.raises(SSHException): + # Using the "right" password in the "wrong" field shouldn't work. + self._test_connection(passphrase="pygmalion") @requires_sha1_signing def test_passphrase_kwarg_used_for_key_passphrase(self): @@ -834,15 +833,15 @@ class PasswordPassphraseTests(ClientTest): password="television", ) - @raises(AuthenticationException) # TODO: more granular @requires_sha1_signing def test_password_kwarg_not_used_for_passphrase_when_passphrase_kwarg_given( # noqa self, ): # Sanity: if we're given both fields, the password field is NOT used as # a passphrase. - self._test_connection( - key_filename=_support("test_rsa_password.key"), - password="television", - passphrase="wat? lol no", - ) + with pytest.raises(AuthenticationException): + self._test_connection( + key_filename=_support("test_rsa_password.key"), + password="television", + passphrase="wat? lol no", + ) diff --git a/tests/test_kex_gss.py b/tests/test_kex_gss.py index d4868f4a..60c4ed71 100644 --- a/tests/test_kex_gss.py +++ b/tests/test_kex_gss.py @@ -30,6 +30,7 @@ import threading import unittest import paramiko +import pytest from .util import needs_gssapi, KerberosTestCase, update_env @@ -59,6 +60,8 @@ class NullServer(paramiko.ServerInterface): @needs_gssapi +@pytest.mark.skipif(not paramiko.Transport.load_server_moduli(), + reason="Failed to load moduli -- gex will be unsupported") class GSSKexTest(KerberosTestCase): def setUp(self): self.username = self.realm.user_princ @@ -83,10 +86,6 @@ class GSSKexTest(KerberosTestCase): host_key = paramiko.RSAKey.from_private_key_file("tests/test_rsa.key") self.ts.add_server_key(host_key) self.ts.set_gss_host(self.realm.hostname) - try: - self.ts.load_server_moduli() - except: - print("(Failed to load moduli -- gex will be unsupported.)") server = NullServer() self.ts.start_server(self.event, server)