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

Allow customize http vhost config using HttpdCustomization.CustomServiceConfigSecret #525

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stuggi
Copy link
Contributor

@stuggi stuggi commented Jan 10, 2025

This change allows to customize the httpd vhost config using this parameter to specify a secret that contains service config data. The content of each provided snippet gets rendered as a go template and placed into /etc/httpd/conf/httpd_custom_<endpoint>_<key> .
At the end of the vhost config in the default httpd template these custom configs get included using Include conf/httpd_custom_<endpoint>_*.

For information on how sections in httpd configuration get merged, check section "How the sections are merged" in https://httpd.apache.org/docs/current/sections.html#merging

Depends-On: openstack-k8s-operators/lib-common#591

Copy link
Contributor

openshift-ci bot commented Jan 10, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: stuggi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@stuggi
Copy link
Contributor Author

stuggi commented Jan 10, 2025

With this change you can e.g. add the following template in a secret to configure OIDC Federation Settings

OIDCClaimPrefix "OIDC-"
OIDCResponseType "id_token"
OIDCScope "openid email profile"
OIDCClaimDelimiter ";"
OIDCPassUserInfoAs "claims"
OIDCPassClaimsAs "both"
OIDCCacheType "memcache"
OIDCMemCacheServers "{{ .memcachedServers }}"
OIDCProviderMetadataURL "https://my_provider_metadata_url"
OIDCClientID "my_client_id"
OIDCClientSecret "12345678"
OIDCCryptoPassphrase "12345678"
OIDCOAuthClientID "my_oauth_client_id"
OIDCOAuthClientSecret "12345678"
OIDCOAuthIntrospectionEndpoint "https://my_oauth_introspection_endpoint"

# The following directives are necessary to support websso from Horizon
# (Per https://docs.openstack.org/keystone/pike/advanced-topics/federation/websso.html)
OIDCRedirectURI "{{ .KeystoneEndpointPublic }}/v3/auth/OS-FEDERATION/identity_providers/my_federation_provider_name/protocols/openid/websso"
OIDCRedirectURI "{{ .KeystoneEndpointPublic }}/v3/auth/OS-FEDERATION/websso/openid"

<LocationMatch "/v3/auth/OS-FEDERATION/identity_providers/my_federation_provider_name/protocols/openid/websso">
  AuthType "openid-connect"
  Require valid-user
</LocationMatch>

<Location ~ "/v3/OS-FEDERATION/identity_providers/my_federation_provider_name/protocols/openid/auth">
  AuthType oauth20
  Require valid-user
</Location>

<LocationMatch "/v3/auth/OS-FEDERATION/websso/openid">
  AuthType "openid-connect"
  Require valid-user
</LocationMatch>

The secret then can be referenced using httpdCustomization.customServiceConfigSecret and keystone config required parameters set via customServiceConfig:

    keystone:
      template:
        customServiceConfig: |
          [federation]
          trusted_dashboard={{ .KeystoneEndpointPublic }}/dashboard/auth/websso/

          [openid]
          remote_id_attribute=HTTP_OIDC_ISS

          [auth]
          methods = password,token,oauth1,mapped,application_credential,openid
        httpdCustomization:
          overrideSecret: keystone-httpd-override

Todo: Align template parameters to and document a dict on which could be used in a custom config template.

@@ -1201,7 +1215,19 @@ func (r *KeystoneAPIReconciler) generateServiceConfigMaps(
"fernetMaxActiveKeys": instance.Spec.FernetMaxActiveKeys,
}

templateParameters["KeystoneEndpointPublic"], _ = instance.GetEndpoint(endpoint.EndpointPublic)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is essentially an api do we need to version it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean using a versioned name as the template parameter e.g. KeystoneEndpointPublicV1?

…iceConfigSecret

This change allows to customize the httpd vhost config using this parameter
to specify a secret that contains service config data. The content of each
provided snippet gets rendered as a go template and placed into
/etc/httpd/conf/httpd_custom_<endpoint>_<key> .
At the end of the vhost config in the default httpd template these custom
configs get included using `Include conf/httpd_custom_<endpoint>_*`.

For information on how sections in httpd configuration get merged, check section
"How the sections are merged" in https://httpd.apache.org/docs/current/sections.html#merging

Depends-On: openstack-k8s-operators/lib-common#591

Signed-off-by: Martin Schuppert <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants