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

cluster-wide oauth-proxy settings #343

Closed
wants to merge 1 commit into from

Conversation

deads2k
Copy link
Contributor

@deads2k deads2k commented May 26, 2020

The oauth-proxy is a commonly used proxy which allows a naive application to make use of in-cluster authentication and authorization to protect itself on an openshift platform without changing the application itself. This effectively makes the application appear as an extension to our platform, examples include: logging kibana, monitoring grafana, etc. There are many configuration values that are considered as related to platform configuration or security that the oauth-proxy could auto-detect.

@s-urbaniak @lilic @stlaz @sttts This is what I'm thinking about for some of the settings. Would it help?

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 26, 2020
@sttts
Copy link
Contributor

sttts commented May 27, 2020

Sgtm.

Copy link
Contributor

@lilic lilic left a comment

Choose a reason for hiding this comment

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

Looks good to me, only couple of questions.

There is one thing we have to consider that is not described here, if I remember correctly a lot/some of our customers use oauthproxy as well for their applications. I am guessing setting this override their applications set values as well?


## Proposal

We will create an oauthproxies.config.openshift.io to ensure that read access can be widely granted without any risk of
Copy link
Contributor

Choose a reason for hiding this comment

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

Would we need something in the console as well for users to set this easily? I am guessing this will be under the "Global Configuration" tab same as current oauth.config.openshift.io resource?

Copy link
Member

Choose a reason for hiding this comment

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


The following flags for oauth-proxy are good targets for being consistent for all oauth-proxy instances in the cluster.
If the oauth-proxy does not have one of these flags explicitly set, it will attempt to read the value from oauthproxies.config.openshift.io.
1. -cookie-expire
Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I understand this setting is then orthogonal to the global access token expiry as per https://docs.openshift.com/container-platform/4.4/authentication/configuring-internal-oauth.html#oauth-configuring-internal-oauth_configuring-internal-oauth, correct?

Does a potential discrepancy with the cookie session timeout and the access token expiry have any ramifications consuming applications have to consider?

Copy link

@soukron soukron May 27, 2020

Choose a reason for hiding this comment

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

+1 to make this parameter configurable per oauth-proxy instance. It only affects to the cookie time in the browser and it doesn't necessarily has to be aligned with the validity of the token provided in the CLI or any other web based application which also uses oauth-proxy.

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't mean to express a wish for per-instance configuration but rather if a discrepancy between a global cookie-expire timeout and a global access token expiry is a problem at all.

i see the following cases:

  • cookie expiry is shorter than access token expiry: in that case a re-login will be enforced as the initial (cookie-encrypted) access token is lost.
  • cookie expiry is longer than access token expiry: in that case a re-login will also be enforced as the access token expired.

I.e. from a user perspective the actual "session timeout" is min(cookie-expiry, access token expiry) correct?

Copy link
Member

Choose a reason for hiding this comment

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

The enhancement does not block per-instance configuration.

cookie expiry is shorter than access token expiry: in that case a re-login will be enforced as the initial (cookie-encrypted) access token is lost.

Yes.

cookie expiry is longer than access token expiry: in that case a re-login will also be enforced as the access token expired.

No. The session does not currently expire when the token does as far as I am aware.

Copy link

Choose a reason for hiding this comment

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

No. The session does not currently expire when the token does as far as I am aware.

This seems counter-intuitive to me, do we want to change the current behaviour to match suggestion from @s-urbaniak?

from a user perspective the actual "session timeout" is min(cookie-expiry, access token expiry)

Copy link

Choose a reason for hiding this comment

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

I'd still consider some override method per instance so different instances cna have different timeouts without requiring editing each operator or each deployment.

Let's say we can have an override per namespace and/or a matchLabel selector.

What I mean, no matter the implementation, is that it would be desirable to have configurable (and why not different) values for token/cookie timeout.

Copy link
Member

Choose a reason for hiding this comment

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

This seems counter-intuitive to me, do we want to change the current behaviour to match suggestion from @s-urbaniak?

currently not possible without further development investment into the oauth-proxy

I'd still consider some override method per instance so different instances cna have different timeouts without requiring editing each operator or each deployment.

use options of the binary

1. -cookie-expire
2. -cookie-refresh
3. logout-url (not yet present). If created, it will have a spec and a status.
If the spec is empty, the status will be filled in based on the console's logout URL.
Copy link
Member

