diff options
author | elijah <elijah@riseup.net> | 2012-11-23 10:39:10 -0800 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2012-11-23 10:39:10 -0800 |
commit | ba80599d9230b63b71bfeca45fc89c7f69987723 (patch) | |
tree | 429ed21fc08364711969e715b831665ea01dcf5d /lib | |
parent | 3e153978671956d17cf743b8d22ea72ae3355f28 (diff) | |
download | leap_cli-ba80599d9230b63b71bfeca45fc89c7f69987723.tar.gz leap_cli-ba80599d9230b63b71bfeca45fc89c7f69987723.tar.bz2 |
fix vagrant.key permission problem, i think.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/leap_cli/commands/vagrant.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/leap_cli/commands/vagrant.rb b/lib/leap_cli/commands/vagrant.rb index 4a480ff..41dccc9 100644 --- a/lib/leap_cli/commands/vagrant.rb +++ b/lib/leap_cli/commands/vagrant.rb @@ -1,4 +1,5 @@ require 'ipaddr' +require 'fileutils' module LeapCli; module Commands @@ -29,9 +30,15 @@ module LeapCli; module Commands public def vagrant_ssh_key_file - file = File.expand_path('../../../vendor/vagrant_ssh_keys/vagrant.key', File.dirname(__FILE__)) - Util.assert_files_exist! file - return file + file_path = File.expand_path('../../../vendor/vagrant_ssh_keys/vagrant.key', File.dirname(__FILE__)) + Util.assert_files_exist! file_path + if File.new(file_path).stat.uid == Process.euid + # if the vagrant.key file is owned by ourselves, we need to make sure that it is not world readable + FileUtils.cp file_path, '/tmp/vagrant.key' + FileUtils.chmod 0600, '/tmp/vagrant.key' + file_path = '/tmp/vagrant.key' + end + return file_path end private |