blob: 8a28ab13b456e4356e8b7445cd7f24fc56c1e2a4 [file] [log] [blame]
Dale Curtisaa5eedb2011-08-23 16:18:52 -07001# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
Dale Curtiscb7bfaf2011-06-07 16:21:57 -07005def make_ssh_command(user='root', port=22, opts='', hosts_file=None,
6 connect_timeout=None, alive_interval=None):
7 """Override default make_ssh_command to use options tuned for Chrome OS.
8
9 Tuning changes:
10 - ConnectTimeout=10; maximum of 10 seconds allowed for an SSH connection
11 failure.
12
Dale Curtisaa5eedb2011-08-23 16:18:52 -070013 - ServerAliveInterval=180; which causes SSH to ping connection every
14 180 seconds. In conjunction with ServerAliveCountMax ensures that if the
15 connection dies, Autotest will bail out quickly. Originally tried 60 secs,
16 but saw frequent job ABORTS where the test completed successfully.
Dale Curtiscb7bfaf2011-06-07 16:21:57 -070017
18 - ServerAliveCountMax=1; only allow a single keep alive failure.
19
20 - UserKnownHostsFile=/dev/null; we don't care about the keys. Host keys
21 change with every new installation, don't waste memory/space saving them.
22 """
23 base_command = ('/usr/bin/ssh -a -x %s -o StrictHostKeyChecking=no'
24 ' -o UserKnownHostsFile=/dev/null -o BatchMode=yes'
Dale Curtisaa5eedb2011-08-23 16:18:52 -070025 ' -o ConnectTimeout=10 -o ServerAliveInterval=180'
Dale Curtiscb7bfaf2011-06-07 16:21:57 -070026 ' -o ServerAliveCountMax=1 -l %s -p %d')
27 return base_command % (opts, user, port)