File tree Expand file tree Collapse file tree 1 file changed +44
-28
lines changed
infra/gcp/terraform/modules/oci-proxy Expand file tree Collapse file tree 1 file changed +44
-28
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,50 @@ resource "google_compute_security_policy" "cloud-armor" {
21
21
project = var. project_id
22
22
name = " security-policy-oci-proxy"
23
23
24
+ # apply rate limits
25
+ rule {
26
+ action = " throttle"
27
+ description = " Default rule, throttle traffic"
28
+ priority = " 2147483647"
29
+
30
+ match {
31
+ config {
32
+ src_ip_ranges = [" *" ]
33
+ }
34
+ versioned_expr = " SRC_IPS_V1"
35
+ }
36
+
37
+ rate_limit_options {
38
+ conform_action = " allow"
39
+ exceed_action = " deny(429)"
40
+
41
+ enforce_on_key = " IP"
42
+ # This is comparable to the GCR limits from k8s.gcr.io
43
+ rate_limit_threshold {
44
+ count = 5000
45
+ interval_sec = 60
46
+ }
47
+ }
48
+
49
+ preview = false
50
+ }
51
+
52
+ // block all requests with obviously invalid paths at the edge
53
+ // we support "/", "/privacy", and "/v2/.*" API
54
+
55
+ rule {
56
+ action = " deny(404)"
57
+ priority = " 2147483646"
58
+ match {
59
+ expr {
60
+ expression = " !request.path.match('(?:^/$)|(?:^/privacy$)|(?:^/v2/)')"
61
+ }
62
+ }
63
+ }
64
+
65
+
66
+ # TODO: remove these other rules?
67
+
24
68
25
69
rule {
26
70
action = " deny(403)"
@@ -150,33 +194,5 @@ resource "google_compute_security_policy" "cloud-armor" {
150
194
151
195
preview = false
152
196
}
153
-
154
- # Permit all other traffic, with rate limits
155
- rule {
156
- action = " throttle"
157
- description = " Default rule, throttle traffic"
158
- priority = " 2147483647"
159
-
160
- match {
161
- config {
162
- src_ip_ranges = [" *" ]
163
- }
164
- versioned_expr = " SRC_IPS_V1"
165
- }
166
-
167
- rate_limit_options {
168
- conform_action = " allow"
169
- exceed_action = " deny(429)"
170
-
171
- enforce_on_key = " IP"
172
- # This is comparable to the GCR limits from k8s.gcr.io
173
- rate_limit_threshold {
174
- count = 5000
175
- interval_sec = 60
176
- }
177
- }
178
-
179
- preview = false
180
- }
181
197
}
182
198
You can’t perform that action at this time.
0 commit comments