Skip to content

AGENT-997: Internal dev docs for authentication-authorization #9224

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

Conversation

pawanpinjarkar
Copy link
Contributor

@pawanpinjarkar pawanpinjarkar commented Nov 20, 2024

No description provided.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Nov 20, 2024
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Nov 20, 2024

@pawanpinjarkar: This pull request references AGENT-997 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.18.0" version, but no target version was set.

In response to this:

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from rwsu and zaneb November 20, 2024 14:59
@pawanpinjarkar
Copy link
Contributor Author

/cc @andfasano @rwsu

@openshift-ci openshift-ci bot requested a review from andfasano November 20, 2024 15:02
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Nov 20, 2024

@pawanpinjarkar: This pull request references AGENT-997 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.18.0" version, but no target version was set.

In response to this:

Preview here

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 openshift-eng/jira-lifecycle-plugin repository.

Copy link
Contributor

@andfasano andfasano left a comment

Choose a reason for hiding this comment

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

Thanks @pawanpinjarkar for this doc, it will definitely help.
Apart the suggested changes it looks fine, but for a relevant point: the document jumps immediately in a pretty detailed/technical description, without providing to the reader a more gentle and high-level overview of how it works (and that could help understanding better the subsequent more detailed section).

For that it'd be useful to provide a couple of diagrams (mermaid could be a good fit for that) describing at a very high level how the tokens are generated / consumed (aka verified) for both day1 and day2 cases.

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Dec 3, 2024

@pawanpinjarkar: This pull request references AGENT-997 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.19.0" version, but no target version was set.

In response to this:

Preview here

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Dec 4, 2024

@pawanpinjarkar: This pull request references AGENT-997 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.19.0" version, but no target version was set.

In response to this:

Preview here

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Dec 9, 2024

@pawanpinjarkar: This pull request references AGENT-997 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.19.0" version, but no target version was set.

In response to this:

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 openshift-eng/jira-lifecycle-plugin repository.

@pawanpinjarkar pawanpinjarkar force-pushed the dev-docs-authentication-authorization branch from c408842 to 5e0fbc6 Compare December 9, 2024 21:20

## Tokens for Agent-Based Installer

When creating an Agent ISO (or PXE artifacts) for installing a new cluster, ABI generates three separate authentication tokens: `agentAuth`, `userAuth`, and `watcherAuth`. These tokens serve different purposes and have varying levels of access. The tokens are the part of the ignition that gets embeded in the CoreOS base ISO along with other ABI specific configurations for a cluster. The tokens are stored `/usr/local/share/assisted-service/assisted-service.env` in the ISO. The base64 encoded public key required to validate these tokens is also saved in the same file. Additionally, this data also gets stored in a hidden file `.openshift_state_install.json` present in the directory location mentioned when creating ISO.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
When creating an Agent ISO (or PXE artifacts) for installing a new cluster, ABI generates three separate authentication tokens: `agentAuth`, `userAuth`, and `watcherAuth`. These tokens serve different purposes and have varying levels of access. The tokens are the part of the ignition that gets embeded in the CoreOS base ISO along with other ABI specific configurations for a cluster. The tokens are stored `/usr/local/share/assisted-service/assisted-service.env` in the ISO. The base64 encoded public key required to validate these tokens is also saved in the same file. Additionally, this data also gets stored in a hidden file `.openshift_state_install.json` present in the directory location mentioned when creating ISO.
When creating an Agent ISO (or PXE artifacts) for installing a new cluster, ABI generates three separate authentication tokens: `agentAuth`, `userAuth`, and `watcherAuth`. These tokens serve different purposes and have varying levels of access. The tokens are the part of the ignition that gets embeded in the CoreOS base ISO along with other ABI specific configurations for a cluster. The tokens are stored in `/usr/local/share/assisted-service/assisted-service.env` in the ISO. The base64 encoded public key required to validate these tokens is also saved in the same file. Additionally, this data also gets stored in a hidden file `.openshift_state_install.json` present in the directory location mentioned when creating ISO.

Why is it stored in the hidden file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tokens are part of the ignition and is also an asset hence those are saved in the hidden file .openshift_state_install.json like all the assets and other data.

- installer
security:
- userAuth: [admin, read-only-admin, user]
- watcherAuth: []
Copy link
Contributor

Choose a reason for hiding this comment

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

For watcherAuth, what does an empty array ([]) mean? Shouldn't there be something like read-only listed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The empty array under watcherAuth indicates that no specific roles are required—this is intentional and specific to the ABI flow. Unlike the roles mentioned for userAuth, which is tied to RHSSO auth type and uses IAM roles like admin, user, etc., ABI doesn’t use IAM policies. Instead, access control is based on the endpoint behavior itself.

For example, the watcherAuth persona (like the wait-for user) is only allowed to perform safe read-only actions like GET, while userAuth might have both GET and POST access, implying read-write. So the roles aren't declared because ABI evaluates access by persona and method, not by static role mapping.


1. The `auth_scheme` claim in the JWT token is extracted.
2. If the claim is malformed or missing, an error is returned.
3. The `auth_scheme` claim embedded in the token specifies the type of authorization (e.g., `watcherAuth`) and is compared with the `authScheme` expected by the endpoint. This ensures that the token matches the intended purpose of the request.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is /v2/clusters above the only endpoint that supports watcherAuth?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

openshift-ci bot commented Mar 24, 2025

@pawanpinjarkar: The following tests 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/e2e-vsphere-ovn-upi 5e0fbc6 link true /test e2e-vsphere-ovn-upi
ci/prow/e2e-metal-ipi-ovn-ipv6 5e0fbc6 link true /test e2e-metal-ipi-ovn-ipv6
ci/prow/e2e-vsphere-ovn 5e0fbc6 link true /test e2e-vsphere-ovn
ci/prow/govet 5e0fbc6 link true /test govet
ci/prow/e2e-aws-ovn 5e0fbc6 link true /test e2e-aws-ovn
ci/prow/aro-unit 5e0fbc6 link true /test aro-unit
ci/prow/e2e-gcp-ovn-upi 5e0fbc6 link true /test e2e-gcp-ovn-upi
ci/prow/e2e-vsphere-static-ovn 1d624e7 link false /test e2e-vsphere-static-ovn
ci/prow/e2e-vsphere-host-groups-ovn-custom-no-upgrade 1d624e7 link false /test e2e-vsphere-host-groups-ovn-custom-no-upgrade

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-sigs/prow repository. I understand the commands that are listed here.

@pawanpinjarkar pawanpinjarkar force-pushed the dev-docs-authentication-authorization branch from 1d624e7 to 395c8c2 Compare April 23, 2025 21:08
@pawanpinjarkar pawanpinjarkar requested a review from rwsu April 23, 2025 21:10
@bfournie
Copy link
Contributor

/approve

Copy link
Contributor

openshift-ci bot commented Apr 25, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bfournie

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 Apr 25, 2025
@andfasano
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 6, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit fdc62fc into openshift:main Jun 6, 2025
7 checks passed
@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

Distgit: ose-installer
This PR has been included in build ose-installer-container-v4.20.0-202506061711.p0.gfdc62fc.assembly.stream.el9.
All builds following this will include this PR.

@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

Distgit: ose-baremetal-installer
This PR has been included in build ose-baremetal-installer-container-v4.20.0-202506061711.p0.gfdc62fc.assembly.stream.el9.
All builds following this will include this PR.

@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

Distgit: ose-installer-artifacts
This PR has been included in build ose-installer-artifacts-container-v4.20.0-202506061711.p0.gfdc62fc.assembly.stream.el9.
All builds following this will include this PR.

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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants