-
Notifications
You must be signed in to change notification settings - Fork 1.9k
OSDOCS-17793#Reducing permissions for GCP #104792
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
lpettyjo marked this conversation as resolved.
Show resolved
Hide resolved
|
lpettyjo marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| // Module included in the following assemblies: | ||
| // | ||
| // * storage/container_storage_interface/persistent-storage-csi-gcp-pd.adoc | ||
|
|
||
| :_mod-docs-content-type: PROCEDURE | ||
| [id="persistent-storage-csi-gcp-pd-reduce-permissions_{context}"] | ||
| = Reducing permissions while using the GCP PD CSI Driver Operator | ||
|
|
||
| [role="_abstract"] | ||
lpettyjo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| You can reduce the scope of permissions granted to the main service account in your Google Cloud project while still being able to use the GCP PD CSI Driver Operator. | ||
lpettyjo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| To reduce permissions, remove the `iam.serviceAccountUser` field from the project-wide service account, and then grant it to the control plane and compute node service accounts instead, thus reducing the scope of the permission. | ||
|
|
||
| .Procedure | ||
|
|
||
| . Grant scoped `serviceAccountUser` role for node service accounts by running the following Bash script: | ||
| + | ||
| [source,terminal] | ||
| ---- | ||
| SA_USER_ROLE="roles/iam.serviceAccountUser" | ||
| logger "INFO" "Granting ${SA_USER_ROLE} for node service accounts: ${MASTER_NODE_SA}, ${WORKER_NODE_SA}" | ||
| CMD="gcloud iam service-accounts add-iam-policy-binding \"${MASTER_NODE_SA}\" --project=\"${GOOGLE_PROJECT_ID}\" --member=\"serviceAccount:${SERVICE_ACCOUNT_EMAIL}\" --role=\"${SA_USER_ROLE}\" --condition=None" | ||
| run_command "${CMD}" | ||
| CMD="gcloud iam service-accounts add-iam-policy-binding \"${WORKER_NODE_SA}\" --project=\"${GOOGLE_PROJECT_ID}\" --member=\"serviceAccount:${SERVICE_ACCOUNT_EMAIL}\" --role=\"${SA_USER_ROLE}\" --condition=None" | ||
| run_command "${CMD}" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We did not introduce
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not know. I got infor for this procedure from this script provided by @bscott-rh.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In turn, I found this script via @dobsonj 's comment on the storage epic: https://issues.redhat.com/browse/STOR-2531 |
||
| ---- | ||
| + | ||
| * `GOOGLE_PROJECT_ID`: The unique ID of your Google Cloud project. | ||
|
|
||
| * `SERVICE_ACCOUNT_EMAIL`: The email address of the "Member" (the person or service account) who is being granted the new permissions. | ||
|
|
||
| * `MASTER_NODE_SA`: The email address of the service account used by your cluster's master node. | ||
|
|
||
| * `WORKER_NODE_SA`: The email address of the service account used by your cluster's worker nodes. | ||
|
|
||
| . Remove project-level `serviceAccountUser` role from the binding created by the installation program by running the following Bash script: | ||
| + | ||
| [source,terminal] | ||
| ---- | ||
| logger "INFO" "Removing ${SA_USER_ROLE} from project-level binding for ${SERVICE_ACCOUNT_EMAIL}" | ||
| CMD="gcloud projects remove-iam-policy-binding \"${GOOGLE_PROJECT_ID}\" --member=\"serviceAccount:${SERVICE_ACCOUNT_EMAIL}\" --role=\"${SA_USER_ROLE}\" --condition=None" | ||
| backoff "${CMD}" | ||
| ---- | ||
| + | ||
| * `SA_USER_ROLE`: The specific permission being taken away. For example, `roles/iam.serviceAccountUser`. | ||
|
|
||
| * `SERVICE_ACCOUNT_EMAIL`: The email address of the account losing the permission. For example, `[email protected]`. | ||
|
|
||
| * `GOOGLE_PROJECT_ID`: The unique ID of the Google Cloud project where this is occurring. For example, `prod-data-789`. | ||
lpettyjo marked this conversation as resolved.
Show resolved
Hide resolved
|
Uh oh!
There was an error while loading. Please reload this page.