Skip to content

Commit

Permalink
remove audit-serviceaccount (chainguard-dev#465)
Browse files Browse the repository at this point in the history
this cleans up the `Abnormal Access Token Generation` alert policy
should remove ~200 alert policies in staging and ~150 in prod

Signed-off-by: Kenny Leung <kleung@chainguard.dev>
  • Loading branch information
k4leung4 authored Jul 25, 2024
1 parent 03789aa commit 518fa3c
Show file tree
Hide file tree
Showing 17 changed files with 3 additions and 253 deletions.
1 change: 0 additions & 1 deletion .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:
fail-fast: false
matrix:
module:
- audit-serviceaccount
- authorize-private-service
- bucket-events
- cloudevent-broker
Expand Down
73 changes: 0 additions & 73 deletions modules/audit-serviceaccount/README.md

This file was deleted.

41 changes: 0 additions & 41 deletions modules/audit-serviceaccount/main.tf

This file was deleted.

25 changes: 0 additions & 25 deletions modules/audit-serviceaccount/variables.tf

This file was deleted.

1 change: 0 additions & 1 deletion modules/bucket-events/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ No requirements.

| Name | Source | Version |
|------|--------|---------|
| <a name="module_audit-delivery-serviceaccount"></a> [audit-delivery-serviceaccount](#module\_audit-delivery-serviceaccount) | ../audit-serviceaccount | n/a |
| <a name="module_authorize-delivery"></a> [authorize-delivery](#module\_authorize-delivery) | ../authorize-private-service | n/a |
| <a name="module_http"></a> [http](#module\_http) | ../dashboard/sections/http | n/a |
| <a name="module_layout"></a> [layout](#module\_layout) | ../dashboard/sections/layout | n/a |
Expand Down
14 changes: 0 additions & 14 deletions modules/bucket-events/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,6 @@ resource "google_service_account_iam_binding" "allow-pubsub-to-mint-tokens" {
members = ["serviceAccount:${google_project_service_identity.pubsub.email}"]
}

module "audit-delivery-serviceaccount" {
source = "../audit-serviceaccount"

project_id = var.project_id
service-account = google_service_account.delivery.email

# The absence of authorized identities here means that
# nothing is authorized to act as this service account.
# Note: Cloud Pub/Sub's usage doesn't show up in the
# audit logs.

notification_channels = var.notification_channels
}

module "this" {
source = "../regional-go-service"
project_id = var.project_id
Expand Down
1 change: 0 additions & 1 deletion modules/cloudevent-recorder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ No requirements.

| Name | Source | Version |
|------|--------|---------|
| <a name="module_audit-import-serviceaccount"></a> [audit-import-serviceaccount](#module\_audit-import-serviceaccount) | ../audit-serviceaccount | n/a |
| <a name="module_recorder-dashboard"></a> [recorder-dashboard](#module\_recorder-dashboard) | ../dashboard/cloudevent-receiver | n/a |
| <a name="module_this"></a> [this](#module\_this) | ../regional-go-service | n/a |
| <a name="module_triggers"></a> [triggers](#module\_triggers) | ../cloudevent-trigger | n/a |
Expand Down
14 changes: 0 additions & 14 deletions modules/cloudevent-recorder/bigquery.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,6 @@ resource "google_service_account_iam_binding" "provisioner-acts-as-import-identi
members = [var.provisioner]
}

module "audit-import-serviceaccount" {
source = "../audit-serviceaccount"

project_id = var.project_id
service-account = google_service_account.import-identity.email

# The absence of authorized identities here means that
# nothing is authorized to act as this service account.
# Note: BigQuery DTS's usage doesn't show up in the
# audit logs.

notification_channels = var.notification_channels
}

// Create a BQ DTS job for each of the regions x types pulling from the appropriate buckets and paths.
resource "google_bigquery_data_transfer_config" "import-job" {
for_each = local.regional-types
Expand Down
1 change: 0 additions & 1 deletion modules/cloudevent-trigger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ No requirements.

| Name | Source | Version |
|------|--------|---------|
| <a name="module_audit-trigger-serviceaccount"></a> [audit-trigger-serviceaccount](#module\_audit-trigger-serviceaccount) | ../audit-serviceaccount | n/a |
| <a name="module_authorize-delivery"></a> [authorize-delivery](#module\_authorize-delivery) | ../authorize-private-service | n/a |

## Resources
Expand Down
14 changes: 0 additions & 14 deletions modules/cloudevent-trigger/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,6 @@ resource "google_service_account_iam_binding" "allow-pubsub-to-mint-tokens" {
members = ["serviceAccount:${google_project_service_identity.pubsub.email}"]
}

module "audit-trigger-serviceaccount" {
source = "../audit-serviceaccount"

project_id = var.project_id
service-account = google_service_account.this.email

# The absence of authorized identities here means that
# nothing is authorized to act as this service account.
# Note: Cloud Pub/Sub's usage doesn't show up in the
# audit logs.

notification_channels = var.notification_channels
}

// Authorize this service account to invoke the private service receiving
// events from this trigger.
module "authorize-delivery" {
Expand Down
5 changes: 1 addition & 4 deletions modules/cron/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@ No requirements.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_audit-cronjob-serviceaccount"></a> [audit-cronjob-serviceaccount](#module\_audit-cronjob-serviceaccount) | ../audit-serviceaccount | n/a |
| <a name="module_audit-delivery-serviceaccount"></a> [audit-delivery-serviceaccount](#module\_audit-delivery-serviceaccount) | ../audit-serviceaccount | n/a |
No modules.

## Resources

Expand Down
28 changes: 0 additions & 28 deletions modules/cron/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,6 @@ resource "google_project_service" "cloudscheduler" {
disable_on_destroy = false
}

module "audit-cronjob-serviceaccount" {
source = "../audit-serviceaccount"

project_id = var.project_id
service-account = var.service_account

# The absence of authorized identities here means that
# nothing is authorized to act as this service account.
# Note: Cloud Run's usage doesn't show up in the
# audit logs.

notification_channels = var.notification_channels
}

locals {
repo = var.repository != "" ? var.repository : "gcr.io/${var.project_id}/${var.name}"
}
Expand Down Expand Up @@ -180,20 +166,6 @@ resource "google_service_account" "delivery" {
display_name = "Dedicated service account for invoking ${google_cloud_run_v2_job.job.name}."
}

module "audit-delivery-serviceaccount" {
source = "../audit-serviceaccount"

project_id = var.project_id
service-account = google_service_account.delivery.email

# The absence of authorized identities here means that
# nothing is authorized to act as this service account.
# Note: Cloud Scheduler's usage doesn't show up in the
# audit logs.

notification_channels = var.notification_channels
}

resource "google_cloud_run_v2_job_iam_binding" "authorize-calls" {
project = google_cloud_run_v2_job.job.project
location = google_cloud_run_v2_job.job.location
Expand Down
4 changes: 1 addition & 3 deletions modules/github-gsa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ No requirements.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_audit-usage"></a> [audit-usage](#module\_audit-usage) | ../audit-serviceaccount | n/a |
No modules.

## Resources

Expand Down
12 changes: 0 additions & 12 deletions modules/github-gsa/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,3 @@ resource "google_service_account_iam_binding" "allow-impersonation" {
}
}
}

// Create an auditing policy to ensure that tokens are only issued for identities
// matching our expectations.
module "audit-usage" {
source = "../audit-serviceaccount"

project_id = var.project_id
service-account = google_service_account.this.email

allowed_principal_regex = local.principalSubject
notification_channels = var.notification_channels
}
5 changes: 0 additions & 5 deletions modules/regional-go-service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ terraform {
}
}

moved {
from = module.audit-serviceaccount
to = module.this.module.audit-serviceaccount
}

moved {
from = google_project_iam_member.metrics-writer
to = module.this.google_project_iam_member.metrics-writer
Expand Down
4 changes: 1 addition & 3 deletions modules/regional-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ No requirements.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_audit-serviceaccount"></a> [audit-serviceaccount](#module\_audit-serviceaccount) | ../audit-serviceaccount | n/a |
No modules.

## Resources

Expand Down
13 changes: 0 additions & 13 deletions modules/regional-service/main.tf
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
module "audit-serviceaccount" {
source = "../audit-serviceaccount"

project_id = var.project_id
service-account = var.service_account

# The absence of authorized identities here means that
# nothing is authorized to act as this service account.
# Note: Cloud Run's usage doesn't show up in the audit logs.

notification_channels = var.notification_channels
}

resource "google_project_iam_member" "metrics-writer" {
project = var.project_id
role = "roles/monitoring.metricWriter"
Expand Down

0 comments on commit 518fa3c

Please sign in to comment.