mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-07-30 08:07:56 -05:00
ipatests: ui_driver: convert run_cmd_on_ui_host to tasks.py::run_ssh_cmd
Paramiko is not compatible with FIPS. Migrate run_cmd_on_ui_host to the OpenSSH CLI SSH(1) using tasks.py's run_ssh_cmd. Rationale: this is exactly what clients use. Fixes: https://pagure.io/freeipa/issue/8129 Signed-off-by: François Cami <fcami@redhat.com> Reviewed-By: Mohammad Rizwan <myusuf@redhat.com> Reviewed-By: Michal Polovka <mpolovka@redhat.com>
This commit is contained in:
@@ -32,7 +32,6 @@ import os
|
||||
from functools import wraps
|
||||
from urllib.error import URLError
|
||||
|
||||
import paramiko
|
||||
import pytest
|
||||
|
||||
try:
|
||||
@@ -61,7 +60,9 @@ except ImportError:
|
||||
NO_YAML = True
|
||||
|
||||
from ipaplatform.paths import paths
|
||||
from ipaplatform.tasks import tasks
|
||||
|
||||
from ipatests.pytest_ipa.integration import tasks
|
||||
|
||||
|
||||
ENV_MAP = {
|
||||
'MASTER': 'ipa_server',
|
||||
@@ -1972,26 +1973,16 @@ class UI_driver:
|
||||
|
||||
cmd (str): command to run
|
||||
"""
|
||||
if tasks.is_fips_enabled():
|
||||
pytest.skip("paramiko is not compatible with FIPS mode")
|
||||
|
||||
login = self.config.get('ipa_admin')
|
||||
hostname = self.config.get('ipa_server')
|
||||
password = self.config.get('ipa_password')
|
||||
|
||||
try:
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect(hostname=hostname, username=login, password=password)
|
||||
ssh.exec_command(cmd)
|
||||
except paramiko.AuthenticationException:
|
||||
self.skip('Authentication to server {} failed'.format(hostname))
|
||||
except paramiko.SSHException as e:
|
||||
self.skip('Unable to establish SSH connection: {}'.format(e))
|
||||
except Exception as e:
|
||||
self.skip('Unable to proceed: {}'.format(e))
|
||||
finally:
|
||||
ssh.close()
|
||||
tasks.run_ssh_cmd(
|
||||
to_host=hostname, username=login,
|
||||
auth_method="password", password=password,
|
||||
cmd=cmd
|
||||
)
|
||||
|
||||
@dismiss_unexpected_alert
|
||||
def has_class(self, el, cls):
|
||||
|
||||
Reference in New Issue
Block a user