Skip to content

Commit 44a425c

Browse files
author
Ryan Hall
committed
add option to pass SSLCertificateFile and SSLCertificateKey to ssl.conf
1 parent b4c5ad8 commit 44a425c

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

manifests/mod/ssl.pp

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
$ssl_cryptodevice = 'builtin',
44
$ssl_options = [ 'StdEnvVars' ],
55
$ssl_openssl_conf_cmd = undef,
6+
$ssl_cert = undef,
7+
$ssl_key = undef,
68
$ssl_ca = undef,
79
$ssl_cipher = 'HIGH:MEDIUM:!aNULL:!MD5:!RC4:!3DES',
810
Variant[Boolean, Enum['on', 'off']] $ssl_honorcipherorder = true,

spec/classes/mod/ssl_spec.rb

+20
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,26 @@
185185
it { is_expected.to contain_file('ssl.conf').with_content(%r{^ SSLPassPhraseDialog builtin$}) }
186186
end
187187

188+
context 'setting ssl_cert' do
189+
let :params do
190+
{
191+
ssl_cert: '/etc/pki/some/path/localhost.crt',
192+
}
193+
end
194+
195+
it { is_expected.to contain_file('ssl.conf').with_content(%r{^ SSLCertificateFile}) }
196+
end
197+
198+
context 'setting ssl_key' do
199+
let :params do
200+
{
201+
ssl_key: '/etc/pki/some/path/localhost.key',
202+
}
203+
end
204+
205+
it { is_expected.to contain_file('ssl.conf').with_content(%r{^ SSLCertificateKeyFile}) }
206+
end
207+
188208
context 'setting ssl_ca to a path' do
189209
let :params do
190210
{

templates/mod/ssl.conf.erb

+6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
<%- end -%>
2121
SSLCryptoDevice <%= @ssl_cryptodevice %>
2222
SSLHonorCipherOrder <%= scope.call_function('apache::bool2httpd', [@_ssl_honorcipherorder]) %>
23+
<%- if @ssl_cert -%>
24+
SSLCertificateFile "<%= @ssl_cert %>"
25+
<%- end -%>
26+
<%- if @ssl_key -%>
27+
SSLCertificateKeyFile "<%= @ssl_key %>"
28+
<%- end -%>
2329
<%- if @ssl_ca -%>
2430
SSLCACertificateFile "<%= @ssl_ca %>"
2531
<%- end -%>

0 commit comments

Comments
 (0)