Bug 1750786

Summary: RequestHeader IdP - `oc login` fails because oauth-server sets incompatible headers
Product: OpenShift Container Platform Reporter: Standa Laznicka <slaznick>
Component: apiserver-authAssignee: Standa Laznicka <slaznick>
Status: CLOSED ERRATA QA Contact: Wei Sun <wsun>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.2.0CC: aos-bugs, mfojtik, mkhan
Target Milestone: ---   
Target Release: 4.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1750809 (view as bug list) Environment:
Last Closed: 2019-10-16 06:40:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1750809    

Description Standa Laznicka 2019-09-10 13:25:51 UTC
Description of problem:
When RequestHeader IdP is configured for challenges, authentication requests fail because the oauth-server sets incompatible headers (Location and WWW-Authenticate).

Version-Release number of selected component (if applicable):
4.x

How reproducible:
always

Steps to Reproduce:
1. configure ReqeustHeader IdP as challenger
2. curl -k -H "X-Csrf-Token: 1" 'https://<oauth-server-host>/oauth/authorize?client_id=openshift-challenging-client&response_type=token'

Actual results:
Error: redirect header (Location: https://oauth-proxy-httpd.usersys.redhat.com/challenging-proxy/oauth/authorize?client_id=openshift-challenging-client&response_type=token) and challenge header (WWW-Authenticate: Basic realm="openshift") cannot both be set

Expected results:
Redirect to a server which will authenticate the user to openshift with a request with a required header

Comment 2 Chuan Yu 2019-09-11 11:26:22 UTC
Verified on 4.2.0-0.nightly-2019-09-10-235718

$  curl -k -H "X-Csrf-Token: 1" 'https://oauth-openshift.apps.share.qe.devcluster.openshift.com/oauth/authorize?client_id=openshift-challenging-client&response_type=token' -v
*   Trying 10.0.148.245:443...
* TCP_NODELAY set
* Connected to oauth-openshift.apps.share.qe.devcluster.openshift.com (10.0.148.245) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: CN=*.apps.share.qe.devcluster.openshift.com
*  start date: Sep 11 04:46:42 2019 GMT
*  expire date: Sep 10 04:46:43 2021 GMT
*  issuer: CN=ingress-operator@1568177196
*  SSL certificate verify result: self signed certificate in certificate chain (19), continuing anyway.
> GET /oauth/authorize?client_id=openshift-challenging-client&response_type=token HTTP/1.1
> Host: oauth-openshift.apps.share.qe.devcluster.openshift.com
> User-Agent: curl/7.65.3
> Accept: */*
> X-Csrf-Token: 1
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Expires: 0
< Location: https://oauth-proxy-httpd.usersys.redhat.com/challenging-proxy/oauth/authorize?client_id=openshift-challenging-client&response_type=token
< Pragma: no-cache
< Referrer-Policy: strict-origin-when-cross-origin
< X-Content-Type-Options: nosniff
< X-Dns-Prefetch-Control: off
< X-Frame-Options: DENY
< X-Xss-Protection: 1; mode=block
< Date: Wed, 11 Sep 2019 11:25:14 GMT
< Content-Length: 0
<
* Connection #0 to host oauth-openshift.apps.share.qe.devcluster.openshift.com left intact

Comment 4 errata-xmlrpc 2019-10-16 06:40:52 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-2019:2922