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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃尡 pkg/authorization: enable audit logging for SAR requests #2678

Merged
merged 1 commit into from
Jan 26, 2023

Conversation

s-urbaniak
Copy link
Contributor

@s-urbaniak s-urbaniak commented Jan 26, 2023

Summary

This PR:

  • adds domain annotation for audit logging: this allows separating regular workspace requests (request.auth.kcp.io domain) vs. SAR requests (sar.auth.kcp.io)
  • in case of SAR request: audit are created for the actual SAR authorization review and not for the create authorization request. This allows debugging why a SAR denies.
  • adds numbering of authorizers in audit logs so the ordering is clear
  • removes audit logging of delegation reasons for more concise audit log entries. Reasons of delegated authorizers can be inspected in the corresponding audit annotation of the delegated authorizer.

Audit example for a SAR request:

  "annotations": {
    "apiserver.latency.k8s.io/response-write": "3碌s",
    "apiserver.latency.k8s.io/serialize-response-object": "155.625碌s",
    "apiserver.latency.k8s.io/total": "48.648838125s",
    "apiserver.latency.k8s.io/transform-response-object": "9.709碌s",
    "authorization.k8s.io/decision": "allow",
    "authorization.k8s.io/reason": "access granted",
    "request.auth.kcp.io/01-requiredgroups-decision": "Allowed",
    "request.auth.kcp.io/01-requiredgroups-reason": "delegating due to logical cluster does not require groups",
    "request.auth.kcp.io/02-content-decision": "Allowed",
    "request.auth.kcp.io/02-content-reason": "delegating due to user logical cluster access",
    "request.auth.kcp.io/03-systemcrd-decision": "Allowed",
    "request.auth.kcp.io/03-systemcrd-reason": "delegating due to no system CRD violation",
    "request.auth.kcp.io/04-maxpermissionpolicy-decision": "Allowed",
    "request.auth.kcp.io/04-maxpermissionpolicy-reason": "05-local: access granted",
    "request.auth.kcp.io/05-bootstrap-decision": "NoOpinion",
    "request.auth.kcp.io/05-bootstrap-reason": "bootstrap policy: ",
    "request.auth.kcp.io/05-local-decision": "Allowed",
    "request.auth.kcp.io/05-local-reason": "local cluster \"2tgmp7irk229vwdu\" policy: RBAC: allowed by ClusterRoleBinding \"workspace-admin-fhvwv\" of ClusterRole \"cluster-admin\" to User \"user-1\"",
    "sar.auth.kcp.io/01-requiredgroups-decision": "Allowed",
    "sar.auth.kcp.io/01-requiredgroups-reason": "delegating due to logical cluster does not require groups",
    "sar.auth.kcp.io/02-content-decision": "Allowed",
    "sar.auth.kcp.io/02-content-reason": "delegating due to user logical cluster access",
    "sar.auth.kcp.io/03-systemcrd-decision": "Allowed",
    "sar.auth.kcp.io/03-systemcrd-reason": "delegating due to no system CRD violation",
    "sar.auth.kcp.io/04-maxpermissionpolicy-decision": "Allowed",
    "sar.auth.kcp.io/04-maxpermissionpolicy-reason": "05-local: access granted",
    "sar.auth.kcp.io/05-bootstrap-decision": "NoOpinion",
    "sar.auth.kcp.io/05-bootstrap-reason": "bootstrap policy: ",
    "sar.auth.kcp.io/05-local-decision": "Allowed",
    "sar.auth.kcp.io/05-local-reason": "local cluster \"2tgmp7irk229vwdu\" policy: RBAC: allowed by ClusterRoleBinding \"user-1-configmap-reader\" of ClusterRole \"configmap-reader\" to User \"user-1\"",
    "tenancy.kcp.io/workspace": "2tgmp7irk229vwdu"
  }

Related issue(s)

N/A

@s-urbaniak
Copy link
Contributor Author

/retest

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 26, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 26, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ncdc

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 Jan 26, 2023
@openshift-merge-robot openshift-merge-robot merged commit 82e6c75 into kcp-dev:main Jan 26, 2023
@s-urbaniak s-urbaniak deleted the sar-audit branch January 26, 2023 19:17
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.

None yet

4 participants