All Projects → DefensiveOrigins → APT-Lab-Terraform

DefensiveOrigins / APT-Lab-Terraform

Licence: GPL-3.0 license
Purple Teaming Attack & Hunt Lab - Terraform

Programming Languages

HCL
1544 projects
python
139335 projects - #7 most used programming language
powershell
5483 projects

Projects that are alternatives of or similar to APT-Lab-Terraform

iot-curriculum
Hands on labs and content for students and educators to learn and teach the Internet of Things at schools, universities, coding clubs, community colleges and bootcamps
Stars: ✭ 110 (-23.61%)
Mutual labels:  labs
advanced-istio-service-mesh-workshop
Advanced Istio Service Mesh Workshop
Stars: ✭ 28 (-80.56%)
Mutual labels:  labs
ezEmu
See adversary, do adversary: Simple execution of commands for defensive tuning/research (now with more ELF on the shelf)
Stars: ✭ 89 (-38.19%)
Mutual labels:  purpleteam
Cobol Programming Course
Training materials and labs for a "Getting Started" level course on COBOL
Stars: ✭ 1,963 (+1263.19%)
Mutual labels:  labs
bring-your-own-data-labs
Bring your own data Labs: Build a serverless data pipeline based on your own data
Stars: ✭ 40 (-72.22%)
Mutual labels:  labs
hackthebox
Notes Taken for HTB Machines & InfoSec Community.
Stars: ✭ 286 (+98.61%)
Mutual labels:  labs
USTC-CS-Resources
USTC计算机学院 个人学习资料分享
Stars: ✭ 86 (-40.28%)
Mutual labels:  labs
labs-maputnik-dev-server
An express.js server that allows for quickly loading mapboxGL styles from any project into the Maputnik Style Editor
Stars: ✭ 31 (-78.47%)
Mutual labels:  labs
Labtainers
Labtainers: A Docker-based cyber lab framework
Stars: ✭ 226 (+56.94%)
Mutual labels:  labs
robo-chart-web
📊 Transform Google sheets to pretty charts!
Stars: ✭ 28 (-80.56%)
Mutual labels:  labs
Academiccontent
Free tech resources for faculty, students, researchers, life-long learners, and academic community builders for use in tech based courses, workshops, and hackathons.
Stars: ✭ 2,196 (+1425%)
Mutual labels:  labs
DZ-Pharma-Data
Medications data for +4800 drugs sold in Algeria and their labs
Stars: ✭ 23 (-84.03%)
Mutual labels:  labs
database labs
initial set of databases labs
Stars: ✭ 19 (-86.81%)
Mutual labels:  labs
labs-zap-search
Search application for the DCP Zoning Application Search
Stars: ✭ 13 (-90.97%)
Mutual labels:  labs
github-watchman
Monitoring GitHub for sensitive data shared publicly
Stars: ✭ 60 (-58.33%)
Mutual labels:  purpleteam
SI4844
Silicon Labs SI4844 (BROADCAST ANALOG TUNING DIGITAL DISPLAY AM/FM/SW RADIO RECEIVER) Library
Stars: ✭ 16 (-88.89%)
Mutual labels:  labs
awesome-mobile-robotics
Useful links of different content related to AI, Computer Vision, and Robotics.
Stars: ✭ 243 (+68.75%)
Mutual labels:  labs
BlueCloud
Cyber Range including Velociraptor + HELK system with a Windows VM for security testing and R&D. Azure and AWS terraform support.
Stars: ✭ 88 (-38.89%)
Mutual labels:  purpleteam
NIST-to-Tech
An open-source listing of cybersecurity technology mapped to the NIST Cybersecurity Framework (CSF)
Stars: ✭ 61 (-57.64%)
Mutual labels:  purpleteam
labs-migration-viz
A single-page interactive visualization of historic U.S. Census migration data for New York City
Stars: ✭ 18 (-87.5%)
Mutual labels:  labs

Defensive Origins

Applied Purple Teaming Threat Optics Lab - Azure TerraForm

Purple Teaming Attack & Hunt Lab - TerraForm


Background

Defensive Origins uses a highly verbose threat optics lab to isolate adversarial techniques to more easily attribute IOC (indicators of compromise). These labs have routinely been time consuming to build and manage. The platform included here automates much of the threat-optic lab environment built on the Azure cloud network.

Installation:

This process requires Python3.

Install AzureCLI

https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-apt?view=azure-cli-latest

Install TerraForm

https://learn.hashicorp.com/terraform/getting-started/install.html

Setup and Configuration

Create Token/Document

Default Credentials:

Default credentials are set in LabBuilder.py.

  • Windows & Linux systems:
itadmin:APTClass!
  • Kibana:
helk:hunting

Changing Default Credentials

The credentials can be changed within the locals variable:

locals {
  resource_group_name   = "class-resources"
  master_admin_username ="itadmin"
  master_admin_password ="APTClass!"
  master_domain         ="labs.local"
}

The password for Kibana can be changed by editing the HELK install line:

./helk_install.sh -p hunting -i 10.10.98.20 -b 'helk-kibana-analysis-alert'

within the

3-setup.tf`

This file is located at:

APT-Lab-Terraform/master/modules/linux/3-setup.tf

Please note the following regarding access:

  • Only the Windows client is accessible externally
  • Kibana is accessed internally, use a browser on one of the Windows machines to access.
  • An SSH client will need to be installed on the Windows machines in order to SSH to the Linux system.

Configure Regions

Clone APT TerraForm Repository

git clone https://github.com/DefensiveOrigins/APT-Lab-Terraform.git
cd APT-Lab-Terraform

Execute TerraForm build process

Run the builder and deploy your systems.

python .\LabBuilder.py -m YOURPUBLICIP

Please note:

  • If this script errors, or there are missing dependencies ensure it is being executed with Python 3.X. As such, attempt to execute with Python3 directly:
python3 .\LabBuilder.py -m YOURPUBLICIP

Source IP Filtering

The -m flag will accept a single IP Address or Subnet as input. This adds the IP as a SRC IP address filter on the lab environment.

-m [IP]

Successful Deployment

To confirm successful deployment the following 3 virtual machines will be found within Azure:

  • stu-client
  • stu-dc
  • stu-linux

Deployment, include all the post-installation scripts, may take twenty minutes or more. Setup of the Linux node, with its ELK stack, will take the longest.

Troubleshooting Steps

If LabBuilder.py errors during execution. Delete the LABS folder, found at

APT-Lab-Terraform/LABS/

The error (shown at the top of script execution) is:

Directory not copied. Error: [Errno 17] File exists: './LABS'.

Errors referencing a 'duplicate' are also solved by this. Examples include:

Error: Duplicate module call
Error: Duplicate resource "azurerm_resource_group" configuration

If LabBuilder.py gives you an error as follows:

TypeError: replace() argument 2 must be str, not tuple

... it means that you copy-pasted configuration data for your Azure Cloud authentication, without removing the trailing comma (,). Definitions such as "client_id" should not end with a comma.

If LabBuilder.py creates only one or two out of the three VMs it will likely also throw an error including the following text:

Operation could not be completed as it results in exceeding approved Total Regional Cores quota.

This occurs when you have a free/trial Azure Cloud subscription, which is limited to 4 active CPU cores. You may edit the VM definitions for the Active Directory server and the Windows client, to change the VM sizing. This is done in the files named "2-virtual-machine.tf", by replacing the "vm_size" field. The files include an example line to use as replacement.

Destroying the Lab

python .\LabBuilder.py -destroy

The '-d' or '-destroy' flag will execute theTerraform destroy command. This will remove the Lab in Azure. CAUTION: All data within the VMs will be deleted.

Please confirm within the Azure portal that everything has been deleted.

Accessing HELK:


Modules

The various components of this build process are defined below.

Module Function
/master/modules Various TerraForm modules
LabBuilder.py Python script that uses TerraForm and AzureCLI to build the Applied Purple Teaming to specifications using the modules in /master/modules and additional resources.
labs.zip Additional resources to configure lab environment.

Network

This module creates a Network with 2 x Subnets:

  • Domain Controllers
  • Domain Clients

This module shouldn't be used as-is in a Production Environment - where you'd probably have Network Security Rules configured - it's designed to be a simplified configuration for the purposes of this example.

Module Function
main.tf Setup Primary Network
outputs.tf Grab and Set Network ID
variables.tf TerraForm variables

Active Directory

Module Function
1-network-interface.tf Setup interface of Domain Controller
2-virtual-machine.tf Specify Domain Controller VM Attributes
3-provision-domain.tf Initial Domain Configuration
4-wait-for-domain-to-provision.tf Quietly wait for Domain to finish provisioning
5-setup.tf Domain Controller Services and Software Configuration
variables.tf TerraForm variables
files/FirstLogonCommands.xml Run first commands
files/winrm.ps1 Enable WinRM, grab Lab resources

Linux / Helk

  • This module configures a Ubuntu image with the necessary tooling to be used as a hunters-SIEM (HELK)
Module Function
1-network-interface.tf Setup interface for Linux system
2-virtual-machine.tf Specify VM configuration for Linux System
3-setup.tf Setup and configure software
variables.tf TerraForm variables

Windows Client

  • This module provisions a Windows Client which will be bound to the Active Directory Domain created in the other module.
  • There's a few hacks in here as we have to wait for Active Directory to become available, but this takes advantage of the azurerm_virtual_machine_extension resource. It's worth noting that the keys in this resource are case sensitive.
Module Function
1-network-interface.tf Setup network interface for Windows client
2-virtual-machine.tf Specify client VM configuration
3-wait-for-domain-to-provision.tf Politely wait for the Domain to be provisioned
4-join-domain.tf Join Windows client to domain.
5-setup.tf Procure and configure the various tools.
outputs.tf Grab the associated VM IP.
variables.tf TerraForm variables

Hat-Tips and Acknowledgments

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].