Method: CloudFlock::App::Common#generate_keypair

Defined in:
lib/cloudflock/app/common/servers.rb

#generate_keypair(shell) ⇒ Object

Public: Create a temporary ssh key to be used for passwordless access to the destination host.

shell - SSH object logged in to the source host.

Returns a String containing the host’s new ssh public key.



574
575
576
577
578
579
# File 'lib/cloudflock/app/common/servers.rb', line 574

def generate_keypair(shell)
  keygen_command = "ssh-keygen -b 4096 -q -t rsa -f #{PRIVATE_KEY} -P ''"
  shell.as_root("mkdir #{DATA_DIR}")
  shell.as_root(keygen_command, 3600)
  shell.as_root("cat #{PUBLIC_KEY}")
end