Commit 22d1b711 authored by Kevin Marshall's avatar Kevin Marshall Committed by Commit Bot

Fuchsia: Generate SSH credentials for device boots.

This fixes a bug in the runner scripts which prevented SSH cred
generation for device boots, but allowed emulator run credentials to
be re-used. The issue only manifested on clean builds with no prior
emu runs.

Bug: 899285
Change-Id: Icfb2b734bf527b44cb671b08ee7d21563ae82a8c
Reviewed-on: https://chromium-review.googlesource.com/c/1355850Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Commit-Queue: Kevin Marshall <kmarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612839}
parent 0ba01dff
...@@ -40,14 +40,19 @@ def _TargetCpuToSdkBinPath(target_arch): ...@@ -40,14 +40,19 @@ def _TargetCpuToSdkBinPath(target_arch):
return os.path.join(common.SDK_ROOT, 'target', target_arch) return os.path.join(common.SDK_ROOT, 'target', target_arch)
def _ProvisionSSH(output_dir): def _GetPubKeyPath(output_dir):
"""Generates a keypair and configuration data for the SSH client. """Returns a path to the generated SSH public key."""
Returns a path to the client public key."""
return os.path.join(output_dir, 'id_ed25519.pub')
def ProvisionSSH(output_dir):
"""Generates a keypair and config file for SSH."""
host_key_path = os.path.join(output_dir, 'ssh_key') host_key_path = os.path.join(output_dir, 'ssh_key')
host_pubkey_path = host_key_path + '.pub' host_pubkey_path = host_key_path + '.pub'
id_key_path = os.path.join(output_dir, 'id_ed25519') id_key_path = os.path.join(output_dir, 'id_ed25519')
id_pubkey_path = id_key_path + '.pub' id_pubkey_path = _GetPubKeyPath(output_dir)
known_hosts_path = os.path.join(output_dir, 'known_hosts') known_hosts_path = os.path.join(output_dir, 'known_hosts')
ssh_config_path = os.path.join(output_dir, 'ssh_config') ssh_config_path = os.path.join(output_dir, 'ssh_config')
...@@ -68,8 +73,6 @@ def _ProvisionSSH(output_dir): ...@@ -68,8 +73,6 @@ def _ProvisionSSH(output_dir):
if os.path.exists(known_hosts_path): if os.path.exists(known_hosts_path):
os.remove(known_hosts_path) os.remove(known_hosts_path)
return id_pubkey_path
def _MakeQcowDisk(output_dir, disk_path): def _MakeQcowDisk(output_dir, disk_path):
"""Creates a QEMU copy-on-write version of |disk_path| in the output """Creates a QEMU copy-on-write version of |disk_path| in the output
...@@ -98,7 +101,8 @@ def GetBootImage(output_dir, target_arch): ...@@ -98,7 +101,8 @@ def GetBootImage(output_dir, target_arch):
""""Gets a path to the Zircon boot image, with the SSH client public key """"Gets a path to the Zircon boot image, with the SSH client public key
added.""" added."""
pubkey_path = _ProvisionSSH(output_dir) ProvisionSSH(output_dir)
pubkey_path = _GetPubKeyPath(output_dir)
zbi_tool = os.path.join(common.SDK_ROOT, 'tools', 'zbi') zbi_tool = os.path.join(common.SDK_ROOT, 'tools', 'zbi')
image_source_path = GetTargetFile(target_arch, 'fuchsia.zbi') image_source_path = GetTargetFile(target_arch, 'fuchsia.zbi')
image_dest_path = os.path.join(output_dir, 'gen', 'fuchsia-with-keys.zbi') image_dest_path = os.path.join(output_dir, 'gen', 'fuchsia-with-keys.zbi')
......
...@@ -45,8 +45,8 @@ class DeviceTarget(target.Target): ...@@ -45,8 +45,8 @@ class DeviceTarget(target.Target):
self._loglistener = None self._loglistener = None
if self._auto: if self._auto:
self._ssh_config_path = EnsurePathExists( boot_data.ProvisionSSH(output_dir)
boot_data.GetSSHConfigPath(output_dir)) self._ssh_config_path = boot_data.GetSSHConfigPath(output_dir)
else: else:
self._ssh_config_path = os.path.expanduser(ssh_config) self._ssh_config_path = os.path.expanduser(ssh_config)
self._host = host self._host = host
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment