Disable SSH host key checking when connecting to FAFT client.

It is for the cases of recovery mode test. The test boots a USB/SD image
instead of an internal image. The RSA host key is changed and causes
failure in SSH connection. So we disable the SSH host key checking by
configuring it to use an empty known_hosts file.

BUG=chromium-os:19710
TEST=run_remote_tests.sh --remote=$REMOTE_IP -a \
     "servo_vid=0x18d1 servo_pid=0x5001" firmware_TryFwB
More test using this config is in a comming CL, firmware_UserRequestRecovery.

Change-Id: I4dff7c151a0395c777451b789f216be084fb819e
Reviewed-on: https://gerrit.chromium.org/gerrit/10632
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/server/cros/servo_test.py b/server/cros/servo_test.py
index 4a4c005..6e1ce4f 100644
--- a/server/cros/servo_test.py
+++ b/server/cros/servo_test.py
@@ -52,6 +52,8 @@
             'ssh_tunnel': None,
             # Polling RPC function name for testing the server availability.
             'polling_rpc': 'IsLinux',
+            # Additional SSH options.
+            'ssh_config': '-o StrictHostKeyChecking=no ',
         },
         'faft': {
             'used': False,
@@ -63,6 +65,8 @@
             'remote_process': None,
             'ssh_tunnel': None,
             'polling_rpc': 'is_available',
+            'ssh_config': '-o StrictHostKeyChecking=no '
+                          '-o UserKnownHostsFile=/dev/null ',
         },
     }
 
@@ -208,8 +212,8 @@
         self._kill_remote_process(info)
         logging.info('Client command: %s' % info['remote_command'])
         info['remote_process'] = subprocess.Popen([
-            'ssh -o "StrictHostKeyChecking no" -n root@%s \'%s\'' %
-            (self._client.ip, info['remote_command'])], shell=True)
+            'ssh -n %s root@%s \'%s\'' % (info['ssh_config'],
+            self._client.ip, info['remote_command'])], shell=True)
 
         # Connect to RPC object.
         logging.info('Connecting to client RPC server...')
@@ -290,9 +294,10 @@
           info: A dict of remote info, see the definition of self._remote_infos.
         """
         if not info['ssh_tunnel'] or info['ssh_tunnel'].poll() is not None:
-            info['ssh_tunnel'] = subprocess.Popen(['ssh', '-N', '-n', '-L',
-                '%s:localhost:%s' % (info['port'], info['port']),
-                'root@%s' % self._client.ip])
+            info['ssh_tunnel'] = subprocess.Popen([
+                'ssh -N -n %s -L %s:localhost:%s root@%s' %
+                (info['ssh_config'], info['port'], info['port'],
+                self._client.ip)], shell=True)
 
 
     def _kill_remote_process(self, info):
@@ -302,8 +307,8 @@
           info: A dict of remote info, see the definition of self._remote_infos.
         """
         kill_cmd = 'pkill -f %s' % info['remote_command_short']
-        subprocess.call(['ssh -n -o "StrictHostKeyChecking no" root@%s \'%s\'' %
-                         (self._client.ip, kill_cmd)],
+        subprocess.call(['ssh -n %s root@%s \'%s\'' %
+                         (info['ssh_config'], self._client.ip, kill_cmd)],
                         shell=True)
         if info['remote_process'] and info['remote_process'].poll() is None:
             info['remote_process'].terminate()