generated from redhat-developer/new-project-template
-
Notifications
You must be signed in to change notification settings - Fork 57
RHID-3976 Managing authorization by importing external files #704
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
4a4cd2f
RHID-3976 Managing authorization by importing external files
themr0c d8bf167
Update assemblies/assembly-configuring-authorization-in-rhdh.adoc
themr0c 70eccf5
Update assemblies/assembly-configuring-authorization-in-rhdh.adoc
themr0c ed6c152
Update assemblies/assembly-configuring-authorization-in-rhdh.adoc
themr0c 6d02b0f
Delete modules/authorization/con-permission-policy-and-role-source.adoc
themr0c a991288
Apply suggestions from code review
themr0c 60a91e3
Update modules/authorization/proc-defining-authorizations-in-external…
themr0c 60141f0
Update modules/authorization/proc-defining-authorizations-in-external…
themr0c 0e6e19b
Apply suggestions from code review
themr0c 7399b31
Update modules/authorization/proc-defining-authorizations-in-external…
themr0c 62052c2
Apply suggestions from code review
themr0c 0e110f8
Merge branch 'main' into RHIDP-3976
themr0c 93c616e
Merge branch 'main' into RHIDP-3976
themr0c 1d1e90a
Update modules/authorization/proc-defining-authorizations-in-external…
themr0c 820426c
Update modules/authorization/proc-defining-authorizations-in-external…
themr0c 3bfa659
Update modules/authorization/proc-defining-authorizations-in-external…
themr0c aebb384
Update modules/authorization/proc-defining-authorizations-in-external…
themr0c 5ad8c7d
Update modules/authorization/proc-defining-authorizations-in-external…
themr0c 168e7bd
Update modules/authorization/proc-defining-authorizations-in-external…
themr0c 48103fa
Merge branch 'main' into RHIDP-3976
themr0c 845c523
Merge branch 'main' into RHIDP-3976
themr0c File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
assemblies/assembly-managing-authorizations-by-using-external-files.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| [id='managing-authorizations-by-using-external-files'] | ||
| = Managing authorizations by using external files | ||
|
|
||
| To automate {product} maintenance, you can configure permissions and roles in external files, before starting {product-short}. | ||
|
|
||
|
|
||
| include::modules/authorization/proc-defining-authorizations-in-external-files-by-using-the-operator.adoc[leveloffset=+1] | ||
|
|
||
| include::modules/authorization/proc-defining-authorizations-in-external-files-by-using-helm.adoc[leveloffset=+1] | ||
|
|
2 changes: 1 addition & 1 deletion
2
assemblies/assembly-managing-authorizations-by-using-the-rhdh-web-ui.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 0 additions & 66 deletions
66
modules/authorization/con-rbac-config-permission-policies-external-file.adoc
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
modules/authorization/con-rbac-config-permission-policies.adoc
This file was deleted.
Oops, something went wrong.
105 changes: 105 additions & 0 deletions
105
...authorization/proc-defining-authorizations-in-external-files-by-using-helm.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| [id='defining-authorizations-in-external-files-by-using-helm'] | ||
| = Defining authorizations in external files by using Helm | ||
|
|
||
| To automate {product} maintenance, you can define permissions and roles in external files, before starting {product-short}. | ||
| You need to prepare your files, upload them to your {ocp-short} project, | ||
| and configure {product-short} to use the external files. | ||
|
|
||
| .Prerequisites | ||
| * xref:enabling-and-giving-access-to-rbac[You enabled the RBAC feature]. | ||
|
|
||
| .Procedure | ||
| . Define your policies in a `rbac-policies.csv` CSV file by using the following format: | ||
|
|
||
| .. Define role permissions: | ||
| + | ||
| [source,csv,subs="+quotes"] | ||
| ---- | ||
| p, _<role_entity_reference>_, _<permission>_, _<action>_, _<allow_or_deny>_ | ||
| ---- | ||
|
|
||
| _<role_entity_reference>_:: | ||
| Role entity reference, such as: `role:default/guest`. | ||
|
|
||
| _<permission>_:: | ||
| Permission, such as: `bulk.import`, `catalog.entity.read`, or `catalog.entity.refresg`, or permission resource type, such as: `bulk-import` or `catalog-entity`. | ||
| + | ||
| See: xref:ref-rbac-permission-policies_{context}[Permission policies reference]. | ||
| _<action>_:: | ||
| Action type, such as: `use`, `read`, `create`, `update`, `delete`. | ||
|
|
||
| _<allow_or_deny>_:: | ||
| Access granted: `allow` or `deny`. | ||
|
|
||
| .. Assign the role to a group or a user: | ||
| + | ||
| [source,csv,subs="+quotes"] | ||
| ---- | ||
| g, _<group_or_user>_, _<role_entity_reference>_ | ||
| ---- | ||
|
|
||
| _<group_or_user>_:: | ||
| Group, such as: `user:default/mygroup`, or user, such as: `user:default/myuser`. | ||
| + | ||
| .Sample `rbac-policies.csv` | ||
| [source,csv,subs="+quotes"] | ||
| ---- | ||
| p, role:default/guests, catalog-entity, read, allow | ||
| p, role:default/guests, catalog.entity.create, create, allow | ||
| g, user:default/my-user, role:default/guests | ||
| g, group:default/my-group, role:default/guests | ||
| ---- | ||
|
|
||
| . Define your conditional policies in a `rbac-conditional-policies.yaml` YAML file by using the following format: | ||
| + | ||
| [source,yaml,subs="+quotes"] | ||
| ---- | ||
| result: CONDITIONAL | ||
| roleEntityRef: _<role_entity_reference>_ | ||
| pluginId: _<plugin_id>_ | ||
| permissionMapping: | ||
| - read | ||
| - update | ||
| - delete | ||
| conditions: _<conditions>_ | ||
| ---- | ||
| + | ||
| See: xref:ref-rbac-conditional-policy-definition_{context}[Conditional policies reference]. | ||
|
|
||
| . Upload your `rbac-policies.csv` and `rbac-conditional-policies.yaml` files to a `rbac-policies` config maps in your {ocp-short} project containing {product-short}. | ||
themr0c marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| + | ||
| [source,terminal] | ||
| ---- | ||
| $ oc create configmap rbac-policies \ | ||
| --from-file=rbac-policies.csv \ | ||
| --from-file=rbac-conditional-policies.yaml | ||
| ---- | ||
|
|
||
| . Update your {product-short} `Backstage` Helm chart to mount in the {product-short} filesystem your files from the config maps: | ||
themr0c marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| .. In the {product-short} Helm Chart, go to *Root Schema -> Backstage chart schema -> Backstage parameters -> Backstage container additional volume mounts*. | ||
|
|
||
| .. Select *Add Backstage container additional volume mounts* and add the following values: | ||
|
|
||
| mountPath:: `opt/app-root/src` | ||
themr0c marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Name:: `rbac-policies` | ||
|
|
||
| .. Add the RBAC policy to the *Backstage container additional volumes* in the {product-short} Helm Chart: | ||
|
|
||
| name:: `rbac-policies` | ||
| configMap:: | ||
| defaultMode::: `420` | ||
| name::: `rbac-policies` | ||
|
|
||
| . Update your {product-short} `app-config.yaml` configuration file to use the external files in {product-short}: | ||
themr0c marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| + | ||
| .`app-config.yml` fragment | ||
| [source,yaml] | ||
| ---- | ||
| permission: | ||
| enabled: true | ||
| rbac: | ||
| conditionalPoliciesFile: ./rbac-conditional-policies.yaml | ||
| policies-csv-file: ./rbac-policies.csv | ||
themr0c marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| policyFileReload: true | ||
| ---- | ||
104 changes: 104 additions & 0 deletions
104
...ation/proc-defining-authorizations-in-external-files-by-using-the-operator.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| [id='defining-authorizations-in-external-files-by-using-the-operator'] | ||
| = Defining authorizations in external files by using the operator | ||
|
|
||
| To automate {product} maintenance, you can define permissions and roles in external files, before starting {product-short}. | ||
| You need to prepare your files, upload them to your {ocp-short} project, | ||
| and configure {product-short} to use the external files. | ||
|
|
||
| .Prerequisites | ||
| * xref:enabling-and-giving-access-to-rbac[You enabled the RBAC feature]. | ||
|
|
||
| .Procedure | ||
| . Define your policies in a `rbac-policies.csv` CSV file by using the following format: | ||
|
|
||
| .. Define role permissions: | ||
| + | ||
| [source,csv,subs="+quotes"] | ||
| ---- | ||
| p, _<role_entity_reference>_, _<permission>_, _<action>_, _<allow_or_deny>_ | ||
| ---- | ||
|
|
||
| _<role_entity_reference>_:: | ||
| Role entity reference, such as: `role:default/guest`. | ||
|
|
||
| _<permission>_:: | ||
| Permission, such as: `bulk.import`, `catalog.entity.read`, or `catalog.entity.refresg`, or permission resource type, such as: `bulk-import` or `catalog-entity`. | ||
themr0c marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| + | ||
| See: xref:ref-rbac-permission-policies_{context}[Permission policies reference]. | ||
| _<action>_:: | ||
| Action type, such as: `use`, `read`, `create`, `update`, `delete`. | ||
|
|
||
| _<allow_or_deny>_:: | ||
| Access granted: `allow` or `deny`. | ||
|
|
||
| .. Assign the role to a group or a user: | ||
| + | ||
| [source,csv,subs="+quotes"] | ||
| ---- | ||
| g, _<group_or_user>_, _<role_entity_reference>_ | ||
| ---- | ||
|
|
||
| _<group_or_user>_:: | ||
| Group, such as: `user:default/mygroup`, or user, such as: `user:default/myuser`. | ||
| + | ||
| .Sample `rbac-policies.csv` | ||
| [source,csv,subs="+quotes"] | ||
| ---- | ||
| p, role:default/guests, catalog-entity, read, allow | ||
| p, role:default/guests, catalog.entity.create, create, allow | ||
| g, user:default/my-user, role:default/guests | ||
| g, group:default/my-group, role:default/guests | ||
| ---- | ||
|
|
||
| . Define your conditional policies in a `rbac-conditional-policies.yaml` YAML file by using the following format: | ||
| + | ||
| [source,yaml,subs="+quotes"] | ||
| ---- | ||
| result: CONDITIONAL | ||
| roleEntityRef: _<role_entity_reference>_ | ||
| pluginId: _<plugin_id>_ | ||
| permissionMapping: | ||
| - read | ||
| - update | ||
| - delete | ||
| conditions: _<conditions>_ | ||
| ---- | ||
| + | ||
| See: xref:ref-rbac-conditional-policy-definition_{context}[Conditional policies reference]. | ||
|
|
||
| . Upload your `rbac-policies.csv` and `rbac-conditional-policies.yaml` files to a `rbac-policies` config maps in your {ocp-short} project containing {product-short}. | ||
themr0c marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| + | ||
| [source,terminal] | ||
| ---- | ||
| $ oc create configmap rbac-policies \ | ||
| --from-file=rbac-policies.csv \ | ||
| --from-file=rbac-conditional-policies.yaml | ||
| ---- | ||
|
|
||
| . Update your {product-short} `Backstage` custom resource to mount in the {product-short} filesystem your files from the config maps: | ||
themr0c marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| + | ||
| .`Backstage` Custom resource fragment | ||
| [source,yaml] | ||
| ---- | ||
| apiVersion: rhdh.redhat.com/v1alpha1 | ||
| kind: Backstage | ||
| spec: | ||
| application: | ||
| extraFiles: | ||
| configMaps: | ||
| - name: rbac-policies | ||
themr0c marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: rbac-conditional-policies | ||
themr0c marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ---- | ||
|
|
||
| . Update your {product-short} `app-config.yaml` configuration file to use the external files in {product-short}: | ||
themr0c marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| + | ||
| .`app-config.yml` fragment | ||
| [source,yaml] | ||
| ---- | ||
| permission: | ||
| enabled: true | ||
| rbac: | ||
| conditionalPoliciesFile: ./rbac-conditional-policies.yaml | ||
themr0c marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| policies-csv-file: ./rbac-policies.csv | ||
themr0c marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| policyFileReload: true | ||
| ---- | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.