forked from puppetlabs/puppetlabs-apache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapache_ssl_spec.rb
154 lines (143 loc) · 5.98 KB
/
apache_ssl_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
require 'spec_helper_acceptance'
require_relative './version.rb'
describe 'apache ssl' do
describe 'ssl parameters' do
pp = <<-MANIFEST
class { 'apache':
service_ensure => stopped,
default_ssl_vhost => true,
default_ssl_cert => '/tmp/ssl_cert',
default_ssl_key => '/tmp/ssl_key',
default_ssl_chain => '/tmp/ssl_chain',
default_ssl_ca => '/tmp/ssl_ca',
default_ssl_crl_path => '/tmp/ssl_crl_path',
default_ssl_crl => '/tmp/ssl_crl',
default_ssl_crl_check => 'chain',
}
MANIFEST
it 'runs without error' do
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
describe file("#{$vhost_dir}/15-default-ssl.conf") do
it { is_expected.to be_file }
it { is_expected.to contain 'SSLCertificateFile "/tmp/ssl_cert"' }
it { is_expected.to contain 'SSLCertificateKeyFile "/tmp/ssl_key"' }
it { is_expected.to contain 'SSLCertificateChainFile "/tmp/ssl_chain"' }
it { is_expected.not_to contain 'SSLCACertificateFile "/tmp/ssl_ca"' }
it { is_expected.not_to contain 'SSLCARevocationPath "/tmp/ssl_crl_path"' }
it { is_expected.not_to contain 'SSLCARevocationFile "/tmp/ssl_crl"' }
if $apache_version == '2.4'
it { is_expected.not_to contain 'SSLCARevocationCheck "chain"' }
else
it { is_expected.not_to contain 'SSLCARevocationCheck' }
end
end
end
describe 'vhost ssl parameters' do
pp = <<-MANIFEST
class { 'apache':
service_ensure => stopped,
}
apache::vhost { 'test_ssl':
docroot => '/tmp/test',
ssl => true,
ssl_cert => '/tmp/ssl_cert',
ssl_key => '/tmp/ssl_key',
ssl_chain => '/tmp/ssl_chain',
ssl_ca => '/tmp/ssl_ca',
ssl_crl_path => '/tmp/ssl_crl_path',
ssl_crl => '/tmp/ssl_crl',
ssl_crl_check => 'chain',
ssl_certs_dir => '/tmp',
ssl_protocol => 'test',
ssl_cipher => 'test',
ssl_honorcipherorder => 'test',
ssl_verify_client => 'test',
ssl_verify_depth => 'test',
ssl_options => ['test', 'test1'],
ssl_proxyengine => true,
ssl_proxy_protocol => 'TLSv1.2',
}
MANIFEST
it 'runs without error' do
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
describe file("#{$vhost_dir}/25-test_ssl.conf") do
it { is_expected.to be_file }
it { is_expected.to contain 'SSLCertificateFile "/tmp/ssl_cert"' }
it { is_expected.to contain 'SSLCertificateKeyFile "/tmp/ssl_key"' }
it { is_expected.to contain 'SSLCertificateChainFile "/tmp/ssl_chain"' }
it { is_expected.to contain 'SSLCACertificateFile "/tmp/ssl_ca"' }
it { is_expected.to contain 'SSLCACertificatePath "/tmp"' }
it { is_expected.to contain 'SSLCARevocationPath "/tmp/ssl_crl_path"' }
it { is_expected.to contain 'SSLCARevocationFile "/tmp/ssl_crl"' }
it { is_expected.to contain 'SSLProxyEngine On' }
it { is_expected.to contain 'SSLProtocol test' }
it { is_expected.to contain 'SSLCipherSuite test' }
it { is_expected.to contain 'SSLHonorCipherOrder test' }
it { is_expected.to contain 'SSLVerifyClient test' }
it { is_expected.to contain 'SSLVerifyDepth test' }
it { is_expected.to contain 'SSLOptions test test1' }
if $apache_version == '2.4'
it { is_expected.to contain 'SSLCARevocationCheck "chain"' }
else
it { is_expected.not_to contain 'SSLCARevocationCheck' }
end
end
end
describe 'vhost ssl ssl_ca only' do
pp = <<-MANIFEST
class { 'apache':
service_ensure => stopped,
}
apache::vhost { 'test_ssl_ca_only':
docroot => '/tmp/test',
ssl => true,
ssl_cert => '/tmp/ssl_cert',
ssl_key => '/tmp/ssl_key',
ssl_ca => '/tmp/ssl_ca',
ssl_verify_client => 'test',
}
MANIFEST
it 'runs without error' do
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
describe file("#{$vhost_dir}/25-test_ssl_ca_only.conf") do
it { is_expected.to be_file }
it { is_expected.to contain 'SSLCertificateFile "/tmp/ssl_cert"' }
it { is_expected.to contain 'SSLCertificateKeyFile "/tmp/ssl_key"' }
it { is_expected.to contain 'SSLCACertificateFile "/tmp/ssl_ca"' }
it { is_expected.not_to contain 'SSLCACertificatePath' }
end
end
describe 'vhost ssl ssl_certs_dir' do
pp = <<-MANIFEST
class { 'apache':
service_ensure => stopped,
}
apache::vhost { 'test_ssl_certs_dir_only':
docroot => '/tmp/test',
ssl => true,
ssl_cert => '/tmp/ssl_cert',
ssl_key => '/tmp/ssl_key',
ssl_certs_dir => '/tmp',
ssl_verify_client => 'test',
}
MANIFEST
it 'runs without error' do
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
describe file("#{$vhost_dir}/25-test_ssl_certs_dir_only.conf") do
it { is_expected.to be_file }
it { is_expected.to contain 'SSLCertificateFile "/tmp/ssl_cert"' }
it { is_expected.to contain 'SSLCertificateKeyFile "/tmp/ssl_key"' }
it { is_expected.to contain 'SSLCACertificatePath "/tmp"' }
it { is_expected.to contain 'SSLVerifyClient test' }
it { is_expected.not_to contain 'SSLCACertificateFile' }
end
end
end