Skip to content

Commit

Permalink
Fixes #30535 - Set HTTP headers for proxy requests
Browse files Browse the repository at this point in the history
  • Loading branch information
hsahmed committed Aug 21, 2020
1 parent e3bf011 commit cc2d829
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions templates/auth_kerb.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@
KrbLocalUserMapping On
# require valid-user
require pam-account <%= scope.lookupvar('::foreman::pam_service') %>
# Set headers for proxy requests
RewriteRule .* - [E=HTTP_REMOTE_USER:%{REMOTE_USER}]
RequestHeader set REMOTE_USER %{REMOTE_USER}e
RewriteRule .* - [E=HTTP_REMOTE_USER_EMAIL:%{REMOTE_USER_EMAIL}]
RequestHeader set REMOTE_USER_EMAIL %{REMOTE_USER_EMAIL}e
RewriteRule .* - [E=HTTP_REMOTE_USER_FIRSTNAME:%{REMOTE_USER_FIRSTNAME}]
RequestHeader set REMOTE_USER_FIRSTNAME %{REMOTE_USER_FIRSTNAME}e
RewriteRule .* - [E=HTTP_REMOTE_USER_LASTNAME:%{REMOTE_USER_LASTNAME}]
RequestHeader set REMOTE_USER_LASTNAME %{REMOTE_USER_LASTNAME}e
RewriteRule .* - [E=HTTP_REMOTE_USER_GROUPS:%{REMOTE_USER_GROUPS}]
RequestHeader set REMOTE_USER_GROUPS %{REMOTE_USER_GROUPS}e
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
1 change: 1 addition & 0 deletions templates/lookup_identity.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
LookupUserAttr email REMOTE_USER_EMAIL
LookupUserAttr firstname REMOTE_USER_FIRSTNAME
LookupUserAttr lastname REMOTE_USER_LASTNAME
LookupUserGroups REMOTE_USER_GROUPS :
LookupUserGroupsIter REMOTE_USER_GROUP
</LocationMatch>

0 comments on commit cc2d829

Please sign in to comment.