Choose a reason for hiding this comment

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

This implies there's a controller that handles it. Which operator should house it, KAS-o, CAO?

3. logout-url (not yet present). If created, it will have a spec and a status.
If the spec is empty, the status will be filled in based on the console's logout URL.
4. http proxy settings. This will have a spec and a status.
If the values in proxies.config.openshift.io .status do not have credentials in them, we can automatically copy them
Copy link
Member

Choose a reason for hiding this comment

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

this is just about proxy/cluster, right? Not that I would expect more than a single instance of that object in the cluster.

accidentally allowing reading of more private data (versus attaching to oauth.config.openshift.io for instance).
Its .spec stanza contain typed fields for certain flags.

The following flags for oauth-proxy are good targets for being consistent for all oauth-proxy instances in the cluster.
Copy link
Contributor

Choose a reason for hiding this comment

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

So if I understand correctly, on our end the only thing we would need to change in cluster-monitoring-operator to just need to give the service accounts used by the proxy permissions to read oauthproxies.config.openshift.io.?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So if I understand correctly, on our end the only thing we would need to change in cluster-monitoring-operator to just need to give the service accounts used by the proxy permissions to read oauthproxies.config.openshift.io.?

If we did this, we would grant read access to all serviceaccounts. Will update the proposal.

Copy link

Choose a reason for hiding this comment

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

Just to clarify, this means that no additional permissions should be needed for our service accounts, right?

### Version Skew Strategy

oauth-proxy users can only rely on this feature in the openshift release it is delivered in.
If they need to work on a prior level of openshift, they will have to set the values on the oauth-proxy binary.
Copy link
Contributor

Choose a reason for hiding this comment

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

can you elaborate? does that mean that the above config custom resource will be backported but not the
auto-detection mechanism in oauth-proxy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

can you elaborate? does that mean that the above config custom resource will be backported but not the
auto-detection mechanism in oauth-proxy?

This means that if a new oauth-proxy (with auto-detection) goes on an old kube-apiserver (without the oauthproxies resource), then the auto-detection will produce a warning message, but continue with only flag based configuration.

Monitoring is in the payload with kube-apiserver, so it moves in lock-step. OLM based operators have to handle skew one way or the other.

will update the doc.

If the values in proxies.config.openshift.io .status do not have credentials in them, we can automatically copy them
to the https proxy status settings for oauthproxies.
If they do have credentials in them, we will not set the value by default.
The spec will always have precedence.
Copy link
Contributor

Choose a reason for hiding this comment

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

what will happen with proxy CAs? anything?

@bparees
Copy link
Contributor

bparees commented Jun 1, 2020

general +1 from me on the direction of this proposal

@shawn-hurley
Copy link

Sorry if this is obvious to others, but I am looking at how optional operators would use this config and I want to see if I understand the UX.

  1. The optional operator author needs to add the OAuth proxy to the list of related images that they need so that it will be mirrored into the cluster
  2. They need to use that OAuth proxy but also must conform to the config above otherwise, it may be a bad UX for the cluster-admin.
  3. We would need some way to test this in the pipeline.
  4. Is there a way that someone could keep using an old OAuth proxy that we don't want them to?

Have we considered giving a way for someone to request an OAuth proxy from openshift, that could always conform to this config, be kept up to date, and allow the operator to not need to know about the image?

@bparees
Copy link
Contributor

bparees commented Jun 3, 2020

The optional operator author needs to add the OAuth proxy to the list of related images that they need so that it will be mirrored into the cluster

no, because we already have the oauth imagestreamtag they should be referencing from their deployment. the oauth image is part of the OCP release payload, so it's always mirrored, as long as they reference it via the imagestreamtag, they'll get the image from the payload.

They need to use that OAuth proxy but also must conform to the config above otherwise, it may be a bad UX for the cluster-admin.

not sure what you mean by "conform to the config"? it's a global config, if the operator provides no config to the oauthproxy sidecar, it'll get the global config. If they provide their own config(via args) it'll override the cluster/global config

We would need some way to test this in the pipeline.

i don't know if it needs to be tested on a per operator basis...yes the auth team would need to have tests to prove the oauthproxy image respects the global config.

Is there a way that someone could keep using an old OAuth proxy that we don't want them to?

we can't stop someone from referencing+deploying any image they want

@shawn-hurley
Copy link

if the oauth-proxy does not have one of these flags explicitly set, it will attempt to read the value from oauthproxies.config.openshift.io.

Sorry I missed that part, thought the operator had to look at the config.

@gparvin
Copy link

gparvin commented Jul 8, 2020

Will this allow the ciphers to be able to be customized or to match the cipher config for the OCP ingress controller?

@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci-robot openshift-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 25, 2020
@openshift-bot
Copy link

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci-robot openshift-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Nov 24, 2020
@openshift-bot
Copy link

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci-robot
Copy link

@openshift-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@deads2k deads2k reopened this Jan 14, 2021
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign deads2k after the PR has been reviewed.
You can assign the PR to them by writing /assign @deads2k in a comment when ready.

The full list of commands accepted by this bot can be found 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

@openshift-ci-robot openshift-ci-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 14, 2021
@stlaz
Copy link
Member

stlaz commented Feb 9, 2021

/lifecycle frozen

@openshift-ci-robot openshift-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Feb 9, 2021
@dhellmann
Copy link
Contributor

This proposal is over a year old. As part of recent efforts to clean up old pull requests, I am removing the life-cycle/frozen label to allow it to age out and be closed. If the proposal is still active, please restore the label.

/remove-lifecycle frozen

@openshift-ci openshift-ci bot removed the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Sep 21, 2021
@openshift-bot
Copy link

Inactive enhancement proposals go stale after 28d of inactivity.

See https://github.com/openshift/enhancements#life-cycle for details.

Mark the proposal as fresh by commenting /remove-lifecycle stale.
Stale proposals rot after an additional 7d of inactivity and eventually close.
Exclude this proposal from closing by commenting /lifecycle frozen.

If this proposal is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 20, 2021
@openshift-bot
Copy link

Stale enhancement proposals rot after 7d of inactivity.

See https://github.com/openshift/enhancements#life-cycle for details.

Mark the proposal as fresh by commenting /remove-lifecycle rotten.
Rotten proposals close after an additional 7d of inactivity.
Exclude this proposal from closing by commenting /lifecycle frozen.

If this proposal is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 27, 2021
@openshift-bot
Copy link

Rotten enhancement proposals close after 7d of inactivity.

See https://github.com/openshift/enhancements#life-cycle for details.

Reopen the proposal by commenting /reopen.
Mark the proposal as fresh by commenting /remove-lifecycle rotten.
Exclude this proposal from closing again by commenting /lifecycle frozen.

/close

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 3, 2021

@openshift-bot: Closed this PR.

In response to this:

Rotten enhancement proposals close after 7d of inactivity.

See https://github.com/openshift/enhancements#life-cycle for details.

Reopen the proposal by commenting /reopen.
Mark the proposal as fresh by commenting /remove-lifecycle rotten.
Exclude this proposal from closing again by commenting /lifecycle frozen.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot closed this Nov 3, 2021
@stlaz
Copy link
Member

stlaz commented Jan 7, 2022

/reopen
/lifecycle frozen

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 7, 2022

@stlaz: Reopened this PR.

In response to this:

/reopen
/lifecycle frozen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot reopened this Jan 7, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 7, 2022

@stlaz: The lifecycle/frozen label cannot be applied to Pull Requests.

In response to this:

/reopen
/lifecycle frozen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 7, 2022

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please ask for approval from deads2k after the PR has been reviewed.

The full list of commands accepted by this bot can be found 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

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 7, 2022

@deads2k: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/markdownlint 5ed28d7 link true /test markdownlint

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-bot
Copy link

Rotten enhancement proposals close after 7d of inactivity.

See https://github.com/openshift/enhancements#life-cycle for details.

Reopen the proposal by commenting /reopen.
Mark the proposal as fresh by commenting /remove-lifecycle rotten.
Exclude this proposal from closing again by commenting /lifecycle frozen.

/close

@openshift-ci openshift-ci bot closed this Jan 14, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 14, 2022

@openshift-bot: Closed this PR.

In response to this:

Rotten enhancement proposals close after 7d of inactivity.

See https://github.com/openshift/enhancements#life-cycle for details.

Reopen the proposal by commenting /reopen.
Mark the proposal as fresh by commenting /remove-lifecycle rotten.
Exclude this proposal from closing again by commenting /lifecycle frozen.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet