{"id":15747569,"url":"https://github.com/developer-guy/google-cloud-function-stdout-falco-alert","last_synced_at":"2025-03-31T06:41:13.490Z","repository":{"id":104876882,"uuid":"372057123","full_name":"developer-guy/google-cloud-function-stdout-falco-alert","owner":"developer-guy","description":null,"archived":false,"fork":false,"pushed_at":"2021-06-04T18:26:26.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-06T11:19:54.992Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/developer-guy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-29T19:42:03.000Z","updated_at":"2021-06-04T18:26:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"9ab4f149-a712-4690-8752-88034fe60d2e","html_url":"https://github.com/developer-guy/google-cloud-function-stdout-falco-alert","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer-guy%2Fgoogle-cloud-function-stdout-falco-alert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer-guy%2Fgoogle-cloud-function-stdout-falco-alert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer-guy%2Fgoogle-cloud-function-stdout-falco-alert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer-guy%2Fgoogle-cloud-function-stdout-falco-alert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/developer-guy","download_url":"https://codeload.github.com/developer-guy/google-cloud-function-stdout-falco-alert/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246429449,"owners_count":20775805,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-04T05:20:56.196Z","updated_at":"2025-03-31T06:41:13.469Z","avatar_url":"https://github.com/developer-guy.png","language":"Go","readme":"# google-cloud-function-stdout-falco-alert\n\n### Prerequisites\n\n* gcloud 342.0.0\n\n### Tutorial\n\nTo test workloadidentity first create a GKE cluster with workloadidentity enabled\n\n```bash\n$ GOOGLE_PROJECT_ID=$(gcloud config get-value project)\n$ CLUSTER_NAME=demo\n$ gcloud container clusters create $CLUSTER_NAME \\\n                   --workload-pool ${GOOGLE_PROJECT_ID}.svc.id.goog\n```\n\nLet's deploy the Google Cloud Functions first, because in the later steps, we'll need the name of the function.\n\n```bash\n$ git clone https://github.com/developer-guy/google-cloud-function-stdout-falco-alert\n$ cd google-cloud-function-stdout-falco-alert\n$ gcloud functions deploy HelloWorld --runtime go113 --trigger-http\nAllow unauthenticated invocations of new function [HelloWorld]? (y/N)? N\n...\n```\n\nGet the name of the function\n```bash\n$ CLOUD_FUNCTION_NAME=$(gcloud functions describe --format=json HelloWorld | jq -r '.name')\n```\n\nOnce it's created, lets install `Falco`, and `Falcosidekick` with enabled `Google Cloud Functions` output type. In order to do that, \nwe should clone the `developer-guy/charts1`, and deploy the `Falco` and `Falcosidekick` through this chart.\n Because the upstream Chart repository of the `Falcosecurity` does not involve the latest upgrades yet.\n\n\u003e Don't forget to change [Chart.yaml](https://github.com/developer-guy/charts-1/blob/master/falco/Chart.yaml#L24) with the location of your working directory.\n\n```bash\n$ git clone https://github.com/developer-guy/charts-1\n$ cd charts-1\n$ helm dependency update falco\n$ helm upgrade --install falco falco \\\n--namespace falco --create-namespace \\\n--set ebpf.enabled=true \\\n--set falcosidekick.enabled=true \\\n--set falcosidekick.config.gcp.cloudfunctions.name=${CLOUD_FUNCTION_NAME} \\\n--set falcosidekick.webui.enabled=true \\\n--set falcosidekick.image.repository=falcosecurity/falcosidekick \\\n--set falcosidekick.image.tag=latest\n```\n\nFinally set up the your SA and Rolebindings\n```bash\n$ SA_ACCOUNT=falco-falcosidekick-sa\n$ gcloud iam service-accounts create $SA_ACCOUNT\n\n$ gcloud projects add-iam-policy-binding ${GOOGLE_PROJECT_ID} \\\n--member=\"serviceAccount:${SA_ACCOUNT}@${GOOGLE_PROJECT_ID}.iam.gserviceaccount.com\" \\\n--role=\"roles/cloudfunctions.developer\"\n\n$ gcloud projects add-iam-policy-binding ${GOOGLE_PROJECT_ID} \\\n--member=\"serviceAccount:${SA_ACCOUNT}@${GOOGLE_PROJECT_ID}.iam.gserviceaccount.com\" \\\n--role=\"roles/cloudfunctions.invoker\"\n\n$ gcloud iam service-accounts add-iam-policy-binding \\\n  --role roles/iam.workloadIdentityUser \\\n  --member \"serviceAccount:${GOOGLE_PROJECT_ID}.svc.id.goog[falco/falco-falcosidekick]\" \\\n  ${SA_ACCOUNT}@${GOOGLE_PROJECT_ID}.iam.gserviceaccount.com\n```\n\nFinally set up the Falcosidekick SA to impersonate a GCP SA\n```bash\n$ kubectl annotate serviceaccount \\\n  --namespace falco \\\n  falco-falcosidekick \\\n  iam.gke.io/gcp-service-account=${SA_ACCOUNT}@${GOOGLE_PROJECT_ID}.iam.gserviceaccount.com\n```\n\n### Test\n\nCreate an alpine pod first, then try to exec into it.\n\n```bash\n$ kubectl run alpine  --image=alpine --restart='Never' -- sh -c \"sleep 600\"\n```\n\nExec into it.\n```bash\n$ kubectl exec -i --tty alpine -- sh -c \"uptime\" \n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloper-guy%2Fgoogle-cloud-function-stdout-falco-alert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeveloper-guy%2Fgoogle-cloud-function-stdout-falco-alert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloper-guy%2Fgoogle-cloud-function-stdout-falco-alert/lists"}