-
Notifications
You must be signed in to change notification settings - Fork 30
/
main.tf
444 lines (400 loc) · 12.3 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
terraform {
required_providers {
sigsci = {
source = "signalsciences/sigsci"
}
}
}
// To build locally:
// make && cp terraform-provider-sigsci ~/.terraform.d/plugins/signalsciences/local/sigsci/1.2.1/darwin_amd64/terraform-provider-sigsci && rm .terraform.lock.hcl && tf init
provider "sigsci" {
// corp = "" // Required. may also provide via env variable SIGSCI_CORP
// email = "" // Required. may also provide via env variable SIGSCI_EMAIL
// auth_token = "" //may also provide via env variable SIGSCI_TOKEN
// password = "" //may also provide via env variable SIGSCI_PASSWORD
// fastly_api_key = "" //may also provide via env variable FASTLY_API_KEY. Required for Edge Deployments functionality.
}
############# Corp Level Resources #############
resource "sigsci_site" "my-site" {
short_name = "manual_test"
display_name = "manual terraform test"
block_duration_seconds = 86400
agent_anon_mode = ""
agent_level = "block"
immediate_block = false
attack_threshold {
interval = 1
threshold = 25
}
attack_threshold {
interval = 10
threshold = 150
}
attack_threshold {
interval = 60
threshold = 900
}
}
resource "sigsci_corp_list" "test" {
name = "My corp list"
type = "ip"
description = "Some IPs"
entries = [
"4.5.6.7",
"2.3.4.5",
"1.2.3.4",
]
}
resource "sigsci_corp_rule" "test" {
site_short_names = [sigsci_site.my-site.short_name]
type = "signal"
corp_scope = "specificSites"
enabled = true
group_operator = "any"
signal = "SQLI"
reason = "Example corp rule"
expiration = ""
conditions {
type = "single"
field = "ip"
operator = "equals"
value = "1.2.3.4"
}
conditions {
type = "single"
field = "ip"
operator = "equals"
value = "1.2.3.5"
}
actions {
type = "excludeSignal"
}
}
resource "sigsci_corp_signal_tag" "test" {
short_name = "example-signal-tag"
description = "An example of a custom signal tag"
}
resource "sigsci_corp_integration" "test_corp_integration" {
type = "slack"
url = "https://wat.slack.com"
events = ["newSite", "enableSSO"]
}
############# Site Level Resources #############
resource "sigsci_site_list" "test_list" {
site_short_name = sigsci_site.my-site.short_name
name = "My new list 2"
type = "ip"
description = "Some IPs we are putting in a list"
entries = [
"4.5.6.7",
"2.3.4.5",
"1.2.3.4",
]
}
resource "sigsci_site_signal_tag" "test_tag" {
site_short_name = sigsci_site.my-site.short_name
name = "My new signal tag"
description = "description"
}
resource "sigsci_site_signal_tag" "test" {
site_short_name = sigsci_site.my-site.short_name
name = "test"
description = "test 2"
}
resource "sigsci_site_alert" "test_site_alert" {
site_short_name = sigsci_site.my-site.short_name
tag_name = sigsci_site_signal_tag.test_tag.id
long_name = "test_alert"
interval = 10
threshold = 12
enabled = true
action = "info"
block_duration_seconds = 86400
}
resource "sigsci_site_templated_rule" "test_template_rule" {
site_short_name = sigsci_site.my-site.short_name
name = "AWS-SSRF"
detections {
enabled = "true"
}
alerts {
long_name = ""
interval = 0
threshold = 0
skip_notifications = false
enabled = true
action = "blockImmediate"
block_duration_seconds = 54321
}
alerts {
long_name = "AWS-SSRF-10-in-1"
interval = 10
threshold = 1
skip_notifications = false
enabled = true
action = "info"
block_duration_seconds = 54321
}
alerts {
long_name = "AWS-SSRF-11-in-60"
interval = 60
threshold = 11
skip_notifications = false
enabled = true
action = "template"
block_duration_seconds = 54321
}
}
resource "sigsci_site_rule" "test" {
site_short_name = sigsci_site.my-site.short_name
type = "signal"
group_operator = "any"
enabled = true
reason = "Example site rule update"
signal = "SQLI"
expiration = ""
conditions {
type = "single"
field = "ip"
operator = "equals"
value = "1.2.3.4"
}
conditions {
type = "single"
field = "ip"
operator = "equals"
value = "1.2.3.5"
}
conditions {
type = "multival"
field = "queryParameter"
operator = "exists"
group_operator = "all"
conditions {
type = "single"
field = "name"
operator = "equals"
value = "hello"
}
conditions {
type = "single"
field = "value"
operator = "equals"
value = "world"
}
}
actions {
type = "excludeSignal"
}
}
resource "sigsci_site_blocklist" "test" {
site_short_name = sigsci_site.my-site.short_name
source = "1.2.3.4"
note = "sample blocklist"
}
resource "sigsci_site_header_link" "test_header_link" {
site_short_name = sigsci_site.my-site.short_name
name = "test_header_link"
type = "request"
link_name = "signal sciences 89"
link = "https://www.signalsciences.net"
}
resource "sigsci_site_allowlist" "test" {
site_short_name = sigsci_site.my-site.short_name
source = "1.2.2.1"
note = "sample allowlistt"
}
resource "sigsci_site_redaction" "test_redaction" {
site_short_name = sigsci_site.my-site.short_name
field = "redacted"
redaction_type = 0
}
resource "sigsci_site_rule" "testt" {
site_short_name = sigsci_site.my-site.short_name
type = "request"
group_operator = "all"
enabled = true
reason = "Example site rule update"
expiration = ""
conditions {
type = "multival"
field = "signal"
group_operator = "any"
operator = "exists"
conditions {
field = "signalType"
operator = "equals"
type = "single"
value = "RESPONSESPLIT"
}
}
conditions {
type = "group"
group_operator = "any"
conditions {
field = "useragent"
operator = "like"
type = "single"
value = "python-requests*"
}
conditions {
type = "multival"
field = "requestHeader"
operator = "doesNotExist"
group_operator = "all"
conditions {
field = "valueString"
operator = "equals"
type = "single"
value = "cookie"
}
}
conditions {
type = "multival"
field = "signal"
operator = "exists"
group_operator = "any"
conditions {
field = "signalType"
operator = "equals"
type = "single"
value = "TORNODE"
}
conditions {
field = "signalType"
operator = "equals"
type = "single"
value = "SIGSCI-IP"
}
conditions {
field = "signalType"
operator = "equals"
type = "single"
value = "SCANNER"
}
}
}
actions {
type = "block"
}
}
resource "sigsci_site_rule" "testsignal" {
site_short_name = sigsci_site.my-site.short_name
type = "templatedSignal"
group_operator = "all"
enabled = true
reason = ""
signal = "PW-RESET-ATTEMPT"
expiration = ""
conditions {
type = "single"
field = "method"
operator = "equals"
value = "POST"
}
conditions {
type = "single"
field = "path"
operator = "equals"
value = "/change-password"
}
conditions {
type = "multival"
field = "postParameter"
operator = "exists"
group_operator = "all"
conditions {
field = "name"
operator = "equals"
type = "single"
value = "submit"
}
}
}
resource "sigsci_site_integration" "test_integration" {
site_short_name = sigsci_site.my-site.short_name
type = "slack"
url = "https://wat.slack.com"
events = ["listCreated"]
}
resource "sigsci_site_integration" "test_integration_datadog" {
site_short_name = sigsci_site.my-site.short_name
type = "datadog"
url = ""
events = ["flag", "agentAlert"]
fields {
name = "site"
value = "us1"
}
fields {
name = "apiKey"
value = "your_api_key"
}
}
resource "sigsci_corp_cloudwaf_certificate" "test_cloudwaf_certificate" {
name = "Certificate Name"
certificate_body = <<CERT
-----BEGIN CERTIFICATE-----
MIIDzjCCArYCCQD6uBPuCbaD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Pqi
fZRuHdPedogM80f4E5RyKhTzEqTG6x0pfjkDr57rdqJEWhM3TjsMIiJRnEIomWar
2tyckmvkxuSioiWb/+HXJN5u6AtsMgQ4WLMm9HOO0ir5uSKQd0iQrCMAaGDNdV52
6eipkWLdhYAhW31bycv9cX04+QKBgQDQWlkTovazzNElJU4h1YQCq99VS1gmYb9U
HAzg3Jmu7WF4Oln+HxZMWqwR38vCuMHiwtCmsqGAEKK2ev6W6iq7iVJLKzTXV++a
612Mr+JohbHNL0bKlgTMt/i2TnmBWOlhL7xuIwduru1pQ4mM7Vh7Hv+CrVTGm4VZ
Khzq+vbCTQKBgEnprgO0ZLiHr8GZ29tqnfP8B5l3hWTMU4duKIXQEzKDFllvZ3iI
ioXiv+RvSUvTJjlKMNRUIER4mDHgZUq0THx1Vigb23PjZNI5a5I9mTzxKhw7eA4Q
hN0jTI4AMiY4K6exlE3O0DDtIAOkOIgHcH8e/9JvvwCKUgniZzCjW3kRAoGAeEId
tgLSyFbIxNrybP7zciNIBdA2MfkrWN3T5RoPLnNfVejANrg0w592P97fmiXP6xWt
Hvpt0yBG+nKlbe/8+D+7mx12I3FjIBUH6wM9+Dxqsta90oKihJMPYBKNeUYbdnf6
F8vqJ02aRK6xvwDjmDT9H6zyCKyNXDi9djeio+UCgYEAm1g/2O42eVBzYG/WTJ2H
7jplYemfbIFVpl3Uo18UJKZl/AIzm9tw/+c884naSubwQ8TukI3bDjwWu99R26bo
HQRmLMnP+t7xp84Rn4jXReWlr9sexXHPg/Lj25MdR1t3Ow53qSh4nw/cUPr42N9o
cX4iWLb38v7KEornZfofXEw=
-----END PRIVATE KEY-----
PRIVATEKEY
}
#resource "sigsci_edge_deployment" "edge" {
# site_short_name = sigsci_site.my-site.short_name
#}
#resource "sigsci_edge_deployment_service" "edge" {
# site_short_name = sigsci_site.my-site.short_name
# fastly_sid = "[Fastly service id]"
# activate_version = true
# percent_enabled = 100
#}