Skip to content

Commit afb1f22

Browse files
ehelmsekohl
authored andcommitted
Drop dependency on certs::foreman_proxy from container class
Signed-off-by: Eric D. Helms <[email protected]>
1 parent dd1593c commit afb1f22

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

manifests/container.pp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,22 @@
1010
# the content base url.
1111
# @param pulpcore_https_vhost
1212
# The name of the Apache https vhost for Pulpcore
13+
# @param cname
14+
# Common name to check for authentication against
1315
class foreman_proxy_content::container (
1416
String $location_prefix = '/pulpcore_registry',
1517
String $registry_v1_path = '/v1/',
1618
String $registry_v2_path = '/v2/',
1719
String $pulpcore_https_vhost = 'pulpcore-https',
20+
Stdlib::Fqdn $cname = $facts['networking']['fqdn'],
1821
) {
19-
include certs::foreman_proxy
20-
2122
$context = {
2223
'directories' => [
2324
{
2425
'provider' => 'location',
2526
'path' => "${location_prefix}${registry_v2_path}",
2627
'request_headers' => ["set SSL_CLIENT_S_DN \"admin\""],
27-
'requires' => ["expr %{tolower:%{SSL_CLIENT_S_DN_CN}} == \"${certs::foreman_proxy::hostname.downcase}\""]
28+
'requires' => ["expr %{tolower:%{SSL_CLIENT_S_DN_CN}} == \"${cname.downcase}\""]
2829
},
2930
],
3031
'proxy_pass' => [

manifests/init.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@
253253
unless $shared_with_foreman_vhost {
254254
class { 'foreman_proxy_content::container':
255255
pulpcore_https_vhost => $apache_https_vhost,
256+
cname => $certs::foreman_proxy::hostname,
256257
}
257258

258259
class { 'foreman_proxy::plugin::container_gateway':

spec/classes/foreman_proxy_content__container_spec.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,23 @@
2929
end
3030

3131
describe 'with explicit parameters' do
32-
let(:params) { { location_prefix: '/other_pulpcore_registry', registry_v1_path: '/vr1/', registry_v2_path: '/vr2/', pulpcore_https_vhost: 'rhsm-pulpcore-reverse-proxy-443' } }
32+
let(:params) do
33+
{
34+
location_prefix: '/other_pulpcore_registry',
35+
registry_v1_path: '/vr1/',
36+
registry_v2_path: '/vr2/',
37+
pulpcore_https_vhost: 'rhsm-pulpcore-reverse-proxy-443',
38+
cname: 'anoTHeR.example.COM',
39+
}
40+
end
3341

3442
it { is_expected.to compile.with_all_deps }
3543
it do
3644
is_expected.to contain_apache__vhost__fragment('pulp-https-container')
3745
.with_vhost('rhsm-pulpcore-reverse-proxy-443')
3846
.with_priority('10')
3947
.with_content(%r{^\s+<Location "/other_pulpcore_registry/vr2/">$})
40-
.with_content(%r{^\s+Require expr %\{tolower:%\{SSL_CLIENT_S_DN_CN\}\} == "foo.example.com"$})
48+
.with_content(%r{^\s+Require expr %\{tolower:%\{SSL_CLIENT_S_DN_CN\}\} == "another.example.com"$})
4149
.with_content(%r{^\s+RequestHeader set SSL_CLIENT_S_DN "admin"$})
4250
.with_content(%r{^\s+</Location>$})
4351
.with_content(%r{^\s+ProxyPass /vr1/ https://foo\.example\.com:8443/container_gateway/vr1/$})

0 commit comments

Comments
 (0)