vagrant-rekey-ssh 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2NjY2FkMjVlYTI1Zjg0N2M1OTE0OWQ4M2I5NzA1YTYyMDAxMzVlZQ==
4
+ NTkyMzA1ZGQ2YjAwYzI5MDVlYjY0MmZmY2E4Y2FjMjU1NmZiZWMzMA==
5
5
  data.tar.gz: !binary |-
6
- NzlhNmIxMGFjZTcwZDAzNDI4MjJkOWJiMTdhZGUyNjZiYTI0ZDgxYw==
6
+ MzI0ZTllMWNjZjcwYjJhZmNkNDVhYThiN2Y4Nzg4NzViYjU0YjIxOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDJiNjc4MjAzMjEyMjgzMGI3MjBiZDFlOWZmNGQzM2UwNzcyOGVkMWUxOTQ2
10
- ZmY3MzUzNTVmYjIzNDVlM2ZmODM5MmMyMjg4NzdhZTY2ZWMzN2IzOTMzNDcw
11
- MWZlOWI3ZjBhNTc5ODVjYWQ3MDRkN2Q5ZjQxYTQ4YWM1ZmFhMTg=
9
+ MWFkODA3MDJjOTNlOTE0NjgyMTFkYjc3YTVlZmM5YWI5YTg0Yjc0NDVjNGY1
10
+ ZDQ3MDFkMTFiNWNhYzk5NWJjZWU3Nzk5Y2RhMTM0YTBiYzA0YjNlNWE5Yjhh
11
+ NDc1YjFkNWQyNzJmODhjYzVlMjZkNTMyZGEwMzU4MmY4ZjllM2E=
12
12
  data.tar.gz: !binary |-
13
- YTk1ZTI3MTRjOTViM2ZjNWUyZGI1Y2UwMDEwYjRhMTJhMGE0NWUxM2ZjN2Nh
14
- Y2Y4ZTE1MTcwNDA5MzEwNTA2MzgwZmNiMTZjOTNlMzhlMTJiMDgzMTY2MmU3
15
- NDU5NWFhMWU2YWZjYmY3N2NhNGIyYjAzZDIwMTNhZjFjMjEwODQ=
13
+ ZDhlZjdkYWRiYzcyNzFiZDlkZDA1MzQxOWVkMjIwNDhlMDE5YjVmMDNjNDU0
14
+ YjU3YzNiNDU0MTgzN2MxMmZkZmQyNmVkYzY4ZTE4ZDY2NDkyZjhhNDNlZDMy
15
+ MzA2YzFlOGJhNTFlNGIwYzgyMzMyMWZjY2UxYWVkMWRjNDQxOWY=
data/Gemfile CHANGED
@@ -7,6 +7,6 @@ group :development do
7
7
  # We depend on Vagrant for development, but we don't add it as a
8
8
  # gem dependency because we expect to be installed within the
9
9
  # Vagrant environment itself using `vagrant plugin`.
10
- gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git"
10
+ gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git", :tag => 'v1.3.5'
11
11
  end
12
12
 
@@ -1,5 +1,6 @@
1
1
 
2
2
  require "vagrant-rekey-ssh/helpers"
3
+ require "fileutils"
3
4
 
4
5
  module VagrantPlugins
5
6
  module RekeySSH
@@ -37,6 +38,9 @@ module VagrantPlugins
37
38
  elsif result == 2
38
39
  raise Errors::ErrorReplacingInsecureKey
39
40
  elsif result == 3
41
+ # store an indicator that the key has been replaced
42
+ FileUtils.touch(rekey_sentinel_file)
43
+
40
44
  @machine.ui.info(I18n.t("vagrant_rekey_ssh.info.key_replaced"))
41
45
 
42
46
  # if the insecure key *was* there, disable the user's and root's password too
@@ -45,6 +49,8 @@ module VagrantPlugins
45
49
  # wasn't then perhaps it's a custom box and we shouldn't mess with it
46
50
  @machine.communicate.execute("sudo passwd --delete $USER; sudo passwd --delete root", sudo: false)
47
51
 
52
+
53
+
48
54
  end
49
55
 
50
56
  end
@@ -24,8 +24,18 @@ module VagrantPlugins
24
24
  # in case we haven't replaced the key yet.
25
25
  # -> TODO: only specify the insecure key when we haven't set the
26
26
  # less insecure key on the box.
27
+
27
28
  if @machine.config.ssh.private_key_path.nil?
28
- @machine.config.ssh.private_key_path = [ssh_key_path, @machine.env.default_private_key_path]
29
+
30
+ if ::File.exists?(rekey_sentinel_file)
31
+ @machine.config.ssh.private_key_path = ssh_key_path
32
+ end
33
+
34
+ # Vagrant < 1.4 only supports a single ssh key, do this differently
35
+ #if Vagrant::VERSION <= "1.4.0"
36
+ #else
37
+ # @machine.config.ssh.private_key_path = [ssh_key_path, @machine.env.default_private_key_path]
38
+ #end
29
39
  end
30
40
 
31
41
  end
@@ -19,6 +19,10 @@ module VagrantPlugins
19
19
  end
20
20
  end
21
21
 
22
+ def rekey_sentinel_file
23
+ ::File.join(@machine.data_dir, "rekey_sentinel")
24
+ end
25
+
22
26
  def ssh_public_key
23
27
  IO.read(ssh_pubkey_path).scan( /^(\S+\s+\S+).*$/ ).last.first
24
28
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module RekeySSH
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-rekey-ssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Spicuzza