Commit 7d6cab47 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

slaprunner and seleniumserver: Use ecdsa SSH keys in tests

After upgrade to OpensSSH 8.8p1 the simple ssh-rsa keys are not accepted
anymore.
parent 7bcfb178
Pipeline #17788 failed with stage
in 0 seconds
...@@ -337,8 +337,8 @@ class TestFrontend(WebServerMixin, SeleniumServerTestCase): ...@@ -337,8 +337,8 @@ class TestFrontend(WebServerMixin, SeleniumServerTestCase):
class TestSSHServer(SeleniumServerTestCase): class TestSSHServer(SeleniumServerTestCase):
@classmethod @classmethod
def getInstanceParameterDict(cls): def getInstanceParameterDict(cls):
cls.ssh_key = paramiko.RSAKey.generate(1024) cls.ssh_key = paramiko.ECDSAKey.generate(bits=384)
return {'ssh-authorized-key': 'ssh-rsa {}'.format(cls.ssh_key.get_base64())} return {'ssh-authorized-key': 'ecdsa-sha2-nistp384 {}'.format(cls.ssh_key.get_base64())}
def test_connect(self): def test_connect(self):
parameter_dict = self.computer_partition.getConnectionParameterDict() parameter_dict = self.computer_partition.getConnectionParameterDict()
......
...@@ -339,9 +339,9 @@ class TestWeb(SlaprunnerTestCase): ...@@ -339,9 +339,9 @@ class TestWeb(SlaprunnerTestCase):
class TestSSH(SlaprunnerTestCase): class TestSSH(SlaprunnerTestCase):
@classmethod @classmethod
def getInstanceParameterDict(cls): def getInstanceParameterDict(cls):
cls.ssh_key_list = [paramiko.RSAKey.generate(1024) for i in range(2)] cls.ssh_key_list = [paramiko.ECDSAKey.generate(bits=384) for i in range(2)]
return { return {
'user-authorized-key': 'ssh-rsa {}\nssh-rsa {}'.format( 'user-authorized-key': 'ecdsa-sha2-nistp384 {}\necdsa-sha2-nistp384 {}'.format(
*[key.get_base64() for key in cls.ssh_key_list] *[key.get_base64() for key in cls.ssh_key_list]
) )
} }
...@@ -363,7 +363,7 @@ class TestSSH(SlaprunnerTestCase): ...@@ -363,7 +363,7 @@ class TestSSH(SlaprunnerTestCase):
username, fingerprint_from_url = ssh_info.split(';fingerprint=') username, fingerprint_from_url = ssh_info.split(';fingerprint=')
client = paramiko.SSHClient() client = paramiko.SSHClient()
self.assertTrue(fingerprint_from_url.startswith('ssh-rsa-'), '') self.assertTrue(fingerprint_from_url.startswith('ssh-rsa-'), fingerprint_from_url)
fingerprint_from_url = fingerprint_from_url[len('ssh-rsa-'):] fingerprint_from_url = fingerprint_from_url[len('ssh-rsa-'):]
class KeyPolicy(object): class KeyPolicy(object):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment