vagrant-multi-putty 1.4.4 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bacc6ba971fbc91534399ecb9d33d9bf23205c3b
4
- data.tar.gz: 12323e84aebfe94943e7f4757ebed1c5ff06793f
3
+ metadata.gz: 1bcb1308ea1efd27389c9ed1b0c9a988dd1181c4
4
+ data.tar.gz: 715f131affcf007ee8371f747f9207dcc8949d09
5
5
  SHA512:
6
- metadata.gz: db1f52218f789fb70bfaa41eae1ef755e906da3197b9e65aadaa9ebedfcb2797debdd6a418fd4c38e41b3c2b4872210f0f2dd52aa9947fba278989c1163512ce
7
- data.tar.gz: ac0f7efbb260d0175a9b6b1512a2645c8f958dfe18bdccf680343b1e4d40644fbf726e93cc813a6a13fbbd5067b750c19af3ae076dde1ef86ccad3e1a978843f
6
+ metadata.gz: 17562cedbad15454687a397f27c5e63ac0be8353a2513f6c4016c91769c455f892f1b8471bf11aca4c34e567e02388c79fef5e791406c5ba53622b394899e061
7
+ data.tar.gz: fca69320f02eae511e8abb2afbf0c8c6b81951210b7beadb4d6061e83e2b98d136ec53259d8d952956e576ca275004ee18fd71e2c71818b6a8f96b230ce917bb
@@ -0,0 +1,4 @@
1
+ v1.5.0 (2016-04-04)
2
+ -------------------
3
+
4
+ Added automatic putty .ppk file generation [GH-20]
data/Gemfile CHANGED
@@ -1,3 +1,9 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gemspec
3
+ group :development do
4
+ gem "vagrant", git: "https://github.com/mitchellh/vagrant.git"
5
+ end
6
+
7
+ group :plugins do
8
+ gem "vagrant-multi-putty", path: "."
9
+ end
data/README.md CHANGED
@@ -21,32 +21,14 @@ Download the putty executable for your platform and add it's location to your
21
21
  PATH environment variable. Seek your operating system manual for instructions
22
22
  on how to modify your PATH variable.
23
23
 
24
- ### SSH Private Key conversion using PuTTYgen
25
- Download: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
26
-
27
- Putty uses a custom format for SSH keys. It does not support openssl keys
28
- directly. Using PuTTYgen, you can convert the private key shipped with vagrant
29
- or convert a private key of your own.
30
-
31
- #### Steps for converting the shipped insecure private key
32
- 1. Open puttygen and click the Conversions -> Import Key menu option.
33
- 2. Select the insecure_private_key located at ~/.vagrant.d/insecure_private_key
34
- 3. Click the "Save private key" button and store the key right along side the
35
- insecure key.
36
- 4. Answer yes when prompted to save without a password.
37
- 5. Save the key using the filename of "insecure_private_key.ppk".
38
-
39
- If you do not explicity set the `config.putty.private_key_path`
40
- variable, you need to convert the insecure_private_key and store it
41
- with a ".ppk" extension. The vagrant-multi-putty plugin appends this
42
- extension automatically.
24
+ ### SSH Private Key conversion
25
+ SSH keys will be automatically converted to the ppk format used by putty.
43
26
 
44
27
  As of Vagrant 1.4.0, the `config.ssh.private_key_path` variable is converted into
45
28
  an array. This allows multiple SSH keys to be passed to ssh. PuTTY does not
46
29
  allow for a list of ssh keys via the command line. Therefore, if the
47
30
  `config.putty.private_key_path` variable is not set, we attempt to use the first
48
- key in the `config.ssh.private_key_path` list and append the '.ppk' extension
49
- to it.
31
+ key in the `config.ssh.private_key_path` list.
50
32
 
51
33
  ## Configuration
52
34
  Most of the ssh configuration options used to control vagrant ssh also
@@ -55,7 +37,6 @@ vagrant-multi-putty:
55
37
 
56
38
  * `config.ssh.max_tries`
57
39
  * `config.ssh.timeout`
58
- * `config.ssh.private_key_path`
59
40
  * `config.ssh.shell`
60
41
 
61
42
  All other config.ssh options should work for vagrant-multi-putty just like they
@@ -66,7 +47,8 @@ There are currently a few additional configuration parameters available:
66
47
  * `config.putty.username`: Overrides the username set with
67
48
  ` config.ssh.username`.
68
49
  * `config.putty.private_key_path`: Used to explicity set the path to the
69
- private key variable.
50
+ private key variable. When set to `:agent`, no private key file is supplied
51
+ and PuTTY will try private keys loaded by Pageant.
70
52
  * `config.putty.modal`: change vagrant-multi-putty to use modal window mode.
71
53
  Execute putty and block the terminal until all putty processes have exited.
72
54
  Can be set on the command line with `-m` or `--modal`. This is false by default.
@@ -1,6 +1,10 @@
1
1
  # Pieces of this plugin were taken from the bundled vagrant ssh plugin.
2
2
  require 'rubygems'
3
+ require 'openssl'
3
4
  require 'optparse'
5
+ require 'putty/key'
6
+
7
+ using PuTTY::Key
4
8
 
5
9
  module VagrantMultiPutty
6
10
  class Command < Vagrant.plugin(2, :command)
@@ -87,9 +91,10 @@ module VagrantMultiPutty
87
91
  # so we default to choosing the first default key if it is not
88
92
  # explicitly set.
89
93
  private_key = vm.config.putty.private_key_path ||
90
- ssh_info[:private_key_path][0] + ".ppk"
94
+ get_putty_key_file(ssh_info[:private_key_path][0])
91
95
  @logger.debug("Putty Private Keys: #{private_key.to_s}")
92
- ssh_options += ["-i", private_key] unless options[:plain_auth]
96
+ ssh_options += ["-i", private_key] unless
97
+ options[:plain_auth] || private_key == :agent
93
98
 
94
99
  # Add in additional args from the command line.
95
100
  ssh_options.concat(args) if !args.nil?
@@ -100,5 +105,18 @@ module VagrantMultiPutty
100
105
  @logger.debug("Putty Child Pid: #{pid}")
101
106
  Process.detach(pid)
102
107
  end
108
+
109
+ private
110
+
111
+ def get_putty_key_file(ssh_key_path)
112
+ "#{ssh_key_path}.ppk".tap do |ppk_path|
113
+ if !File.exist?(ppk_path) || File.mtime(ssh_key_path) > File.mtime(ppk_path)
114
+ ssh_key = OpenSSL::PKey.read(File.read(ssh_key_path, mode: 'rb'))
115
+ ppk = ssh_key.to_ppk
116
+ ppk.comment = "Converted by vagrant-multi-putty at #{Time.now}"
117
+ ppk.save(ppk_path)
118
+ end
119
+ end
120
+ end
103
121
  end
104
122
  end
@@ -1,3 +1,3 @@
1
1
  module VagrantMultiPutty
2
- VERSION = "1.4.4"
2
+ VERSION = "1.5.0"
3
3
  end
@@ -11,8 +11,11 @@ Gem::Specification.new do |s|
11
11
  s.summary = "Vagrant plugin to allow VM ssh with PuTTY (multi-vm supported)"
12
12
  s.description = "Vagrant plugin to allow VM ssh with PuTTY (multi-vm supported)"
13
13
 
14
+ s.required_ruby_version = ">= 2.1.0"
14
15
  s.required_rubygems_version = ">= 1.4.0"
15
16
 
16
17
  s.files = `git ls-files`.split("\n")
17
18
  s.require_path = 'lib'
19
+
20
+ s.add_runtime_dependency "putty-key", "~> 1.0"
18
21
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-multi-putty
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Downs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-25 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2016-04-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: putty-key
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
13
27
  description: Vagrant plugin to allow VM ssh with PuTTY (multi-vm supported)
14
28
  email:
15
29
  - nickryand@gmail.com
@@ -17,7 +31,8 @@ executables: []
17
31
  extensions: []
18
32
  extra_rdoc_files: []
19
33
  files:
20
- - .gitignore
34
+ - ".gitignore"
35
+ - CHANGELOG.md
21
36
  - Gemfile
22
37
  - LICENSE
23
38
  - README.md
@@ -38,17 +53,17 @@ require_paths:
38
53
  - lib
39
54
  required_ruby_version: !ruby/object:Gem::Requirement
40
55
  requirements:
41
- - - '>='
56
+ - - ">="
42
57
  - !ruby/object:Gem::Version
43
- version: '0'
58
+ version: 2.1.0
44
59
  required_rubygems_version: !ruby/object:Gem::Requirement
45
60
  requirements:
46
- - - '>='
61
+ - - ">="
47
62
  - !ruby/object:Gem::Version
48
63
  version: 1.4.0
49
64
  requirements: []
50
65
  rubyforge_project:
51
- rubygems_version: 2.0.14
66
+ rubygems_version: 2.4.8
52
67
  signing_key:
53
68
  specification_version: 4
54
69
  summary: Vagrant plugin to allow VM ssh with PuTTY (multi-vm supported)