From 13b99ece2b6232b25ae45e449ba43c1bc2a936b7 Mon Sep 17 00:00:00 2001 From: Jiri Otoupal Date: Wed, 13 Sep 2023 13:58:09 +0200 Subject: [PATCH] ssh new sha accept --- abst/__version__.py | 2 +- abst/bastion_support/oci_bastion.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/abst/__version__.py b/abst/__version__.py index 472b0d1..95827f4 100644 --- a/abst/__version__.py +++ b/abst/__version__.py @@ -10,7 +10,7 @@ "CLI Command making OCI Bastion and kubernetes usage simple and fast" ) -__version__ = "2.0.6" +__version__ = "2.0.7" __author__ = "Jiri Otoupal" __author_email__ = "jiri-otoupal@ips-database.eu" __license__ = "MIT" diff --git a/abst/bastion_support/oci_bastion.py b/abst/bastion_support/oci_bastion.py index 704fbd8..8651c95 100644 --- a/abst/bastion_support/oci_bastion.py +++ b/abst/bastion_support/oci_bastion.py @@ -220,14 +220,16 @@ def run_ssh_tunnel_managed_session(self, bid, host, private_key_path, username, print(f"Bastion {self.get_print_name()} initialized") print(f"Initializing SSH Tunnel for {self.get_print_name()}") - ssh_tunnel_args = f'ssh -i {private_key_path} -o ServerAliveInterval=20 -o ProxyCommand="ssh -i {private_key_path} -W %h:%p -p {port} {bid}@{host} -A" -p {port} {username}@{ip} -A' + ssh_tunnel_args = (f'ssh -i {private_key_path} -o StrictHostKeyChecking=accept-new -o ServerAliveInterval=20 ' + f'-o ProxyCommand="ssh -i {private_key_path} -W %h:%p -p {port} {bid}@{host} -A" -p {port} ' + f'{username}@{ip} -A') exit_code = self.__run_ssh_tunnel_call(ssh_tunnel_args, shell, already_split=True) return ssh_tunnel_args, exit_code def run_ssh_tunnel_port_forward(self, bid, host, ip, port, shell, local_port, ssh_pub_key_path): print(f"Bastion {self.get_print_name()} initialized") print(f"Initializing SSH Tunnel for {self.get_print_name()}") - ssh_tunnel_arg_str = f"ssh -o ServerAliveInterval=20 -N -L {local_port}:{ip}:{port} -p 22 {bid}@{host} -vvv -i {ssh_pub_key_path.strip('.pub')}" + ssh_tunnel_arg_str = f"ssh -o StrictHostKeyChecking=accept-new -o ServerAliveInterval=20 -N -L {local_port}:{ip}:{port} -p 22 {bid}@{host} -vvv -i {ssh_pub_key_path.strip('.pub')}" self.__run_ssh_tunnel(ssh_tunnel_arg_str, shell) return ssh_tunnel_arg_str