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

authentication/login-logout: initial enhancement #894

Merged
merged 1 commit into from
Nov 10, 2021

Conversation

s-urbaniak
Copy link
Contributor

No description provided.

enhancements/authentication/login-logout-events.md Outdated Show resolved Hide resolved
enhancements/authentication/login-logout-events.md Outdated Show resolved Hide resolved
enhancements/authentication/login-logout-events.md Outdated Show resolved Hide resolved
enhancements/authentication/login-logout-events.md Outdated Show resolved Hide resolved
enhancements/authentication/login-logout-events.md Outdated Show resolved Hide resolved
enhancements/authentication/login-logout-events.md Outdated Show resolved Hide resolved
@s-urbaniak
Copy link
Contributor Author

@stlaz addressed comments, where feasible, ptal.

@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 Nov 2, 2021
@ibihim
Copy link
Contributor

ibihim commented Nov 4, 2021

I hope I addressed all comments. PTAL @s-urbaniak , @stlaz , @sttts , @EmilyM1

@stlaz
Copy link
Contributor

stlaz commented Nov 4, 2021

/remove-lifecycle stale

@openshift-ci openshift-ci bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 4, 2021
@stlaz
Copy link
Contributor

stlaz commented Nov 5, 2021

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 5, 2021
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 5, 2021

- unit tests,
- e2e tests in origin and
- tests at must-gather.
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally we test our feature with:

- unit tests,
- e2e tests in origin and
Copy link
Contributor

Choose a reason for hiding this comment

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

@ibihim ibihim force-pushed the login-logout branch 2 times, most recently from 8ba51bb to c20bfe5 Compare November 5, 2021 16:41
@ibihim ibihim force-pushed the login-logout branch 2 times, most recently from f43861b to 19f95b7 Compare November 8, 2021 20:40

### API Extensions

We introduce a new property called `audit` to the `OAuth` CRD.
Copy link
Contributor

Choose a reason for hiding this comment

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

OAuth CRD -> oauth.config.openshift.io type

Copy link
Contributor

Choose a reason for hiding this comment

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

Very useful comment.


### Operational Aspects of API Extensions

There is no explicit operational involvement expected. The property is set by default and is optional.
Copy link
Contributor

@stlaz stlaz Nov 9, 2021

Choose a reason for hiding this comment

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

The property is set to do what by default?

Copy link
Contributor

@ibihim ibihim Nov 9, 2021

Choose a reason for hiding this comment

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

Isn't this the goal of the kubebuilder command kubebuilder:default?


There is no explicit operational involvement expected. The property is set by default and is optional.

It could be turned off by operational interaction with the API extension.
Copy link
Contributor

@stlaz stlaz Nov 9, 2021

Choose a reason for hiding this comment

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

what's an "operational interaction"?

Copy link
Contributor

Choose a reason for hiding this comment

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

hahaha, wetware in action 😄

#### Support Procedures

If the `audit` can't be set in the CR, support would need to file a bugzilla.
If there are no audit events for login, login failures or logout events, verify that the `audit` values is set in the `oauth` CR.
Copy link
Contributor

Choose a reason for hiding this comment

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

The audit property does not influence logging of logout events

Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't? What is then the whole purpose of setting audit?

Will the audit property not tell the cluster-authentication-operator to enable audit logging on oauth-server?

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 know, it only influences login events, and also logs some login failures. Hence the WriteLoginEvents value that you can configure for the profile.

Copy link
Contributor

@ibihim ibihim Nov 9, 2021

Choose a reason for hiding this comment

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

But isn't the goal to turn the audit logging on and then add the logging of the other events too?

So there will be a certain moment in time, before we add more logging events to the oauth-server, where we will only log a very limited set of events. But once we adjusted oauth-server, it will log login, login failures and logout... oh noes... you are right. That is true. The logout events are logged by extending what is being logged on logout and not in particular by the profile. So we have different technical paths to solve the goal.

Thanks a lot for the insight and thorough review :D This enhancement helped me to gain so much more clarity on that topic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ibihim yes, logout events cannot be captured in oauth-server

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ibihim as described in this OEP, logout events are captured only via deletion of oauthaccesstokens, subject auf audit policy configuration in oauth-apiserver.


If the `audit` can't be set in the CR, support would need to file a bugzilla.
If there are no audit events for login, login failures or logout events, verify that the `audit` values is set in the `oauth` CR.
If the `audit` is set to `profile: "WriteLoginEvents"` and there are no audit events for the oauth-server after the login, login failure or logout events, support would need to file a bugzilla.
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto on the logout events

Copy link
Contributor

Choose a reason for hiding this comment

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

I am mentioning logout events:

or logout events

Copy link
Contributor

Choose a reason for hiding this comment

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

Or do you mean that I should remove the logout entry?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I got it.

profile: WriteLoginEvents
```

4. Create Login failures, Login and Logout events.
Copy link
Contributor

Choose a reason for hiding this comment

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

no logout events?

Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't I mention Logout events?

Copy link
Contributor

Choose a reason for hiding this comment

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

Created a dedicated entry for the logout events.


### Operational Aspects of API Extensions

There is no explicit operational involvement expected. The property is optional and set by default to log audit events.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: to log login events.


There is no explicit operational involvement expected. The property is optional and set by default to log audit events.

It could be turned off by a user by removing API extension.
Copy link
Contributor

Choose a reason for hiding this comment

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

That would actually default back to it being turned on.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think so? If there is no audit in OAuthSpec?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let me be more specific to set it to None, just in case we default, without a spec given.

```

4. Create Login failures and Login.
5. Execute `oc adm must-gather`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Whats wrong with must gather?

Copy link
Contributor

Choose a reason for hiding this comment

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

You're proposing to create a privileged container in the cluster to pull data from the cluster to get a tar that you need to process instead of doing a streamed API call

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, for automated things 👍 👍 😍


#### E2E testing steps

In order to test the audit logging as mentioned in the porposal:
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: s/porposal/proposal/

Co-authored-by: Krzysztof Ostrowski <kostrows@redhat.com>
@stlaz
Copy link
Contributor

stlaz commented Nov 9, 2021

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 9, 2021
@ibihim
Copy link
Contributor

ibihim commented Nov 9, 2021

/lgtm

@EmilyM1
Copy link
Contributor

EmilyM1 commented Nov 9, 2021

/lgtm

@mfojtik
Copy link
Contributor

mfojtik commented Nov 10, 2021

The design looks architecturally sound.

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 10, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mfojtik

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 10, 2021
@openshift-merge-robot openshift-merge-robot merged commit 48a4b9d into openshift:master Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants