Skip to content

Commit bb727c5

Browse files
author
netevert
committed
simplified lab deployment script
1 parent 176e161 commit bb727c5

File tree

3 files changed

+19
-159
lines changed

3 files changed

+19
-159
lines changed

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
77
[![](https://img.shields.io/badge/2019-DEF%20CON%2027-blueviolet?style=flat-square)](https://2019.cloud-village.org/#talks?olafedoardo)
88
<!--
9-
[![](https://img.shields.io/badge/Azure%20Sentinel%20workbooks%20gallery-grey?style=flat-square&logo=microsoft-azure)](https://github.com/Azure/Azure-Sentinel/blob/master/Workbooks/SysmonThreatHunting.json)
9+
[![](https://img.shields.io/badge/Official%20Azure%20Sentinel%20workbook-grey?style=flat-square&logo=microsoft-azure)](https://github.com/Azure/Azure-Sentinel/blob/master/Workbooks/SysmonThreatHunting.json)
1010
-->
11-
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FBlueTeamLabs%2Fsentinel-attack%2Fdev%2Fv.1.4.2%2Fazuredeploy.json)
11+
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FBlueTeamLabs%2Fsentinel-attack%2Fmaster%2Fazuredeploy.json)
1212

1313
Sentinel ATT&CK aims to simplify the rapid deployment of a threat hunting capability that leverages Sysmon and [MITRE ATT&CK](https://attack.mitre.org/) on Azure Sentinel.
1414

@@ -17,7 +17,8 @@ Sentinel ATT&CK aims to simplify the rapid deployment of a threat hunting capabi
1717
![demo](https://github.com/BlueTeamToolkit/sentinel-attack/blob/master/docs/demo.gif)
1818

1919
### Overview
20-
Sentinel ATT&CK provides the following set of tools:
20+
Sentinel ATT&CK provides the following tools:
21+
- An [ARM template](https://github.com/BlueTeamToolkit/sentinel-attack/blob/master/azuredeploy.json) to automatically deploy Sentinel ATT&CK to your Azure environment
2122
- A [Sysmon configuration file](https://github.com/BlueTeamToolkit/sentinel-attack/blob/master/sysmonconfig.xml) compatible with Azure Sentinel and mapped to specific ATT&CK techniques
2223
- A [Sysmon log parser](https://github.com/BlueTeamToolkit/sentinel-attack/blob/master/parser/Sysmon-OSSEM.txt) mapped against the [OSSEM](https://github.com/Cyb3rWard0g/OSSEM) data model
2324
- 117 ready-to-use Kusto [detection rules](https://github.com/BlueTeamToolkit/sentinel-attack/tree/master/detections) covering 156 ATT&CK techniques

lab/main.tf

+14-155
Original file line numberDiff line numberDiff line change
@@ -7,52 +7,20 @@ provider "azurerm" {
77
tenant_id = var.authentication.tenant_id
88
}
99

10-
# Create dedicated resource group
11-
resource "azurerm_resource_group" "rg" {
12-
name = "${var.prefix}-rg"
13-
location = var.location
14-
tags = var.tags
15-
}
16-
17-
# Create underlying log analytics workspace for sentinel
18-
resource "azurerm_log_analytics_workspace" "rgcore-management-la" {
19-
name = "${var.prefix}-la"
20-
location = azurerm_resource_group.rg.location
21-
resource_group_name = azurerm_resource_group.rg.name
22-
sku = "PerGB2018"
23-
retention_in_days = 90
24-
depends_on = [azurerm_resource_group.rg]
25-
}
26-
27-
# Deploy sentinel
28-
resource "azurerm_log_analytics_solution" "la-opf-solution-sentinel" {
29-
solution_name = "SecurityInsights"
30-
location = azurerm_resource_group.rg.location
31-
resource_group_name = azurerm_resource_group.rg.name
32-
workspace_resource_id = azurerm_log_analytics_workspace.rgcore-management-la.id
33-
workspace_name = azurerm_log_analytics_workspace.rgcore-management-la.name
34-
plan {
35-
publisher = "Microsoft"
36-
product = "OMSGallery/SecurityInsights"
37-
}
38-
depends_on = [azurerm_log_analytics_workspace.rgcore-management-la]
39-
}
40-
4110
# Create lab virtual network
4211
resource "azurerm_virtual_network" "vnet" {
4312
name = "${var.prefix}-vnet"
4413
address_space = ["10.0.0.0/16"]
4514
location = var.location
46-
resource_group_name = azurerm_resource_group.rg.name
15+
resource_group_name = "${var.prefix}"
4716
tags = var.tags
48-
depends_on = [azurerm_log_analytics_solution.la-opf-solution-sentinel]
4917
}
5018

5119
# Create network security group and rules
5220
resource "azurerm_network_security_group" "nsg" {
5321
name = "${var.prefix}-nsg"
5422
location = var.location
55-
resource_group_name = azurerm_resource_group.rg.name
23+
resource_group_name = "${var.prefix}"
5624
tags = var.tags
5725
depends_on = [azurerm_virtual_network.vnet]
5826

@@ -132,7 +100,7 @@ resource "azurerm_network_security_group" "nsg" {
132100
# Create lab subnet
133101
resource "azurerm_subnet" "subnet" {
134102
name = "${var.prefix}-subnet"
135-
resource_group_name = azurerm_resource_group.rg.name
103+
resource_group_name = "${var.prefix}"
136104
virtual_network_name = azurerm_virtual_network.vnet.name
137105
address_prefix = "10.0.1.0/24"
138106
network_security_group_id = azurerm_network_security_group.nsg.id
@@ -142,8 +110,8 @@ resource "azurerm_subnet" "subnet" {
142110
# Create storage account
143111
resource "azurerm_storage_account" "storageaccount" {
144112
name = "${var.prefix}sablobstrg01"
145-
resource_group_name = azurerm_resource_group.rg.name
146-
location = azurerm_resource_group.rg.location
113+
resource_group_name = "${var.prefix}"
114+
location = var.location
147115
account_tier = "Standard"
148116
account_replication_type = "GRS"
149117
depends_on = [azurerm_subnet.subnet]
@@ -177,130 +145,21 @@ resource "azurerm_storage_blob" "adblob" {
177145
source = "./files/create-ad.ps1"
178146
}
179147

180-
# Create blob storage container for whitelisting files
181-
resource "azurerm_storage_container" "whiteliststorage" {
182-
name = "${var.prefix}-store2"
183-
storage_account_name = azurerm_storage_account.storageaccount.name
184-
container_access_type = "private"
185-
depends_on = [azurerm_storage_blob.adblob]
186-
}
187-
188-
# Create storage blob for process create whitelist file
189-
resource "azurerm_storage_blob" "pcwhitelist" {
190-
depends_on = [azurerm_storage_container.whiteliststorage]
191-
name = "process_create_whitelist.csv"
192-
storage_account_name = azurerm_storage_account.storageaccount.name
193-
storage_container_name = azurerm_storage_container.whiteliststorage.name
194-
type = "block"
195-
source = "./files/process_create_whitelist.csv"
196-
}
197-
198-
# Create storage blob for dns whitelist file
199-
resource "azurerm_storage_blob" "dnswhitelist" {
200-
depends_on = [azurerm_storage_blob.pcwhitelist]
201-
name = "dns_whitelist.csv"
202-
storage_account_name = azurerm_storage_account.storageaccount.name
203-
storage_container_name = azurerm_storage_container.whiteliststorage.name
204-
type = "block"
205-
source = "./files/dns_whitelist.csv"
206-
}
207-
208-
# Create storage blob for file access whitelist file
209-
resource "azurerm_storage_blob" "fawhitelist" {
210-
depends_on = [azurerm_storage_blob.dnswhitelist]
211-
name = "file_access_whitelist.csv"
212-
storage_account_name = azurerm_storage_account.storageaccount.name
213-
storage_container_name = azurerm_storage_container.whiteliststorage.name
214-
type = "block"
215-
source = "./files/file_access_whitelist.csv"
216-
}
217-
218-
# Create storage blob for file create whitelist file
219-
resource "azurerm_storage_blob" "fcwhitelist" {
220-
depends_on = [azurerm_storage_blob.fawhitelist]
221-
name = "file_create_whitelist.csv"
222-
storage_account_name = azurerm_storage_account.storageaccount.name
223-
storage_container_name = azurerm_storage_container.whiteliststorage.name
224-
type = "block"
225-
source = "./files/file_create_whitelist.csv"
226-
}
227-
228-
229-
# Create storage blob for image load whitelist file
230-
resource "azurerm_storage_blob" "ilwhitelist" {
231-
depends_on = [azurerm_storage_blob.fcwhitelist]
232-
name = "image_load_whitelist.csv"
233-
storage_account_name = azurerm_storage_account.storageaccount.name
234-
storage_container_name = azurerm_storage_container.whiteliststorage.name
235-
type = "block"
236-
source = "./files/image_load_whitelist.csv"
237-
}
238-
239-
# Create storage blob for network whitelist file
240-
resource "azurerm_storage_blob" "netwhitelist" {
241-
depends_on = [azurerm_storage_blob.ilwhitelist]
242-
name = "network_whitelist.csv"
243-
storage_account_name = azurerm_storage_account.storageaccount.name
244-
storage_container_name = azurerm_storage_container.whiteliststorage.name
245-
type = "block"
246-
source = "./files/network_whitelist.csv"
247-
}
248-
249-
# Create storage blob for pipe whitelist file
250-
resource "azurerm_storage_blob" "pipewhitelist" {
251-
depends_on = [azurerm_storage_blob.netwhitelist]
252-
name = "pipe_whitelist.csv"
253-
storage_account_name = azurerm_storage_account.storageaccount.name
254-
storage_container_name = azurerm_storage_container.whiteliststorage.name
255-
type = "block"
256-
source = "./files/pipe_whitelist.csv"
257-
}
258-
259-
# Create storage blob for process access whitelist file
260-
resource "azurerm_storage_blob" "pawhitelist" {
261-
depends_on = [azurerm_storage_blob.pipewhitelist]
262-
name = "process_access_whitelist.csv"
263-
storage_account_name = azurerm_storage_account.storageaccount.name
264-
storage_container_name = azurerm_storage_container.whiteliststorage.name
265-
type = "block"
266-
source = "./files/process_access_whitelist.csv"
267-
}
268-
269-
# Create storage blob for registry whitelist file
270-
resource "azurerm_storage_blob" "regwhitelist" {
271-
depends_on = [azurerm_storage_blob.pawhitelist]
272-
name = "registry_whitelist.csv"
273-
storage_account_name = azurerm_storage_account.storageaccount.name
274-
storage_container_name = azurerm_storage_container.whiteliststorage.name
275-
type = "block"
276-
source = "./files/registry_whitelist.csv"
277-
}
278-
279-
# Create storage blob for remote thread whitelist file
280-
resource "azurerm_storage_blob" "rtwhitelist" {
281-
depends_on = [azurerm_storage_blob.pawhitelist]
282-
name = "remote_thread_whitelist.csv"
283-
storage_account_name = azurerm_storage_account.storageaccount.name
284-
storage_container_name = azurerm_storage_container.whiteliststorage.name
285-
type = "block"
286-
source = "./files/remote_thread_whitelist.csv"
287-
}
288-
289148
# Create public ip for domain controller 1
290149
resource "azurerm_public_ip" "dc1_publicip" {
291150
name = "${var.workstations.dc1}-external"
292151
location = var.location
293-
resource_group_name = azurerm_resource_group.rg.name
152+
resource_group_name = "${var.prefix}"
294153
allocation_method = "Dynamic"
295154
tags = var.tags
296-
depends_on = [azurerm_storage_blob.rtwhitelist]
155+
depends_on = [azurerm_storage_blob.adblob]
297156
}
298157

299158
# Create network interface for domain controller 1
300159
resource "azurerm_network_interface" "dc1_nic" {
301160
name = "${var.workstations.dc1}-primary"
302161
location = var.location
303-
resource_group_name = azurerm_resource_group.rg.name
162+
resource_group_name = "${var.prefix}"
304163
network_security_group_id = azurerm_network_security_group.nsg.id
305164
tags = var.tags
306165

@@ -317,7 +176,7 @@ resource "azurerm_network_interface" "dc1_nic" {
317176
resource "azurerm_virtual_machine" "dc1" {
318177
name = var.workstations.dc1
319178
location = var.location
320-
resource_group_name = azurerm_resource_group.rg.name
179+
resource_group_name = "${var.prefix}"
321180
network_interface_ids = ["${azurerm_network_interface.dc1_nic.id}"]
322181
vm_size = var.workstations.vm_size
323182
tags = var.tags
@@ -364,7 +223,7 @@ resource "azurerm_virtual_machine" "dc1" {
364223
resource "azurerm_virtual_machine_extension" "create_ad" {
365224
name = "create_ad"
366225
location = var.location
367-
resource_group_name = azurerm_resource_group.rg.name
226+
resource_group_name = "${var.prefix}"
368227
virtual_machine_name = azurerm_virtual_machine.dc1.name
369228
publisher = "Microsoft.Compute"
370229
type = "CustomScriptExtension"
@@ -383,7 +242,7 @@ SETTINGS
383242
resource "azurerm_public_ip" "pc1_publicip" {
384243
name = "${var.workstations.pc1}-external"
385244
location = var.location
386-
resource_group_name = azurerm_resource_group.rg.name
245+
resource_group_name = "${var.prefix}"
387246
allocation_method = "Dynamic"
388247
tags = var.tags
389248
depends_on = [azurerm_virtual_machine_extension.create_ad]
@@ -393,7 +252,7 @@ resource "azurerm_public_ip" "pc1_publicip" {
393252
resource "azurerm_network_interface" "pc1_nic" {
394253
name = "${var.workstations.pc1}-primary"
395254
location = var.location
396-
resource_group_name = azurerm_resource_group.rg.name
255+
resource_group_name = "${var.prefix}"
397256
network_security_group_id = azurerm_network_security_group.nsg.id
398257
tags = var.tags#
399258
ip_configuration {
@@ -409,7 +268,7 @@ resource "azurerm_network_interface" "pc1_nic" {
409268
resource "azurerm_virtual_machine" "pc1" {
410269
name = var.workstations.pc1
411270
location = var.location
412-
resource_group_name = azurerm_resource_group.rg.name
271+
resource_group_name = "${var.prefix}"
413272
network_interface_ids = ["${azurerm_network_interface.pc1_nic.id}"]
414273
vm_size = var.workstations.vm_size
415274
tags = var.tags
@@ -456,7 +315,7 @@ resource "azurerm_virtual_machine" "pc1" {
456315
resource "azurerm_virtual_machine_extension" "utils_pc1" {
457316
name = "utils_pc1"
458317
location = var.location
459-
resource_group_name = azurerm_resource_group.rg.name
318+
resource_group_name = "${var.prefix}"
460319
virtual_machine_name = azurerm_virtual_machine.pc1.name
461320
publisher = "Microsoft.Compute"
462321
type = "CustomScriptExtension"

lab/variables.tfvars.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ authentication = {
66
}
77

88
location = "" # eg. westus
9-
prefix = "" # eg. azure-sentinel-lab
9+
prefix = "" # eg. azure-sentinel-lab; NOTE: ensure this is identical to the resource group within which Sentinel-ATT&CK has been deployed
1010

1111
tags = {
1212
environment = "" # eg. dev, testing, staging

0 commit comments

Comments
 (0)