Skip to content

Commit 1356aeb

Browse files
authored
Merge pull request #6979 from BenTheElder/allow
oci-proxy: add default rule, improve path regex
2 parents 87cb853 + 204224e commit 1356aeb

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

infra/gcp/terraform/modules/oci-proxy/cloud-armor.tf

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,31 @@ resource "google_compute_security_policy" "cloud-armor" {
6969
priority = "1"
7070
match {
7171
expr {
72-
expression = "!request.path.matches('(?:^/$)|(?:^/privacy$)|(?:^/v2/)')"
72+
# allow:
73+
# our homepage info redirect: /
74+
# our privacy info redirect: /privacy
75+
# OCI ping: /v2
76+
# OCI pull / list calls: /v2/<name>/(blobs|manifests|tags)/<reference>
77+
# https://github.com/opencontainers/distribution-spec/blob/main/spec.md#endpoints
78+
# NOTE: AR doesn't support referrers API
79+
expression = "!request.path.matches('(?:^/?$)|(?:^/privacy$)|(?:^/v2/?$)|(?:^/v2/.+/(:?blobs|manifests|tags)/.+$)')"
7380
}
7481
}
7582
}
83+
84+
# you must have a default rule with max int32 priority
85+
# (IE applied last after every other rule)
86+
# this just allows traffic not caught by any other rule
87+
rule {
88+
action = "allow"
89+
priority = "2147483647"
90+
match {
91+
versioned_expr = "SRC_IPS_V1"
92+
config {
93+
src_ip_ranges = ["*"]
94+
}
95+
}
96+
description = "default rule"
97+
}
7698
}
7799

0 commit comments

Comments
 (0)