Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect issue with sample google configuration #7

Closed
wstrange opened this issue May 16, 2014 · 13 comments
Closed

Redirect issue with sample google configuration #7

wstrange opened this issue May 16, 2014 · 13 comments

Comments

@wstrange
Copy link

This could be an issue with my configuration

I am attempting to configure google as the OIDC provider. Using the 1.2 release on Ubuntu 14.04.

It kind of works, but has odd behaviour:

It simply hangs at this point - on both firefox and chrome.

However - if I let it timeout, and then reload the /example page - it comes up OK!, and I can see that the oidc cookie is set.

I tried fiddling with the redirect url (/redirect_uri with and without trailing /) but that did not make a difference. So it appears that the odic module processes the assertion OK from google- but gets hung up trying to redirect back the original URL.

Here is my config

OIDCProviderIssuer accounts.google.com
OIDCProviderAuthorizationEndpoint https://accounts.google.com/o/oauth2/auth?approval_prompt=force
OIDCProviderTokenEndpoint https://accounts.google.com/o/oauth2/token
OIDCProviderTokenEndpointAuth client_secret_post
OIDCProviderUserInfoEndpoint https://www.googleapis.com/plus/v1/people/me/openIdConnect
OIDCProviderJwksUri https://www.googleapis.com/oauth2/v2/certs

OIDCClientID 431631896232-kdioacia46qnhv0uvp8rfh6es9t6rbp5.apps.googleusercontent.com
OIDCClientSecret XXXXXXXXXXXXXX

OIDCScope "openid email profile"
OIDCRedirectURI https://www.example.com:1443/example/redirect_uri
OIDCCryptoPassphrase password

<Location /example/>
Authtype openid-connect
require valid-user

@wstrange
Copy link
Author

Note: Looks like some of the angle brackets got stripped when I pasted the apache config. They are present

@jimfox
Copy link

jimfox commented May 16, 2014

Couple of things you might try:

  1. Make sure the redirect url is protected by the module.

  2. Set the cookie path to /, e.g.

  OIDCCookiePath /

Otherwise only the return url path sees it.

Jim

On Fri, 16 May 2014, Warren Strange wrote:

