beaker-puppet_install_helper 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CONTRIBUTING.md +7 -0
- data/Gemfile +5 -0
- data/README.md +15 -0
- data/beaker-puppet_install_helper.gemspec +1 -1
- data/lib/beaker/ca_cert_helper.rb +129 -0
- data/lib/beaker/puppet_install_helper.rb +1 -0
- data/spec/unit/beaker/ca_cert_helper_spec.rb +42 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17e6a51cd929ad47b6650028e546f4e0e5708111
|
4
|
+
data.tar.gz: b782f88f97d51b289c7198683e0ed3c7829e96a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d1fccdeb2a26047783bb3d6be89788195aefe060520edaeca7bddfd8b32e19e1bfed1f5664a676267a1d8e5d504aa30661f370a50fc4a8b2498aa8efcb25210
|
7
|
+
data.tar.gz: e357f54eca20d2e932d7c8664db898b0a0897eeecfbde0eab44fbb9897c4d7b556de8194a02915d0eef54b7dedbffc276028f3bbe517427ef778b83420fb4cea
|
data/.gitignore
CHANGED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
### Contributing and adding features
|
2
|
+
|
3
|
+
This package is frozen on 0.x and guaranteed to disappear in the future, so contributing features is not something you probably want to spend time on.
|
4
|
+
|
5
|
+
On the other hand, it exists to fill a void in beaker until such time as beaker fills it, so any bugfixes contributed via a github pull request are welcome.
|
6
|
+
|
7
|
+
Discussion is available in #puppet-dev on Freenode
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
This gem is simply an abstraction for the various ways that we install puppet from the `spec/spec_helper_acceptance.rb` files across the modules.
|
4
4
|
|
5
|
+
### `run_puppet_install_helper`
|
6
|
+
|
5
7
|
The way to use this is to declare either `run_puppet_install_helper()` or `run_puppet_install_helper_on(hosts)` and set environment variables `PUPPET_VERSION` and/or `PUPPET_INSTALL_TYPE` in the following combinations to have puppet installed on the desired hosts:
|
6
8
|
|
7
9
|
- `PUPPET_INSTALL_TYPE` is unset: it will look at the default node's type (ie, `default.is_pe?` and choose either foss or pe methods below.
|
@@ -13,5 +15,18 @@ The way to use this is to declare either `run_puppet_install_helper()` or `run_p
|
|
13
15
|
|
14
16
|
The best way is explicitly set `PUPPET_INSTALL_TYPE` and `PUPPET_VERSION` to what you want. It'll probably do what you expect.
|
15
17
|
|
18
|
+
### `install_ca_certs`
|
19
|
+
|
20
|
+
Install Certificate Authority Certs on Windows and OSX for Geotrust, User Trust Network, and Equifax
|
21
|
+
On Windows it currently is limited to hosts that use cygwin
|
22
|
+
|
23
|
+
### `install_ca_certs_on`
|
24
|
+
|
25
|
+
Install certs on a given host(s)
|
26
|
+
|
27
|
+
### Support
|
28
|
+
|
29
|
+
No support is supplied or implied. Use at your own risk.
|
30
|
+
|
16
31
|
### TODO
|
17
32
|
- Add support for ci-ready builds
|
@@ -0,0 +1,129 @@
|
|
1
|
+
require 'beaker'
|
2
|
+
require 'beaker/dsl/helpers/host_helpers'
|
3
|
+
|
4
|
+
module Beaker::CaCertHelper
|
5
|
+
|
6
|
+
def install_ca_certs
|
7
|
+
install_ca_certs_on(hosts)
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
##
|
12
|
+
# Install certs on Windows and OSX Hosts
|
13
|
+
#
|
14
|
+
# @param Array<Host>
|
15
|
+
#
|
16
|
+
##
|
17
|
+
def install_ca_certs_on(hosts)
|
18
|
+
Array[hosts].each do |host|
|
19
|
+
get_cert_hash.each do |cert_name, ca|
|
20
|
+
create_cert_on_host(host, cert_name, ca)
|
21
|
+
if host['platform'] =~ /windows/i
|
22
|
+
add_windows_cert host, cert_name
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# create the remote file and ensure proper rights
|
30
|
+
#
|
31
|
+
def create_cert_on_host(host, cert_name, ca)
|
32
|
+
create_remote_file(host, cert_name, ca)
|
33
|
+
on host, "chmod 644 #{cert_name}"
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# Install cert, assumes cygwin currently
|
38
|
+
##
|
39
|
+
def add_windows_cert(host, ca_filename)
|
40
|
+
on host, "cmd /c certutil -v -addstore Root `cygpath -w #{ca_filename}`"
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# Returns a hash of certificates where the Key is the pem cert name, and the value is the certificate
|
45
|
+
# @return Hash<String,String>
|
46
|
+
##
|
47
|
+
def get_cert_hash
|
48
|
+
certs = {}
|
49
|
+
certs['geotrustglobal.pem'] = <<-EOM
|
50
|
+
-----BEGIN CERTIFICATE-----
|
51
|
+
MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT
|
52
|
+
MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
|
53
|
+
YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG
|
54
|
+
EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg
|
55
|
+
R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9
|
56
|
+
9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq
|
57
|
+
fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv
|
58
|
+
iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU
|
59
|
+
1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+
|
60
|
+
bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW
|
61
|
+
MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA
|
62
|
+
ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l
|
63
|
+
uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn
|
64
|
+
Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS
|
65
|
+
tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF
|
66
|
+
PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un
|
67
|
+
hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV
|
68
|
+
5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw==
|
69
|
+
-----END CERTIFICATE-----
|
70
|
+
EOM
|
71
|
+
|
72
|
+
certs['usertrust-network.pem'] = <<-EOM
|
73
|
+
-----BEGIN CERTIFICATE-----
|
74
|
+
MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCB
|
75
|
+
lzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug
|
76
|
+
Q2l0eTEeMBwGA1UEChMVVGhlIF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hcmR3YXJlLmNy
|
91
|
+
bDAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwUGCCsGAQUFBwMGBggrBgEF
|
92
|
+
BQcDBzANBgkqhkiG9w0BAQUFAAOCAQEARxkP3nTGmZev/K0oXnWO6y1n7k57K9cM
|
93
|
+
//bey1WiCuFMVGWTYGufEpytXoMs61quwOQt9ABjHbjAbPLPSbtNk28Gpgoiskli
|
94
|
+
CE7/yMgUsogWXecB5BKV5UU0s4tpvc+0hY91UZ59Ojg6FEgSxvunOxqNDYJAB+gE
|
95
|
+
CJChicsZUN/KHAG8HQQZexB2lzvukJDKxA4fFm517zP4029bHpbj4HR3dHuKom4t
|
96
|
+
3XbWOTCC8KucUvIqx69JXn7HaOWCgchqJ/kniCrVWFCVH/A7HFe7fRQ5YiuayZSS
|
97
|
+
KqMiDP+JJn1fIytH1xUdqWqeUQ0qUZ6B+dQ7XnASfxAynB67nfhmqA==
|
98
|
+
-----END CERTIFICATE-----
|
99
|
+
EOM
|
100
|
+
|
101
|
+
certs['equifax.pem'] = <<-EOM
|
102
|
+
-----BEGIN CERTIFICATE-----
|
103
|
+
MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV
|
104
|
+
UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy
|
105
|
+
dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1
|
106
|
+
MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx
|
107
|
+
dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B
|
108
|
+
AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f
|
109
|
+
BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A
|
110
|
+
cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC
|
111
|
+
AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ
|
112
|
+
MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm
|
113
|
+
aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw
|
114
|
+
ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj
|
115
|
+
IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF
|
116
|
+
MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA
|
117
|
+
A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y
|
118
|
+
7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh
|
119
|
+
1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4
|
120
|
+
-----END CERTIFICATE-----
|
121
|
+
EOM
|
122
|
+
|
123
|
+
certs
|
124
|
+
end
|
125
|
+
|
126
|
+
|
127
|
+
end
|
128
|
+
|
129
|
+
include Beaker::CaCertHelper
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'beaker::ca_cert_helper' do
|
4
|
+
let :subject do
|
5
|
+
Class.new { include Beaker::CaCertHelper }
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
describe 'install_ca_certs_on' do
|
10
|
+
before :each do
|
11
|
+
allow(subject).to receive(:get_cert_hash).and_return(
|
12
|
+
{'geotrustglobal.pem' => 'my cert string',
|
13
|
+
'usertrust-network.pem' => 'my user trust cert'})
|
14
|
+
end
|
15
|
+
|
16
|
+
it "windows 2003 node" do
|
17
|
+
w2k3 = {"platform" => 'windows-2003r2-64', 'distmoduledir' => '/dne', 'hieraconf' => '/dne'}
|
18
|
+
|
19
|
+
expect(subject).to receive(:add_windows_cert).with(w2k3, 'geotrustglobal.pem')
|
20
|
+
expect(subject).to receive(:create_cert_on_host).with(w2k3, 'geotrustglobal.pem', 'my cert string')
|
21
|
+
expect(subject).to receive(:add_windows_cert).with(w2k3, 'usertrust-network.pem')
|
22
|
+
expect(subject).to receive(:create_cert_on_host).with(w2k3, 'usertrust-network.pem', 'my user trust cert')
|
23
|
+
subject.install_ca_certs_on w2k3
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'add_windows_cert' do
|
28
|
+
it {
|
29
|
+
host = {"platform" => 'windows-2003r2-64', 'distmoduledir' => '/dne', 'hieraconf' => '/dne'}
|
30
|
+
expect(subject).to receive(:on).with(host, 'cmd /c certutil -v -addstore Root `cygpath -w geotrustglobal.pem`')
|
31
|
+
subject.add_windows_cert host, 'geotrustglobal.pem'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'get_cert_hash' do
|
36
|
+
it 'should contain 3 certs' do
|
37
|
+
cert_hash = subject.get_cert_hash
|
38
|
+
expect(cert_hash.length).to equal(3)
|
39
|
+
expect(cert_hash.class).to eq(Hash)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker-puppet_install_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -47,12 +47,15 @@ extra_rdoc_files: []
|
|
47
47
|
files:
|
48
48
|
- ".gitignore"
|
49
49
|
- ".travis.yml"
|
50
|
+
- CONTRIBUTING.md
|
50
51
|
- Gemfile
|
51
52
|
- LICENSE
|
52
53
|
- README.md
|
53
54
|
- beaker-puppet_install_helper.gemspec
|
55
|
+
- lib/beaker/ca_cert_helper.rb
|
54
56
|
- lib/beaker/puppet_install_helper.rb
|
55
57
|
- spec/spec_helper.rb
|
58
|
+
- spec/unit/beaker/ca_cert_helper_spec.rb
|
56
59
|
- spec/unit/beaker/puppet_install_helper_spec.rb
|
57
60
|
homepage: https://github.com/puppetlabs/beaker-puppet_install_helper
|
58
61
|
licenses:
|
@@ -80,4 +83,5 @@ specification_version: 4
|
|
80
83
|
summary: Puppet install helper for Beaker
|
81
84
|
test_files:
|
82
85
|
- spec/spec_helper.rb
|
86
|
+
- spec/unit/beaker/ca_cert_helper_spec.rb
|
83
87
|
- spec/unit/beaker/puppet_install_helper_spec.rb
|