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

The [keystone_authtoken] www_authenticate_uri option should point public url #217

Closed
kajinamit opened this issue Jan 10, 2023 · 8 comments · Fixed by #535
Closed

The [keystone_authtoken] www_authenticate_uri option should point public url #217

kajinamit opened this issue Jan 10, 2023 · 8 comments · Fixed by #535

Comments

@kajinamit
Copy link
Contributor

kajinamit commented Jan 10, 2023

Currently the [keystone_authtoken] www_authenticate_uri option points internal url, but this should point public url, because the url is returned to clients when auth request fails.

We probably have to add separate options for public/internal endpoint and use different endpoints accordingly.

@gibizer
Copy link
Contributor

gibizer commented Jan 10, 2023

I believe nova-api using the public keystone URL for everything:

$ oc get -o yaml NovaAPI/nova-api | grep keystoneAuthURL
  keystoneAuthURL: http://keystone-public-openstack.apps-crc.testing

I think the template parameter name is misleading here:

www_authenticate_uri = {{ .keystone_internal_url }}

But the actual value is coming from here:

keystoneAPI, err := keystonev1.GetKeystoneAPI(ctx, h, instance.Namespace, map[string]string{})
if err != nil {
return "", err
}
authURL, err := keystoneAPI.GetEndpoint(endpoint.EndpointPublic)

So my questions is: Is it OK to use the public endpoint for everything?

  • If yes, then I will rename the template parameter
  • If no, then I need to have a list of config params names where we need the public and another list of config param names where we need the internal keystone auth url. Then I will introduce a separate field on NovaAPI CR and also in the template.

@SeanMooney
Copy link
Contributor

my intenstion is for nova to use the internal endpoitns of all service it calls but our external links in the API repoce should really be to the endpoint you invoked.

so if you call to the internal endpoint it should be internal and external external.

@gibizer
Copy link
Contributor

gibizer commented Jan 10, 2023

my intenstion is for nova to use the internal endpoitns of all service it calls but our external links in the API repoce should really be to the endpoint you invoked.

so if you call to the internal endpoint it should be internal and external external.

  1. So I guess to force nova to call the internal endpoint of keystone when calling to other services we need to set the auth_url to the internal endpoint in each [<service>] section. So that mean I will introduce a new field to the NovaAPI CR for the internal keystone endpoint.

  2. so if you call to the internal endpoint it should be internal and external external.

Do you know how to configure nova to get this behavior?

@SeanMooney
Copy link
Contributor

i dont think we should have to change the CR we should just take one keystone URL and that should be the internal one although we can always use endpoint to lookup the internal one too programmatically regardless of what is passed by the user in the cr.

for 2 no i thought we looked at the URL used to make the query to determine how we render the refurls in the responce.

@kajinamit
Copy link
Contributor Author

I believe nova-api using the public keystone URL for everything:

$ oc get -o yaml NovaAPI/nova-api | grep keystoneAuthURL
  keystoneAuthURL: http://keystone-public-openstack.apps-crc.testing

Sorry I was confused by that naming (keystone_internal_url ) and you are totally correct. Probably we'd want to rename the paraneter name to avoid misleading as you said...

Jusy FYI. If we want nova to use internal endpoint for keystone API call, what we'd need are

  • Use internal endpoint for [keystone_authtoken] auth_url
  • Set [keystone_authtoken] interface = internal

However even in that case [keystone_authtoken] www_authenticate_uri should point the public endpoint because it can be exposed to external clients.

@gibizer
Copy link
Contributor

gibizer commented Jan 10, 2023

i dont think we should have to change the CR we should just take one keystone URL and that should be the internal one

OK I can make that change without CR change. I will pass only the internal URL to NovaAPI.
But it also means I either don't set [keystone_authtoken] www_authenticate_uri or set it to the internal URL too. The latter is not good according to @kajinamit . Would be OK not to configuring www_authenticate_uri at all?

@kajinamit
Copy link
Contributor Author

AFAIK we have to configure www_authenticate_uri, otherwise the middleware returns wrong url (likely http://127.0.0.1:35357 ).

@gibizer
Copy link
Contributor

gibizer commented Sep 18, 2023

# Complete "public" Identity API endpoint. This endpoint should not be an
# "admin" endpoint, as it should be accessible by all end users.
# Unauthenticated clients are redirected to this endpoint to authenticate.
# Although this endpoint should ideally be unversioned, client support in the
# wild varies. If you're using a versioned v2 endpoint here, then this should
# *not* be the same endpoint the service user utilizes for validating tokens,
# because normal end users may not be able to reach that endpoint. (string
# value)
# Deprecated group/name - [keystone_authtoken]/auth_uri
#www_authenticate_uri = <None>

Based on the config doc we have to pass the public url so I will propose a patch to fix this.

gibizer added a commit to gibizer/nova-operator that referenced this issue Sep 18, 2023
According to the keystone middleware doc we have to set
www_authenticate_uri to the public keystone endpoint as an
unauthenticated user is redirected to this URL.

Our service uses the internal endpoint for auth and so far it used the
internal endpoint for www_authenticate_uri as well. But this will not
work for external users.

A new field is added to the NovaAPI CR to allow configuring not just the
internal endpoint but also the public endpoint.

Closes: openstack-k8s-operators#217
gibizer added a commit to gibizer/nova-operator that referenced this issue Sep 22, 2023
According to the keystone middleware doc we have to set
www_authenticate_uri to the public keystone endpoint as an
unauthenticated user is redirected to this URL.

Our service uses the internal endpoint for auth and so far it used the
internal endpoint for www_authenticate_uri as well. But this will not
work for external users.

A new field is added to the NovaAPI CR to allow configuring not just the
internal endpoint but also the public endpoint.

Closes: openstack-k8s-operators#217
openshift-merge-robot pushed a commit that referenced this issue Oct 2, 2023
According to the keystone middleware doc we have to set
www_authenticate_uri to the public keystone endpoint as an
unauthenticated user is redirected to this URL.

Our service uses the internal endpoint for auth and so far it used the
internal endpoint for www_authenticate_uri as well. But this will not
work for external users.

A new field is added to the NovaAPI CR to allow configuring not just the
internal endpoint but also the public endpoint.

Closes: #217
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

Successfully merging a pull request may close this issue.

3 participants