Date: Fri, 16 May 2014 11:37:30 -0700
From: Warren Strange notifications@github.com
To: pingidentity/mod_auth_openidc mod_auth_openidc@noreply.github.com
Reply-To: pingidentity/mod_auth_openidc
<reply+i-33699049-2efe93b35f74a1fc6d40e8f2bbb46f7f0b064dd5-5649383@reply.g
ithub.com>
Subject: [mod_auth_openidc] Redirect issue with sample google configuration
(#7)

This could be an issue with my configuration

I am attempting to configure google as the OIDC provider. Using the 1.2 release on Ubuntu 14.04.

It kind of works, but has odd behaviour:

It simply hangs at this point - on both firefox and chrome.

However - if I let it timeout, and then reload the /example page - it comes up OK!, and I can see that the oidc cookie is set.

I tried fiddling with the redirect url (/redirect_uri with and without trailing /) but that did not make a difference. So it appears that the odic
module processes the assertion OK from google- but gets hung up trying to redirect back the original URL.

Here is my config

OIDCProviderIssuer accounts.google.com
OIDCProviderAuthorizationEndpoint https://accounts.google.com/o/oauth2/auth?approval_prompt=force
OIDCProviderTokenEndpoint https://accounts.google.com/o/oauth2/token
OIDCProviderTokenEndpointAuth client_secret_post
OIDCProviderUserInfoEndpoint https://www.googleapis.com/plus/v1/people/me/openIdConnect
OIDCProviderJwksUri https://www.googleapis.com/oauth2/v2/certs

OIDCClientID 431631896232-kdioacia46qnhv0uvp8rfh6es9t6rbp5.apps.googleusercontent.com
OIDCClientSecret XXXXXXXXXXXXXX

OIDCScope "openid email profile"
OIDCRedirectURI https://www.example.com:1443/example/redirect_uri
OIDCCryptoPassphrase password

Authtype openid-connect
require valid-user


Reply to this email directly or view it onGitHub.[5649383__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxNTg4NDY1MCwiZGF0YSI6eyJpZCI6MzI0MzIzMjB9fQ==--df4f86e67110fc376b4929a2b4351d
e9ff785a55.gif]

@zandbelt
Copy link
Member

I run it on Ubuntu 14.04 ok, apache 2.4.7-1ubuntu4, but have to say it is the trunk so it differs from 1.2; can you enable the debug logs try trunk and send the output to me?

@zandbelt
Copy link
Member

Jim, I will fix the sample config on the cookie path

@wstrange
Copy link
Author

I get
Syntax error on line 15 of /etc/apache2/conf-enabled/auth_google.conf:

OIDCCookiePath not allowed here

So I assume that is a newer feature?

On Fri, May 16, 2014 at 2:27 PM, Hans Zandbelt notifications@github.comwrote:

Jim, I will fix the sample config on the cookie path


Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-43375693
.

@jimfox
Copy link

jimfox commented May 16, 2014

I get
Syntax error on line 15 of /etc/apache2/conf-enabled/auth_google.conf:

OIDCCookiePath not allowed here

It can't go in the main section. I do like this (/oidc-return/ is my return url)

<Location /oidc-return/>
Authtype openid-connect
OIDCCookie oidcstate
OIDCCookiePath /
require valid-user

I don't protect the entire site. That's always a bad idea. I use

<Location /oidc/>
Authtype openid-connect
OIDCCookie oidcstate
OIDCCookiePath /
require valid-user

to protect the content at /oidc/...

Jim

@jimfox
Copy link

jimfox commented May 16, 2014

Hans,

Seems like OIDCCookiePath and OIDCCookie could be RSRC_CONF as well as ACCESS_CONF|OR_AUTHCFG.

Most sites I expect would use just one setting for both of them.

Jim

On Fri, 16 May 2014, Hans Zandbelt wrote:

Date: Fri, 16 May 2014 13:27:10 -0700
From: Hans Zandbelt notifications@github.com
To: pingidentity/mod_auth_openidc mod_auth_openidc@noreply.github.com
Cc: jimfox fox@washington.edu
Reply-To: pingidentity/mod_auth_openidc
<reply+i-33699049-2efe93b35f74a1fc6d40e8f2bbb46f7f0b064dd5-5649383@reply.g
ithub.com>
Subject: Re: [mod_auth_openidc] Redirect issue with sample google
configuration (#7)

Jim, I will fix the sample config on the cookie path


Reply to this email directly or view it onGitHub.[5649383__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxNTg5MTIzMCwiZGF0YSI6eyJpZCI6MzI0MzIzMjB9fQ==--307678e5c390a80ac257688c37f310
dd7ab6f636.gif]

@zandbelt
Copy link
Member

agreed, I will patch it separately; also curious if using OIDCCookiePath in its current form solves this issue

@wstrange
Copy link
Author

Apache does not complain anymore - but I get the same behaviour. Hangs
until timeout, but then I can reload the page and it works.

I see the oidcstate cookie now (based on your example).
This is my config:

OIDCProviderIssuer accounts.google.com

OIDCProviderAuthorizationEndpoint
https://accounts.google.com/o/oauth2/auth?approval_prompt=force

OIDCProviderTokenEndpoint https://accounts.google.com/o/oauth2/token

OIDCProviderTokenEndpointAuth client_secret_post

OIDCProviderUserInfoEndpoint
https://www.googleapis.com/plus/v1/people/me/openIdConnect

OIDCProviderJwksUri https://www.googleapis.com/oauth2/v2/certs

OIDCClientID
431631896232-kdioacia46qnhv0uvp8rfh6es9t6rbp5.apps.googleusercontent.com

OIDCClientSecret XXXXXX

OIDCScope "openid email profile"

OIDCRedirectURI https://www.example.com:1443/example/redirect_uri

OIDCCryptoPassphrase password

<Location /example/>

OIDCCookiePath /

OIDCCookie oidcstate

Authtype openid-connect

require valid-user

On Fri, May 16, 2014 at 2:58 PM, jimfox notifications@github.com wrote:

I get
Syntax error on line 15 of /etc/apache2/conf-enabled/auth_google.conf:

OIDCCookiePath not allowed here

It can't go in the main section. I do like this (/oidc-return/ is my
return url)

<Location /oidc-return/>
Authtype openid-connect
OIDCCookie oidcstate
OIDCCookiePath /
require valid-user

I don't protect the entire site. That's always a bad idea. I use

<Location /oidc/>
Authtype openid-connect
OIDCCookie oidcstate
OIDCCookiePath /
require valid-user

to protect the content at /oidc/...

Jim


Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-43378710
.

@jimfox
Copy link

jimfox commented May 16, 2014

With your redirect URL you would want locationmatch, i.e.

<LocationMatch /example/>
OIDCCookiePath /
OIDCCookie oidcstate
Authtype openid-connect
require valid-user

or else

<Location /example/redirect_uri>
...

Jim

On Fri, 16 May 2014, Warren Strange wrote:

Date: Fri, 16 May 2014 14:07:19 -0700
From: Warren Strange notifications@github.com
To: pingidentity/mod_auth_openidc mod_auth_openidc@noreply.github.com
Cc: jimfox fox@washington.edu
Reply-To: pingidentity/mod_auth_openidc
<reply+i-33699049-2efe93b35f74a1fc6d40e8f2bbb46f7f0b064dd5-5649383@reply.g
ithub.com>
Subject: Re: [mod_auth_openidc] Redirect issue with sample google
configuration (#7)

Apache does not complain anymore - but I get the same behaviour. Hangs
until timeout, but then I can reload the page and it works.

I see the oidcstate cookie now (based on your example).
This is my config:

OIDCProviderIssuer accounts.google.com

OIDCProviderAuthorizationEndpoint
https://accounts.google.com/o/oauth2/auth?approval_prompt=force

OIDCProviderTokenEndpoint https://accounts.google.com/o/oauth2/token

OIDCProviderTokenEndpointAuth client_secret_post

OIDCProviderUserInfoEndpoint
https://www.googleapis.com/plus/v1/people/me/openIdConnect

OIDCProviderJwksUri https://www.googleapis.com/oauth2/v2/certs

OIDCClientID
431631896232-kdioacia46qnhv0uvp8rfh6es9t6rbp5.apps.googleusercontent.com

OIDCClientSecret XXXXXX

OIDCScope "openid email profile"

OIDCRedirectURI https://www.example.com:1443/example/redirect_uri

OIDCCryptoPassphrase password

<Location /example/>

OIDCCookiePath /

OIDCCookie oidcstate

Authtype openid-connect

require valid-user

On Fri, May 16, 2014 at 2:58 PM, jimfox notifications@github.com wrote:

I get
Syntax error on line 15 of /etc/apache2/conf-enabled/auth_google.conf:

OIDCCookiePath not allowed here

It can't go in the main section. I do like this (/oidc-return/ is my
return url)

<Location /oidc-return/>
Authtype openid-connect
OIDCCookie oidcstate
OIDCCookiePath /
require valid-user

I don't protect the entire site. That's always a bad idea. I use

<Location /oidc/>
Authtype openid-connect
OIDCCookie oidcstate
OIDCCookiePath /
require valid-user

to protect the content at /oidc/...

Jim


Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-43378710
.


Reply to this email directly or view it onGitHub.[5649383__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxNTg5MzYzOSwiZGF0YSI6eyJpZCI6MzI0MzIzMjB9fQ==--650be188848bf4e2391bd25138db29
4da6225a71.gif]

@wstrange
Copy link
Author

Still getting this error.

I have tried a bunch of different combinations of the above Location and LocationMatch, and they have the same issue. I am now using the latest build (from source).

One thing I see in the Apache logs is:
redirecting to original url: https://www.example.com:1443:1443/example2/index.html,

So the redirect URL is getting messed up (note the extra :1443). Are you guys doing your testing with default http ports? (:80 :443?).

Firefox eventual times out with a "Corrupted Content" error. Reloading the original page works (i.e. the cookie is getting set just fine, protected access works).

This is not a show stopper for me right now - so not a big deal.

@zandbelt
Copy link
Member

indeed using a non-standard port was the problem and is fixed in 1d9dada; please see if that solves it for you

@wstrange
Copy link
Author

Yup - that fixed the problem.

Thanks Hans

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants