vagrant-aws-winrm 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +22 -0
- data/README.md +64 -0
- data/Rakefile +3 -0
- data/lib/vagrant-aws-winrm/capability.rb +47 -0
- data/lib/vagrant-aws-winrm/plugin.rb +23 -0
- data/lib/vagrant-aws-winrm/version.rb +7 -0
- data/lib/vagrant-aws-winrm.rb +16 -0
- data/vagrant-aws-winrm.gemspec +25 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1333301219911be80fe150eebc58ca9322c6eb98
|
4
|
+
data.tar.gz: 15e69ee3a48636152fe998cd6631feb1cca7c442
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 82ad45a7ce8d39adc9dfb780f4ab5e2e1a63f4e0285ec245232a43b160923e61683983fec085a7c0eadeac74487565eb7b360f7c6c999b8460a69c0af8b60878
|
7
|
+
data.tar.gz: 810b035b50e197d7c7cd248d110a9070bcbfe592922d6e18040c021b280651d7f129911465ec6a3c9ffdb762b8819e8102f9184cbfa819017f4521ca154a55a2
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Rafael Goodman
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# Vagrant-AWS-WinRM
|
2
|
+
|
3
|
+
Adds a capability to the `vagrant-aws` provider to retrieve and use the EC2-generated Administrator password when estabilishing a connection to the instance with the WinRM communicator.
|
4
|
+
|
5
|
+
This allows one to use EC2Config to generate a new Administrator password at provision time, obviating the need to use a hardcoded username and password to connect to Windows boxes provisioned in AWS.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
```bash
|
10
|
+
$ vagrant plugin install vagrant-aws-winrm
|
11
|
+
```
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
Install and configure the [vagrant-aws](https://github.com/mitchellh/vagrant-aws) plugin.
|
16
|
+
|
17
|
+
In your Vagrantfile, ensure you configure values for `aws.keypair_name` and `ssh.private_key_path`.
|
18
|
+
|
19
|
+
When configuring the WinRM credentials, use `Administrator` and `:aws` for the `winrm.username` and `winrm.password`, respectively.
|
20
|
+
|
21
|
+
Example:
|
22
|
+
|
23
|
+
```
|
24
|
+
Vagrant.configure("2") do |config|
|
25
|
+
|
26
|
+
# Other stuff
|
27
|
+
|
28
|
+
config.vm.provider :aws do |aws, override|
|
29
|
+
aws.access_key_id = "YOUR KEY"
|
30
|
+
aws.secret_access_key = "YOUR SECRET KEY"
|
31
|
+
aws.keypair_name = "KEYPAIR NAME"
|
32
|
+
override.ssh.private_key_path = "PATH TO YOUR PRIVATE KEY"
|
33
|
+
override.vm.communicator = "winrm"
|
34
|
+
override.winrm.username = "Administrator"
|
35
|
+
override.winrm.password = :aws
|
36
|
+
override.winrm.transport = :ssl
|
37
|
+
end
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
## Setting up your server
|
42
|
+
|
43
|
+
You'll have to configure WinRM to use basic authentication. As a result, it is recommended that you configure WinRM to use a HTTPS listener.
|
44
|
+
|
45
|
+
```
|
46
|
+
winrm quickconfig -q
|
47
|
+
winrm set winrm/config/service/auth @{Basic="true"}
|
48
|
+
winrm create winrm/config/Listener?Address=*+Transport=HTTPS @{CertificateThumbprint="YOUR CERT THUMBPRINT"}
|
49
|
+
```
|
50
|
+
|
51
|
+
For self-signed SSL certs, you'll have to configure your Vagrantfile to set `winrm.ssl_peer_verification` to false.
|
52
|
+
|
53
|
+
See also:
|
54
|
+
|
55
|
+
* [MSDN article about configuring WinRM](http://msdn.microsoft.com/en-us/library/aa384372\(v=vs.85\).aspx)
|
56
|
+
* [WinRM gem](https://github.com/WinRb/WinRM/blob/master/README.md#ssl)
|
57
|
+
|
58
|
+
## Contributing
|
59
|
+
|
60
|
+
1. Fork it ( https://github.com/rafd123/vagrant-aws-winrm/fork )
|
61
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
62
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
63
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
64
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require "aws-sdk"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module AWS
|
5
|
+
module WinRM
|
6
|
+
class Capability
|
7
|
+
def self.winrm_info(machine)
|
8
|
+
if machine.config.winrm.password == :aws
|
9
|
+
machine.ui.info('Getting WinRM password from AWS')
|
10
|
+
|
11
|
+
# AWS connection info
|
12
|
+
access_key_id = machine.provider_config.access_key_id
|
13
|
+
secret_access_key = machine.provider_config.secret_access_key
|
14
|
+
credentials = ::Aws::Credentials.new(access_key_id, secret_access_key)
|
15
|
+
region = machine.provider_config.region
|
16
|
+
|
17
|
+
# Grab the region endpoint explicitly in the event that
|
18
|
+
# a custom endpoint was specified (e.g. OpenStack)
|
19
|
+
region_config = machine.provider_config.get_region_config(region)
|
20
|
+
endpoint = region_config.endpoint
|
21
|
+
|
22
|
+
# Fetch that password data for the instance
|
23
|
+
ec2 = Aws::EC2::Client.new(region: region, endpoint: endpoint, credentials: credentials)
|
24
|
+
password_data = ec2.get_password_data({ instance_id: machine.id }).password_data
|
25
|
+
password_data_bytes = Base64.decode64(password_data)
|
26
|
+
|
27
|
+
# Try to decrypt the password data using each one of the private key files
|
28
|
+
# set by the user until we hit one that decrypts successfully
|
29
|
+
machine.config.ssh.private_key_path.each do |private_key_path|
|
30
|
+
rsa = OpenSSL::PKey::RSA.new File.read(File.expand_path private_key_path)
|
31
|
+
|
32
|
+
begin
|
33
|
+
machine.config.winrm.password = rsa.private_decrypt password_data_bytes
|
34
|
+
rescue OpenSSL::PKey::RSAError
|
35
|
+
next
|
36
|
+
end
|
37
|
+
|
38
|
+
break
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
return {}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
begin
|
2
|
+
require "vagrant"
|
3
|
+
rescue LoadError
|
4
|
+
raise "The Vagrant AWS WinRM plugin must be run within Vagrant."
|
5
|
+
end
|
6
|
+
|
7
|
+
module VagrantPlugins
|
8
|
+
module AWS
|
9
|
+
module WinRM
|
10
|
+
class Plugin < Vagrant.plugin("2")
|
11
|
+
name "AWS WinRM"
|
12
|
+
description <<-DESC
|
13
|
+
Facilitates using the AWS-EC2-provided Administrator password as the WinRM communicator's credentials.
|
14
|
+
DESC
|
15
|
+
|
16
|
+
provider_capability(:aws, :winrm_info) do
|
17
|
+
require_relative 'capability'
|
18
|
+
VagrantPlugins::AWS::WinRM::Capability
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "vagrant-aws-winrm/version"
|
2
|
+
require "vagrant-aws-winrm/plugin"
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module AWS
|
6
|
+
module WinRM
|
7
|
+
lib_path = Pathname.new(File.expand_path("../vagrant-aws-winrm", __FILE__))
|
8
|
+
# This returns the path to the source of this plugin.
|
9
|
+
#
|
10
|
+
# @return [Pathname]
|
11
|
+
def self.source_root
|
12
|
+
@source_root ||= Pathname.new(File.expand_path("../../", __FILE__))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vagrant-aws-winrm/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vagrant-aws-winrm"
|
8
|
+
spec.version = VagrantPlugins::AWS::WinRM::VERSION
|
9
|
+
spec.authors = ["Rafael Goodman"]
|
10
|
+
spec.email = ["rafael@getthefrog.com"]
|
11
|
+
spec.summary = %q{Facilitates using the AWS-EC2-provided Administrator password as the WinRM communicator's credentials.}
|
12
|
+
spec.description = %q{Facilitates using the AWS-EC2-provided Administrator password as the WinRM communicator's credentials.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "aws-sdk", "~> 2"
|
22
|
+
|
23
|
+
#spec.add_development_dependency "bundler", "~> 1.7"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-aws-winrm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rafael Goodman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aws-sdk
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Facilitates using the AWS-EC2-provided Administrator password as the
|
42
|
+
WinRM communicator's credentials.
|
43
|
+
email:
|
44
|
+
- rafael@getthefrog.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- lib/vagrant-aws-winrm.rb
|
55
|
+
- lib/vagrant-aws-winrm/capability.rb
|
56
|
+
- lib/vagrant-aws-winrm/plugin.rb
|
57
|
+
- lib/vagrant-aws-winrm/version.rb
|
58
|
+
- vagrant-aws-winrm.gemspec
|
59
|
+
homepage: ''
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.2.3
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: Facilitates using the AWS-EC2-provided Administrator password as the WinRM
|
83
|
+
communicator's credentials.
|
84
|
+
test_files: []
|