Skip to content

Commit f69a26d

Browse files
authored
Merge pull request #164 from larsewi/id_rsa
ENT-13485: Generate a public key if needed with ssh-keygen
2 parents 6906ecc + 85e6114 commit f69a26d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cf_remote/Vagrantfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ Vagrant.configure("2") do |config|
2626
node.vm.box = VM_BOX
2727

2828
node.vm.provision "shell" do |s|
29-
ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip
29+
ssh_pub_key_path = "#{Dir.home}/.ssh/id_rsa.pub"
30+
if !File.file?(ssh_pub_key_path)
31+
abort "SSH key not found at #{ssh_pub_key_path}. Please create one with: ssh-keygen -t rsa -b 4096"
32+
end
33+
ssh_pub_key = File.readlines(ssh_pub_key_path).first.strip
3034
s.inline = <<-SHELL
3135
echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys
3236
echo #{ssh_pub_key} >> /root/.ssh/authorized_keys

0 commit comments

Comments
 (0)