Skip to content

Commit 891fdaf

Browse files
committed
Support mod_auth_gssapi parameters
mod_auth_gssapi parameters can only used inside a directory section of a vhost. Parameters are specified as a hash `gssapi` to the directories parameter. Currently only the three obvious parameters are supported, adding extra ones is a trivial addition to the `_gssapi.epp` template. Example ```puppet include apache::mod::auth_gssapi apache::vhost { 'sample.example.net': docroot => '/path/to/directory', directories => [ { path => '/path/to/different/dir', gssapi => { credstore => 'keytab:/foo/bar.keytab', localname => 'Off', sslonly => 'On', } }, ], ``` These 3 values match to an apache configuration of ```config <Directory /path/to/directory> GssapiSSLonly Off GssapiLocalName On GssapiCredStore keytab:/foo/bar.keytab </Directory> ``` https://github.com/gssapi/mod_auth_gssapi#gssapisslonly
1 parent 3877dd9 commit 891fdaf

File tree

4 files changed

+57
-0
lines changed

4 files changed

+57
-0
lines changed

manifests/vhost.pp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,24 @@
14751475
# }
14761476
# ```
14771477
#
1478+
# @param gssapi
1479+
# Specfies mod_auth_gssapi parameters for particular directories in a virtual host directory
1480+
# ```puppet
1481+
# include apache::mod::auth_gssapi
1482+
# apache::vhost { 'sample.example.net':
1483+
# docroot => '/path/to/directory',
1484+
# directories => [
1485+
# { path => '/path/to/different/dir',
1486+
# gssapi => {
1487+
# credstore => 'keytab:/foo/bar.keytab',
1488+
# localname => 'Off',
1489+
# sslonly => 'On',
1490+
# }
1491+
# },
1492+
# ],
1493+
# }
1494+
# ```
1495+
#
14781496
# @param ssl
14791497
# Enables SSL for the virtual host. SSL virtual hosts only respond to HTTPS queries.
14801498
#

spec/defines/vhost_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@
246246
'passenger_allow_encoded_slashes' => false,
247247
'passenger_app_log_file' => '/tmp/app.log',
248248
'passenger_debugger' => false,
249+
'gssapi' => {
250+
'credstore' => 'keytab:/foo/bar.keytab',
251+
'localname' => 'On',
252+
'sslonly' => 'Off',
253+
},
249254
},
250255
],
251256
'error_log' => false,
@@ -921,6 +926,21 @@
921926
content: %r{^\s+PassengerDebugger\sOff$},
922927
)
923928
}
929+
it {
930+
is_expected.to contain_concat__fragment('rspec.example.com-directories').with(
931+
content: %r{^\s+GssapiCredStore\skeytab:/foo/bar.keytab$},
932+
)
933+
}
934+
it {
935+
is_expected.to contain_concat__fragment('rspec.example.com-directories').with(
936+
content: %r{^\s+GssapiSSLonly\sOff$},
937+
)
938+
}
939+
it {
940+
is_expected.to contain_concat__fragment('rspec.example.com-directories').with(
941+
content: %r{^\s+GssapiLocalName\sOn$},
942+
)
943+
}
924944
it { is_expected.to contain_concat__fragment('rspec.example.com-additional_includes') }
925945
it { is_expected.to contain_concat__fragment('rspec.example.com-logging') }
926946
it {

templates/vhost/_directories.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,9 @@
497497
<%- if directory['custom_fragment'] -%>
498498
<%= directory['custom_fragment'] %>
499499
<%- end -%>
500+
<%- if directory['gssapi'] -%>
501+
<%= scope.call_function('epp',["apache/vhost/_gssapi.epp", directory['gssapi']]) -%>
502+
<%- end -%>
500503
</<%= provider %>>
501504
<%- end -%>
502505
<%- end -%>

templates/vhost/_gssapi.epp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<%|
2+
# https://github.com/gssapi/mod_auth_gssapi
3+
Optional[String[1]] $credstore = undef,
4+
Optional[Enum['On','Off']] $sslonly = undef,
5+
Optional[Enum['On','Off']] $localname = undef,
6+
|%>
7+
# mod_auth_gssapi configuration
8+
<% if $sslonly { -%>
9+
GssapiSSLonly <%= $sslonly %>
10+
<% } -%>
11+
<% if $localname { -%>
12+
GssapiLocalName <%= $localname %>
13+
<% } -%>
14+
<% if $credstore { -%>
15+
GssapiCredStore <%= $credstore %>
16+
<% } -%>

0 commit comments

Comments
 (0)