Skip to content

Commit

Permalink
Fixes #32352 - use mod_auth_gssapi instead of mod_auth_kerb
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni authored and ekohl committed Jul 6, 2021
1 parent 88ee2c8 commit 91850a2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
6 changes: 3 additions & 3 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
$foreman_socket_override = template('foreman/foreman.socket-overrides.erb')

if $foreman::ipa_authentication {
unless fact('foreman_ipa.default_server') and fact('foreman_ipa.default_realm') {
unless fact('foreman_ipa.default_server') {
fail("${facts['networking']['hostname']}: The system does not seem to be IPA-enrolled")
}

Expand Down Expand Up @@ -174,8 +174,8 @@
ssl_content => template('foreman/lookup_identity.conf.erb'),
}

foreman::config::apache::fragment { 'auth_kerb':
ssl_content => template('foreman/auth_kerb.conf.erb'),
foreman::config::apache::fragment { 'auth_gssapi':
ssl_content => template('foreman/auth_gssapi.conf.erb'),
}


Expand Down
2 changes: 1 addition & 1 deletion manifests/config/apache.pp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
include apache::mod::authnz_pam
include apache::mod::intercept_form_submit
include apache::mod::lookup_identity
include apache::mod::auth_kerb
include apache::mod::auth_gssapi
} elsif $keycloak {
include apache::mod::auth_openidc

Expand Down
7 changes: 3 additions & 4 deletions spec/classes/foreman_config_ipa_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,16 @@
it { should contain_class('apache::mod::authnz_pam') }
it { should contain_class('apache::mod::intercept_form_submit') }
it { should contain_class('apache::mod::lookup_identity') }
it { should contain_class('apache::mod::auth_kerb') }
it { should contain_class('apache::mod::auth_gssapi') }

it 'should contain Apache fragments' do
should contain_foreman__config__apache__fragment('intercept_form_submit')
.with_ssl_content(/^\s*InterceptFormPAMService foreman$/)

should contain_foreman__config__apache__fragment('lookup_identity')

should contain_foreman__config__apache__fragment('auth_kerb')
.with_ssl_content(/^\s*KrbAuthRealms REALM$/)
.with_ssl_content(%r{^\s*Krb5KeyTab /etc/httpd/conf/http.keytab$})
should contain_foreman__config__apache__fragment('auth_gssapi')
.with_ssl_content(%r{^\s*GssapiCredStore keytab:/etc/httpd/conf/http.keytab$})
.with_ssl_content(/^\s*require pam-account foreman$/)
end

Expand Down
14 changes: 6 additions & 8 deletions templates/auth_kerb.conf.erb → templates/auth_gssapi.conf.erb
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@

<Location /users/extlogin>
SSLRequireSSL
AuthType Kerberos
AuthName "Kerberos Login"
KrbMethodNegotiate On
KrbMethodK5Passwd Off
KrbAuthRealms <%= @facts['foreman_ipa']['default_realm'] %>
Krb5KeyTab <%= scope.lookupvar('::foreman::http_keytab') %>
KrbLocalUserMapping On
AuthType GSSAPI
AuthName "GSSAPI Single Sign On Login"
GssapiCredStore keytab:<%= scope.lookupvar('foreman::http_keytab') %>
GssapiSSLonly On
GssapiLocalName On
# require valid-user
require pam-account <%= scope.lookupvar('::foreman::pam_service') %>
require pam-account <%= scope.lookupvar('foreman::pam_service') %>
ErrorDocument 401 '<html><meta http-equiv="refresh" content="0; URL=/users/login"><body>Kerberos authentication did not pass.</body></html>'
# The following is needed as a workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1020087
ErrorDocument 500 '<html><meta http-equiv="refresh" content="0; URL=/users/login"><body>Kerberos authentication did not pass.</body></html>'
Expand Down

0 comments on commit 91850a2

Please sign in to comment.