Skip to content

Revert "add extra role to be able to create gcp vms"#2147

Merged
k8s-ci-robot merged 1 commit intokubernetes:mainfrom
ameukam:revert-2124
Jun 10, 2021
Merged

Revert "add extra role to be able to create gcp vms"#2147
k8s-ci-robot merged 1 commit intokubernetes:mainfrom
ameukam:revert-2124

Conversation

@ameukam
Copy link
Copy Markdown
Member

@ameukam ameukam commented Jun 7, 2021

Revert of #2124 which
introduces an exposure to privilege escalation.

Signed-off-by: Arnaud Meukam ameukam@gmail.com

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. wg/k8s-infra approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jun 7, 2021
@k8s-ci-robot k8s-ci-robot requested review from nikhita and spiffxp June 7, 2021 20:21
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 7, 2021
Copy link
Copy Markdown
Contributor

@spiffxp spiffxp left a comment

Choose a reason for hiding this comment

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

I would replace with ensure_removed_project_role_binding instead of deleting the line

And maybe try adding

ensure_serviceaccount_role_binding "${serviceaccount}" "serviceAccount:${serviceaccount}" "roles/iam.serviceAccountUser"

to see if my wild guess in #2124 (comment) is correct?

@ameukam
Copy link
Copy Markdown
Member Author

ameukam commented Jun 7, 2021

I would replace with ensure_removed_project_role_binding instead of deleting the line

And maybe try adding

ensure_serviceaccount_role_binding "${serviceaccount}" "serviceAccount:${serviceaccount}" "roles/iam.serviceAccountUser"

to see if my wild guess in #2124 (comment) is correct?

Running ensure-staging-storage.sh with this change.

Fix exposure to privilege escalation introduced in kubernetes#2124.

Signed-off-by: Arnaud Meukam <ameukam@gmail.com>
Copy link
Copy Markdown
Contributor

@spiffxp spiffxp left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm
/hold
To remove when ready to deploy

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Jun 10, 2021
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ameukam, spiffxp

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@spiffxp
Copy link
Copy Markdown
Contributor

spiffxp commented Jun 10, 2021

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 10, 2021
@k8s-ci-robot k8s-ci-robot merged commit b4f1725 into kubernetes:main Jun 10, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.22 milestone Jun 10, 2021
@cpanato
Copy link
Copy Markdown
Member

cpanato commented Jun 11, 2021

@spiffxp @ameukam after the changes applied the job start failing again but looks like it is another reason.
Looks like the instance is not coming up, and maybe it is not being created, maybe lacking permissions

I can edit the script to add the debug flag, so we can see why is failing

https://prow.k8s.io/view/gs/kubernetes-jenkins/logs/periodic-image-builder-gcp-all-nightly/1403250364064468992

@cpanato
Copy link
Copy Markdown
Member

cpanato commented Jun 30, 2021

@spiffxp @ameukam gently ping here

@spiffxp
Copy link
Copy Markdown
Contributor

spiffxp commented Jul 1, 2021

Pulling out of slack:

"serviceAccounts": [
    {
        "email": "default",
        "scopes": [
            "https://www.googleapis.com/auth/userinfo.email",
            "https://www.googleapis.com/auth/compute",
            "https://www.googleapis.com/auth/devstorage.full_control"
        ]
    }
]

@spiffxp
Copy link
Copy Markdown
Contributor

spiffxp commented Jul 1, 2021

To help with troubleshooting I'm going to temporarily enable all Audit Logs (Admin Activity and Data Access) for IAM and Compute, via the console at https://console.cloud.google.com/iam-admin/audit?folder=&organizationId=&project=k8s-staging-cluster-api-gcp

@cpanato
Copy link
Copy Markdown
Member

cpanato commented Jul 1, 2021

looking the audit logs, on 6/10/21

  • June 10, 2021 at 8:15:43 AM GMT+2 removed the Removed iam.serviceAccountUser, and after that job starts failing again

Screenshot 2021-07-01 at 09 22 27

@cpanato
Copy link
Copy Markdown
Member

cpanato commented Jul 1, 2021

If set both we got

Error: Failed to prepare build: "ubuntu-1804"

1 error(s) occurred:

* you may not specify a 'service_account_email' when
'disable_default_service_account' is true

I will set up only the service_account_email

PR in image-builder: kubernetes-sigs/image-builder#641

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants