/AD_Azure_lab

Primary LanguageHCLApache License 2.0Apache-2.0

ADLab

By @thehackerish@chvancooten Just some minor updates to make it work again.

Setup

The lab is provisioned automatically using Terraform and Ansible. First, Terraform deploys all the infrastructure and prepares the machines for provisioning. It then kicks off a role-based Ansible playbook from the Debian attacker machine to provision the Windows-based machines. The full process takes about 15 to 20 minutes to complete.

If you have problems with default providers you must register them manually. https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/common-deployment-errors#noregisteredproviderfound https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/error-register-resource-provider?tabs=azure-cli

  • az provider register --namespace Microsoft.Compute

  • az provider register --namespace Microsoft.Network

  • az provider show -n Microsoft.Network

  • az provider show -n Microsoft.Compute

  • change domain

  • change password for linux user (Terraform/07-hackbox.tf and Terraform/08-ansible.tf)

  • set an ip in the whitelist to be able to ssh (Terraform/terraform.tfvars)

💸 Note: The machine sizes are moderately small by default ('Standard_B1ms'). For better performence, use Standard_B2ms or Standard_B4ms. With the latter, the bill will be approx. €10 per day of active use, your mileage may vary. Change the appropriate 'size' settings in terraform.tfvars to change machine sizes.

Deployment

  • Clone the repo to your Azure cloud shell. It conveniently has all you need (Terraform and an authenticated Azure provider). Alternatively, install and configure Terraform and the Azure provider yourself. Ansible is installed automatically as part of the provisioning process.
  • Copy terraform.tfvars.example to terraform.tfvars in the Terraform directory, and configure the variables appropriately.
  • In the same directory, run terraform init.
  • When you're ready to deploy, run terraform apply (or terraform apply --auto-approve to skip the approval check).

Once deployment and provisioning have finished, the output variables (public IP / DNS name, administrative passwords, machine names, etc.) will be displayed. You are now ready to connect to the labs!

Removal

  • When you're done with the labs, run terraform destroy to tear down the environment.

Labs

Lab overview

The labs consist of a selection of machines:

  • Windows Server 2016 DC
    • Active Directory Certificate Services (ADCS) installed
  • Windows Server 2019
    • Internet Information Services (IIS) web server with simple vulnerable app
  • Windows 10 client
  • Debian attacker box

One public IP is exposed for the whole lab. The IP ranges defined in the ip-whitelist are allowed to access the following ports on this IP address, which are bound to the following services using a load balancer:

  • Port 22 -> Attacker machine SSH
  • Port 80 -> Windows Server 2019 IIS web server with vulnerable page
  • Port 3389 -> Windows 10 Client RDP

Another public IP is used for outbound Internet connectivity for all lab machines.