blob: afe63424afb9ff9386f5f1413152cbc9e0b32795 [file] [log] [blame]
Dale Curtiscb7bfaf2011-06-07 16:21:57 -07001def make_ssh_command(user='root', port=22, opts='', hosts_file=None,
2 connect_timeout=None, alive_interval=None):
3 """Override default make_ssh_command to use options tuned for Chrome OS.
4
5 Tuning changes:
6 - ConnectTimeout=10; maximum of 10 seconds allowed for an SSH connection
7 failure.
8
9 - ServerAliveInterval=60; which causes SSH to ping connection every
10 60 seconds. In conjunction with ServerAliveCountMax ensures that if the
11 connection dies, Autotest will bail out quickly.
12
13 - ServerAliveCountMax=1; only allow a single keep alive failure.
14
15 - UserKnownHostsFile=/dev/null; we don't care about the keys. Host keys
16 change with every new installation, don't waste memory/space saving them.
17 """
18 base_command = ('/usr/bin/ssh -a -x %s -o StrictHostKeyChecking=no'
19 ' -o UserKnownHostsFile=/dev/null -o BatchMode=yes'
20 ' -o ConnectTimeout=10 -o ServerAliveInterval=60'
21 ' -o ServerAliveCountMax=1 -l %s -p %d')
22 return base_command % (opts, user, port)