Skip to content

Commit fa6d160

Browse files
authored
[JN-1644] virus scanning infrastructure (#1547)
1 parent b000255 commit fa6d160

13 files changed

+505
-84
lines changed

terraform/gcp/.terraform.lock.hcl

+72-52
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

terraform/gcp/apis.tf

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ locals {
1313
"servicenetworking.googleapis.com",
1414
"cloudkms.googleapis.com",
1515
"binaryauthorization.googleapis.com",
16-
"cloudbuild.googleapis.com"
16+
"cloudbuild.googleapis.com",
17+
"run.googleapis.com",
18+
"cloudscheduler.googleapis.com",
19+
"eventarc.googleapis.com"
1720
]
1821
}
1922

terraform/gcp/buckets.tf

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
resource "google_storage_bucket" "unscanned_participant_documents" {
2+
name = "${var.documents_bucket_name}-unscanned"
3+
location = var.region
4+
# no public access allowed
5+
public_access_prevention = "enforced"
6+
7+
# only allow access if you have iam perms
8+
uniform_bucket_level_access = true
9+
versioning {
10+
enabled = true
11+
}
12+
}
13+
14+
resource "google_storage_bucket" "clean_participant_documents" {
15+
name = "${var.documents_bucket_name}-clean"
16+
location = var.region
17+
# no public access allowed
18+
public_access_prevention = "enforced"
19+
20+
# only allow access if you have iam perms
21+
uniform_bucket_level_access = true
22+
versioning {
23+
enabled = true
24+
}
25+
}
26+
27+
resource "google_storage_bucket" "quarantined_participant_documents" {
28+
name = "${var.documents_bucket_name}-quarantined"
29+
location = var.region
30+
# no public access allowed
31+
public_access_prevention = "enforced"
32+
33+
# only allow access if you have iam perms
34+
uniform_bucket_level_access = true
35+
versioning {
36+
enabled = true
37+
}
38+
}
39+
40+
resource "google_storage_bucket" "cvd_mirror_bucket" {
41+
name = "${var.documents_bucket_name}-cvd-mirror"
42+
location = var.region
43+
# no public access allowed
44+
public_access_prevention = "enforced"
45+
46+
# only allow access if you have iam perms
47+
uniform_bucket_level_access = true
48+
versioning {
49+
enabled = true
50+
}
51+
}

terraform/gcp/cluster_service_account.tf

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ resource "google_project_iam_binding" "cluster-metric-writer" {
88
project = var.project
99
role = "roles/monitoring.metricWriter"
1010
members = [
11-
"serviceAccount:${google_service_account.cluster_service_account.email}"
11+
"serviceAccount:${google_service_account.cluster_service_account.email}",
12+
"serviceAccount:${google_service_account.malware_scanner_sa.email}"
1213
]
1314
}
1415

@@ -25,7 +26,8 @@ resource "google_project_iam_binding" "cluster-log-writer" {
2526
role = "roles/logging.logWriter"
2627
members = [
2728
"serviceAccount:${google_service_account.cluster_service_account.email}",
28-
"serviceAccount:${google_service_account.juniper_cloudbuild_service_account.email}"
29+
"serviceAccount:${google_service_account.juniper_cloudbuild_service_account.email}",
30+
"serviceAccount:${google_service_account.build_service_account.email}"
2931
]
3032
}
3133

terraform/gcp/envs/dev.tfvars

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ environment = "dev"
99
portals = ["demo", "atcp", "ourhealth", "hearthive", "rgp", "cmi"]
1010
k8s_namespace = "juniper-dev"
1111

12+
malware_scanner_image_name = "juniper-malware-scanner"
13+
documents_bucket_name = "juniper-participant-documents-dev"
14+
1215
# creates DNS records for these customer URLs
1316
customer_urls = {
1417
demo = {
@@ -19,3 +22,4 @@ customer_urls = {
1922
}
2023

2124
slack_notification_channel = "projects/broad-juniper-dev/notificationChannels/13069356383599666729"
25+

terraform/gcp/envs/prod.tfvars

+3
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,6 @@ customer_urls = {
105105
}
106106

107107
slack_notification_channel = "projects/broad-juniper-prod/notificationChannels/9072110396476167224"
108+
109+
malware_scanner_image_name = "juniper-malware-scanner"
110+
documents_bucket_name = "juniper-participant-documents-prod"

terraform/gcp/k8s/environments/dev.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ deploymentZone: dev
55
replicas: 1
66
dsmUrl: https://dsm-dev.datadonationplatform.org/dsm
77
dsmIssuer: admin-d2p.ddp-dev.envs.broadinstitute.org
8-
gcsFileStorageBucketName: juniper-participant-documents-dev
98
# "portals" adds certificates for each portal - both for the juniper-cmi.dev subdomains and the custom domain
109
portals:
1110
- name: demo

terraform/gcp/k8s/environments/prod.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ deploymentZone: prod
55
replicas: 3
66
dsmUrl: https://dsm.datadonationplatform.org/dsm
77
dsmIssuer: juniper.terra.bio
8-
gcsFileStorageBucketName: juniper-participant-documents-prod
98
# "portals" adds certificates for each portal - both for the admin subdomains and the custom domain
109
portals:
1110
- name: demo
@@ -57,3 +56,7 @@ b2c:
5756
clientId: 882e287c-8586-456e-8004-b7ff16da3578
5857
policyName: B2C_1A_ddp_participant_signup_signin_trcc-prod
5958
changePasswordPolicyName: B2C_1A_ddp_participant_signup_signin_trcc-prod
59+
gcsFileStorageBuckets:
60+
unscanned: juniper-participant-documents-prod-unscanned
61+
clean: juniper-participant-documents-prod-clean
62+
quarantined: juniper-participant-documents-prod-quarantined

terraform/gcp/variables.tf

+37
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,40 @@ variable "slack_notification_channel" {
9393
default = ""
9494
description = "Slack notification channel"
9595
}
96+
97+
variable "documents_bucket_name" {
98+
type = string
99+
description = "The name of the GCP bucket for storing participant documents"
100+
}
101+
102+
variable "artifact_registry" {
103+
type = string
104+
default = "juniper"
105+
}
106+
107+
variable "artifact_registry_project" {
108+
type = string
109+
default = "broad-juniper-eng-infra"
110+
}
111+
112+
variable "artifact_registry_location" {
113+
type = string
114+
default = "us-central1"
115+
}
116+
117+
118+
# build image from https://github.com/GoogleCloudPlatform/docker-clamav-malware-scanner/tree/main/cloudrun-malware-scanner
119+
# steps:
120+
# cd cloudrun-malware-scanner
121+
# docker build --tag=us-central1-docker.pkg.dev/broad-juniper-eng-infra/juniper/juniper-malware-scanner:latest -f Dockerfile . --platform linux/amd64
122+
# docker push us-central1-docker.pkg.dev/broad-juniper-eng-infra/juniper/juniper-malware-scanner:latest
123+
124+
# if standing up for first time, you might also need to update the cvd mirror
125+
# before deploying. run:
126+
# pip3 install crcmod cvdupdate
127+
# ./updateCvdMirror.sh <cvd_mirror_bucket_name>
128+
# from https://github.com/GoogleCloudPlatform/docker-clamav-malware-scanner
129+
130+
variable "malware_scanner_image_name" {
131+
type = string
132+
}

0 commit comments

Comments
 (0)