Sha256: 431e344765469e4b7e4e8aad95650cffaffc3a3d30ad0257e74b42f84647df19

Contents?: true

Size: 552 Bytes

Versions: 12

Compression:

Stored size: 552 Bytes

Contents

#!/usr/bin/env ruby

# Creates a local /home/vcap/.ssh/$KEY_PAIR_NAME.pem file
# from the key pair private key ($PRIVATE_KEY)
#
# Requires:
# * ENV['KEY_PAIR_NAME']
# * ENV['PRIVATE_KEY']
#
# Optional:
# * ENV['TARGET_USER'] (default: vcap)

user = ENV['TARGET_USER'] || 'vcap'
key_pair_name = ENV['KEY_PAIR_NAME']
private_key = ENV['PRIVATE_KEY']

keyfile_path = "/home/#{user}/.ssh/#{key_pair_name}.pem"
split_private_key = private_key.split(/\n/)
File.open(keyfile_path, "w") do |f|
  split_private_key.each {|line| f.puts line}
  f.chmod 0600
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
bosh-bootstrap-0.10.2 lib/bosh-bootstrap/stages/stage_micro_bosh_deploy/install_key_pair_for_user
bosh-bootstrap-0.10.1 lib/bosh-bootstrap/stages/stage_micro_bosh_deploy/install_key_pair_for_user
bosh-bootstrap-0.10.0 lib/bosh-bootstrap/stages/stage_micro_bosh_deploy/install_key_pair_for_user
bosh-bootstrap-0.9.0 lib/bosh-bootstrap/stages/stage_micro_bosh_deploy/install_key_pair_for_user
bosh-bootstrap-0.8.2 lib/bosh-bootstrap/stages/stage_micro_bosh_deploy/install_key_pair_for_user
bosh-bootstrap-0.8.1 lib/bosh-bootstrap/stages/stage_micro_bosh_deploy/install_key_pair_for_user
bosh-bootstrap-0.8.0 lib/bosh-bootstrap/stages/stage_micro_bosh_deploy/install_key_pair_for_user
bosh-bootstrap-0.7.1 lib/bosh-bootstrap/stages/stage_micro_bosh_deploy/install_key_pair_for_user
bosh-bootstrap-0.7.0 lib/bosh-bootstrap/stages/stage_micro_bosh_deploy/install_key_pair_for_user
bosh-bootstrap-0.6.0 lib/bosh-bootstrap/stages/stage_micro_bosh_deploy/install_key_pair_for_user
bosh-bootstrap-0.5.1 lib/bosh-bootstrap/stages/stage_micro_bosh_deploy/install_key_pair_for_user
bosh-bootstrap-0.5.0 lib/bosh-bootstrap/stages/stage_micro_bosh_deploy/install_key_pair_for_user