Skip to content
Snippets Groups Projects
Commit 74c3275c authored by Chris Hines's avatar Chris Hines
Browse files

warning about host keys

parent 3bb8f18e
No related branches found
No related tags found
3 merge requests!77Revert "disable agressive kill and restart",!35Dev,!17Dev
Pipeline #7920 canceled
...@@ -95,6 +95,7 @@ class Ssh: ...@@ -95,6 +95,7 @@ class Ssh:
sshcmd = ["ssh", '-o', 'StrictHostKeyChecking=no', sshcmd = ["ssh", '-o', 'StrictHostKeyChecking=no',
'-o', 'UserKnownHostsFile=/dev/null', '-o', 'UserKnownHostsFile=/dev/null',
'-o', 'UpdateHostKeys=no', '-o', 'UpdateHostKeys=no',
'-o', 'LogLevel=error',
"-S", ctrlsocket, "-S", ctrlsocket,
"-M", '-o', 'ControlPersist=10m', "-M", '-o', 'ControlPersist=10m',
'-p', sshport, '-N','-l', user, host] '-p', sshport, '-N','-l', user, host]
...@@ -179,6 +180,7 @@ class Ssh: ...@@ -179,6 +180,7 @@ class Ssh:
'-o', 'UserKnownHostsFile=/dev/null', '-o', 'UserKnownHostsFile=/dev/null',
'-o', 'UpdateHostKeys=no', '-o', 'UpdateHostKeys=no',
'-o', 'LogLevel=error',
'-P', sshport, '-o', 'ControlPath={}'.format(ctrlsocket), '-P', sshport, '-o', 'ControlPath={}'.format(ctrlsocket),
'{}@{}'.format(user, host)], '{}@{}'.format(user, host)],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
...@@ -229,6 +231,7 @@ class Ssh: ...@@ -229,6 +231,7 @@ class Ssh:
exec_p = subprocess.Popen(['sftp', '-b', '-','-o', 'Stricthostkeychecking=no', exec_p = subprocess.Popen(['sftp', '-b', '-','-o', 'Stricthostkeychecking=no',
'-o', 'UserKnownHostsFile=/dev/null', '-o', 'UserKnownHostsFile=/dev/null',
'-o', 'UpdateHostKeys=no', '-o', 'UpdateHostKeys=no',
'-o', 'LogLevel=error',
'-P', sshport, '-o', 'ControlPath={}'.format(ctrlsocket), '-P', sshport, '-o', 'ControlPath={}'.format(ctrlsocket),
'{}@{}'.format(user, host)], '{}@{}'.format(user, host)],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
...@@ -284,13 +287,14 @@ class Ssh: ...@@ -284,13 +287,14 @@ class Ssh:
sshcmd = ['ssh', '-o', 'Stricthostkeychecking=no', sshcmd = ['ssh', '-o', 'Stricthostkeychecking=no',
'-o', 'UserKnownHostsFile=/dev/null', '-o', 'UserKnownHostsFile=/dev/null',
'-o', 'UpdateHostKeys=no', '-o', 'UpdateHostKeys=no',
'-o', 'LogLevel=error',
'-o', 'ConnectTimeout=10', '-o', 'ConnectTimeout=10',
'-S', ctrlsocket, '-p', sshport, '-S', ctrlsocket, '-p', sshport,
'-l', user, host, cmd] '-l', user, host, cmd]
else: else:
# we are executing on a node (e.g. a compute/batch node) using a bastion (e.g. login node) # we are executing on a node (e.g. a compute/batch node) using a bastion (e.g. login node)
# at the moment I'll assume the ssh port for the batch host is the same as the ssh port for the bastion/login host # at the moment I'll assume the ssh port for the batch host is the same as the ssh port for the bastion/login host
proxycmd = "ssh -o ConnectTimeout=10 -o UserKnownHostsFile=/dev/null -o UpdateHostKeys=no -o Stricthostkeychecking=no {user}@{bastion} -W {host}:{sshport} -S {ctrlsocket}".format( proxycmd = "ssh -o ConnectTimeout=10 -o UserKnownHostsFile=/dev/null -o UpdateHostKeys=no -o LogLevel=error -o Stricthostkeychecking=no {user}@{bastion} -W {host}:{sshport} -S {ctrlsocket}".format(
user=user, host=host, user=user, host=host,
ctrlsocket=ctrlsocket, ctrlsocket=ctrlsocket,
sshport=sshport, sshport=sshport,
...@@ -299,6 +303,7 @@ class Ssh: ...@@ -299,6 +303,7 @@ class Ssh:
'-o', "ProxyCommand={}".format(proxycmd), '-o', "ProxyCommand={}".format(proxycmd),
'-o', 'UserKnownHostsFile=/dev/null', '-o', 'UserKnownHostsFile=/dev/null',
'-o', 'UpdateHostKeys=no', '-o', 'UpdateHostKeys=no',
'-o', 'LogLevel=error',
'-o', 'ConnectTimeout=10', '-o', 'ConnectTimeout=10',
'-p', bastionsshport, '-l', user, bastion, cmd] '-p', bastionsshport, '-l', user, bastion, cmd]
exec_p = subprocess.Popen(sshcmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE,stdin=subprocess.PIPE,env=env) exec_p = subprocess.Popen(sshcmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE,stdin=subprocess.PIPE,env=env)
...@@ -361,6 +366,7 @@ class Ssh: ...@@ -361,6 +366,7 @@ class Ssh:
sshcmd = ['ssh', '-o', 'Stricthostkeychecking=no', '-N', sshcmd = ['ssh', '-o', 'Stricthostkeychecking=no', '-N',
'-o', 'UserKnownHostsFile=/dev/null', '-o', 'UserKnownHostsFile=/dev/null',
'-o', 'UpdateHostKeys=no', '-o', 'UpdateHostKeys=no',
'-o', 'LogLevel=error',
'-L', '{localport}:{batchhost}:{port}'. '-L', '{localport}:{batchhost}:{port}'.
format(port=port, localport=localport, batchhost=batchhost), format(port=port, localport=localport, batchhost=batchhost),
'-O', 'forward', '-S', ctrlsocket, '-O', 'forward', '-S', ctrlsocket,
...@@ -369,7 +375,7 @@ class Ssh: ...@@ -369,7 +375,7 @@ class Ssh:
# Create an ssh tunnel to the batch node using a proxycommand. # Create an ssh tunnel to the batch node using a proxycommand.
# The proxy command should utilise # The proxy command should utilise
# the existing control master connection # the existing control master connection
proxycmd = "ssh -o UserKnownHostsFile=/dev/null -o UpdateHostKeys=no -o Stricthostkeychecking=no {user}@{host} -W {batchhost}:22 -S {ctrlsocket}".format( proxycmd = "ssh -o UserKnownHostsFile=/dev/null -o UpdateHostKeys=no -o LogLevel=error -o Stricthostkeychecking=no {user}@{host} -W {batchhost}:22 -S {ctrlsocket}".format(
user=user, host=host, user=user, host=host,
ctrlsocket=ctrlsocket, ctrlsocket=ctrlsocket,
batchhost=batchhost) batchhost=batchhost)
...@@ -378,6 +384,7 @@ class Ssh: ...@@ -378,6 +384,7 @@ class Ssh:
format(port=port, localport=localport), format(port=port, localport=localport),
'-o', 'UserKnownHostsFile=/dev/null', '-o', 'UserKnownHostsFile=/dev/null',
'-o', 'UpdateHostKeys=no', '-o', 'UpdateHostKeys=no',
'-o', 'LogLevel=error',
'-o', "ProxyCommand={}".format(proxycmd), '-o', "ProxyCommand={}".format(proxycmd),
'-p', sshport, '-l', user, batchhost] '-p', sshport, '-l', user, batchhost]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment