Skip to content

Commit c78e73f

Browse files
Merge pull request #2093 from aspectcapital/ssl-parameters
Add ssl_user_name vhost parameter
2 parents ffac0c6 + 5262a56 commit c78e73f

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

manifests/vhost.pp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,6 +1676,9 @@
16761676
# Can be used to set the [SSLStaplingReturnResponderErrors](http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslstaplingreturnrespondererrors) directive.<br />
16771677
# This parameter only applies to Apache 2.4 or higher and is ignored on older versions.
16781678
#
1679+
# @param ssl_user_name
1680+
# Sets the [SSLUserName](https://httpd.apache.org/docs/current/mod/mod_ssl.html#sslusername) directive.
1681+
#
16791682
# @param use_canonical_name
16801683
# Specifies whether to use the [`UseCanonicalName directive`](https://httpd.apache.org/docs/2.4/mod/core.html#usecanonicalname),
16811684
# which allows you to configure how the server determines it's own name and port.
@@ -1774,6 +1777,7 @@
17741777
Optional[Boolean] $ssl_stapling = undef,
17751778
$ssl_stapling_timeout = undef,
17761779
$ssl_stapling_return_errors = undef,
1780+
Optional[String] $ssl_user_name = undef,
17771781
$priority = undef,
17781782
Boolean $default_vhost = false,
17791783
$servername = $name,

spec/acceptance/vhost_spec.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -769,10 +769,11 @@ class { 'apache': }
769769
priority => false,
770770
docroot => '/tmp'
771771
}
772-
apache::vhost { 'test.ssl_protool':
773-
docroot => '/tmp',
774-
ssl => true,
775-
ssl_protocol => ['All', '-SSLv2'],
772+
apache::vhost { 'test.ssl_protocol':
773+
docroot => '/tmp',
774+
ssl => true,
775+
ssl_protocol => ['All', '-SSLv2'],
776+
ssl_user_name => 'SSL_CLIENT_S_DN_CN',
776777
}
777778
apache::vhost { 'test.block':
778779
docroot => '/tmp',
@@ -873,9 +874,10 @@ class { 'apache': }
873874
describe file("#{apache_hash['vhost_dir']}/test.without_priority_prefix.conf") do
874875
it { is_expected.to be_file }
875876
end
876-
describe file("#{apache_hash['vhost_dir']}/25-test.ssl_protool.conf") do
877+
describe file("#{apache_hash['vhost_dir']}/25-test.ssl_protocol.conf") do
877878
it { is_expected.to be_file }
878879
it { is_expected.to contain 'SSLProtocol *All -SSLv2' }
880+
it { is_expected.to contain 'SSLUserName *SSL_CLIENT_S_DN_CN' }
879881
end
880882
describe file("#{apache_hash['vhost_dir']}/25-test.block.conf") do
881883
it { is_expected.to be_file }

spec/defines/vhost_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
'ssl_proxyengine' => true,
8686
'ssl_proxy_cipher_suite' => 'HIGH',
8787
'ssl_proxy_protocol' => 'TLSv1.2',
88+
'ssl_user_name' => 'SSL_CLIENT_S_DN_CN',
8889
'priority' => '30',
8990
'default_vhost' => true,
9091
'servername' => 'example.com',
@@ -1045,6 +1046,11 @@
10451046
content: %r{^\s+SSLOpenSSLConfCmd\s+DHParameters "foo.pem"$},
10461047
)
10471048
}
1049+
it {
1050+
is_expected.to contain_concat__fragment('rspec.example.com-ssl').with(
1051+
content: %r{^\s+SSLUserName\s+SSL_CLIENT_S_DN_CN$},
1052+
)
1053+
}
10481054
it { is_expected.to contain_concat__fragment('rspec.example.com-sslproxy') }
10491055
it {
10501056
is_expected.to contain_concat__fragment('rspec.example.com-sslproxy').with(

templates/vhost/_ssl.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,7 @@
5454
<%- if (not @ssl_stapling_return_errors.nil?) && (scope.function_versioncmp([@apache_version, '2.4']) >= 0) -%>
5555
SSLStaplingReturnResponderErrors <%= scope.call_function('apache::bool2httpd', [@ssl_stapling_return_errors]) %>
5656
<%- end -%>
57+
<%- if @ssl_user_name -%>
58+
SSLUserName <%= @ssl_user_name %>
59+
<%- end -%>
5760
<% end -%>

0 commit comments

Comments
 (0)