Module: Pipe2me::Tunnel::SSH

Included in:
Pipe2me::Tunnel
Defined in:
lib/pipe2me/tunnel/ssh.rb

Constant Summary collapse

HTTP =
Pipe2me::HTTP
SSH_PUBKEY =
Pipe2me::Tunnel::SSH_PUBKEY
SSH_PRIVKEY =
Pipe2me::Tunnel::SSH_PRIVKEY

Instance Method Summary collapse

Instance Method Details

#ssh_keygenObject



7
8
9
10
11
12
13
14
15
# File 'lib/pipe2me/tunnel/ssh.rb', line 7

def ssh_keygen
  sh! "ssh-keygen -t rsa -N '' -C #{config.fqdn} -f pipe2me.id_rsa >&2"
  sh! "chmod 600 pipe2me.id_rsa*"
  HTTP.post!("#{url}/id_rsa.pub", File.read(SSH_PUBKEY), {'Content-Type' =>'text/plain'})
rescue
  FileUtils.rm_rf SSH_PRIVKEY
  FileUtils.rm_rf SSH_PUBKEY
  raise
end