Bug 1439221 - [3.5] Can't login to Jenkins application when ENABLE_OAUTH=true and RequestHeaderIdentityProvider is used
Summary: [3.5] Can't login to Jenkins application when ENABLE_OAUTH=true and RequestHe...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: apiserver-auth
Version: 3.5.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Jordan Liggitt
QA Contact: Chuan Yu
URL:
Whiteboard:
: 1439222 (view as bug list)
Depends On: 1434983
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-04-05 12:55 UTC by Scott Dodson
Modified: 2020-04-15 15:34 UTC (History)
20 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Redirects to OAuth approval flows used absolute URLs. Consequence: OAuth approval flows would not work when used in combination with a RequestHeaderIdentityProvider. Fix: The OAuth approval endpoint was moved to be a subpath of the authorize endpoint (https://<master>/oauth/authorize/approve) and redirects were made relative. Result: OAuth approval flows work properly when used in combination with a RequestHeaderIdentityProvider, as long as the authenticating proxy meets the following requirements: 1. The URL that proxies to https://<master>/oauth/authorize also ends with ".../authorize" (with no trailing slash) 2. Subpaths of the URL that proxies to https://<master>/oauth/authorize are also proxied (for example, "https://<master>/oauth/authorize/approve")
Clone Of: 1434983
Environment:
Last Closed: 2017-04-12 19:15:03 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:0884 0 normal SHIPPED_LIVE Red Hat OpenShift Container Platform 3.5 RPM Release Advisory 2017-04-12 22:50:07 UTC

Description Scott Dodson 2017-04-05 12:55:26 UTC
+++ This bug was initially created as a clone of Bug #1434983 +++

+++ This bug was initially created as a clone of Bug #1421629 +++

Description of problem:
Error message "The requested URL /oauth/approve was not found on this server" returns, when accessing Jenkins application created by default template "jenkins-persistent".

Version-Release number of selected component (if applicable):
OpenShift Master: v3.4.1.2
Kubernetes Master: v1.4.0+776c994

How reproducible:
Always

Steps to Reproduce:
1. Configure server with RequestHeaderIdentityProvider
2. Create Jenkins application using default template "jenkins-persistent"("OAuth OpenShift integration" is enabled);
3. After all the pods are running well, check if Jenkins can be accessed or not.

Actual results:
3. After clicking "Login with Openshift", error message "The requested URL /oauth/approve was not found on this server" returns.


cluster is using RequestHeaderIdentityProvider:
...
  identityProviders:
  - challenge: false
    provider:
      headers:
      - Remote-User
      kind: RequestHeaderIdentityProvider
      nameHeaders:
      - Remote-User-Name
      loginURL: https://auth-proxy.example.com/mod_auth_mellon/?${query}
      apiVersion: v1
      clientCA: /etc/origin/master/ca.crt
    mappingMethod: lookup
    login: true
    name: myidp
...

--- Additional comment from Jordan Liggitt on 2017-02-14 12:45:18 EST ---

Currently, two URLs are accessed during the OAuth flow that require authentication information:

  $master/oauth/authorize
  $master/oauth/approve

When using a RequestHeaderIdentityProvider, all authentication information must come from the auth proxy.

loginURL is used to specify the URL that proxies to $master/oauth/authorize

There is no option to configure the URL that proxies to $master/oauth/approve (this was an oversight). When approval is needed during an OAuth flow, a redirect to /oauth/approve is done.


Temporary workaround:
1. Change the auth proxy to proxy https://auth-proxy.example.com/oauth/* to $master/oauth/*
2. Change the origin config to
  loginURL: https://auth-proxy.example.com/oauth/authorize?${query}


This "fixes" the issue by making the auth proxy paths match the /oauth/* paths on the API server, and makes the auth proxy proxy both /oauth/authorize and /oauth/approve

Long term, we have a couple options:
1. Add another config option to specify the approve proxy path, and make the proxy explicitly set up a proxy rule for /oauth/approve

2. Move /oauth/approve under /oauth/authorize/approve and depend on the loginURL proxy path proxying subpaths as well

--- Additional comment from Jordan Liggitt on 2017-02-14 13:03:57 EST ---

See https://github.com/openshift/request-header-saml-service-provider/pull/7 for changes to the SAML pod to support the temporary workaround

--- Additional comment from Jordan Liggitt on 2017-02-14 14:46:28 EST ---

verified with the changes in https://github.com/openshift/request-header-saml-service-provider/pull/7 we can run grant approval through the auth proxy

--- Additional comment from Troy Dawson on 2017-02-16 17:29:31 EST ---

Should be fixed in openshift3/saml-service-provider:1.0-5 which is available in testing areas.

--- Additional comment from Jordan Liggitt on 2017-02-16 17:36:14 EST ---

the following config changes are needed when deploying that version:

for the saml pod, instead of:
OSE_API_PUBLIC_URL=https://api.example.com/oauth/authorize
set
PROXY_PATH=/oauth/
PROXY_DESTINATION=https://api.example.com/oauth/


for the apiserver, change the master-config.yaml loginURL to:
loginURL: https://auth-proxy.example.com/oauth/authorize?${query}

--- Additional comment from Jordan Liggitt on 2017-04-04 14:36:42 EDT ---

The workaround for this issue is to make the auth proxy paths match the API server paths for these paths:

These are the paths that require proxying currently:
  https://api.acme.com/oauth/authorize (and subpaths)
  https://api.acme.com/oauth/approve

The auth proxy paths would be:
  https://auth.acme.com/oauth/authorize (and subpaths)
  https://auth.acme.com/oauth/approve

The master-config.yaml would be:
...
oauthConfig:
  identityProviders:
  - name: ...
    login: true
    ...
    provider:
      apiVersion: v1
      kind: RequestHeaderIdentityProvider
      loginURL: "https://auth.acme.com/oauth/authorize?${query}"
      ...


https://github.com/openshift/origin/pull/13569 will move the approval flow to /oauth/authorize/approve so there is a single root that auth proxies need to proxy.

Comment 1 Scott Dodson 2017-04-05 12:57:38 UTC
*** Bug 1439222 has been marked as a duplicate of this bug. ***

Comment 4 Chuan Yu 2017-04-06 10:05:15 UTC
Verified with 3.5.5.2 build, here is the step:
1.setup RequestHeaderIdentityProvider and saml as the authenticate method.
2.login to openshift, create new project and new-app jenkin app.
3.lunch jenkins successfully.

# openshift version
openshift v3.5.5.2
kubernetes v1.5.2+43a9be4
etcd 3.1.0

Comment 6 errata-xmlrpc 2017-04-12 19:15:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:0884


Note You need to log in before you can comment on or make changes to this bug.