Skip to content

Commit 0a1a78f

Browse files
Freshness pass.
1 parent 3fcf667 commit 0a1a78f

6 files changed

+227
-228
lines changed
Lines changed: 92 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,74 @@
11
---
22
title: Set up an ethical hacking lab
33
titleSuffix: Azure Lab Services
4-
description: Learn how to set up a lab to teach ethical hacking using Azure Lab Services.
4+
description: Learn how to set up a lab to teach ethical hacking using Azure Lab Services. The lab includes nested VMs for students to use in a standard environment.
55
services: lab-services
66
ms.service: lab-services
7-
author: ntrogh
8-
ms.author: nicktrog
7+
author: RoseHJM
8+
ms.author: rosemalcolm
99
ms.topic: how-to
10-
ms.date: 01/24/2023
10+
ms.date: 03/04/2024
11+
#customer intent: As an administrator or educator, I want to set up a lab by using Azure Lab Services so that students can practice ethical hacking techniques.
1112
---
1213

1314
# Set up a lab to teach ethical hacking class by using Azure Lab Services
1415

15-
[!INCLUDE [preview note](./includes/lab-services-new-update-focused-article.md)]
16-
17-
This article shows you how to set up a class that focuses on the forensics side of ethical hacking with Azure Lab Services. In an ethical hacking class, students can learn modern techniques for defending against vulnerabilities. Penetration testing, a practice that the ethical hacking community uses, occurs when someone attempts to gain access to the system or network to demonstrate vulnerabilities that a malicious attacker may exploit.
16+
This article shows you how to set up a class that focuses on the forensics side of ethical hacking with Azure Lab Services. In an ethical hacking class, students can learn modern techniques for defending against vulnerabilities. Penetration testing, a practice that the ethical hacking community uses, occurs when someone attempts to gain access to the system or network to demonstrate vulnerabilities that a malicious attacker might exploit.
1817

19-
Each student gets a Windows host virtual machine (VM) that has two nested virtual machines: one VM with [Metasploitable3](https://github.com/rapid7/metasploitable3) image and another VM with the [Kali Linux](https://www.kali.org/) image. You use the Metasploitable VM for exploiting purposes. The Kali VM provides access to the tools you need to execute forensic tasks.
18+
[!INCLUDE [preview note](./includes/lab-services-new-update-focused-article.md)]
2019

21-
This article has two main sections. The first section covers how to create the lab. The second section covers how to create the template machine with nested virtualization enabled and with the tools and images needed. In this case, a Metasploitable image and a Kali Linux image on a machine that has Hyper-V enabled to host the images.
20+
Each student gets a Windows host virtual machine (VM) that has two nested virtual machines: one VM with Metasploitable3 image and another VM with the Kali Linux image. Use the Metasploitable VM for exploiting purposes. The Kali VM provides access to the tools you need to run forensic tasks.
2221

2322
## Prerequisites
2423

25-
[!INCLUDE [must have subscription](./includes/lab-services-class-type-subscription.md)]
24+
- [!INCLUDE [must have subscription](./includes/lab-services-class-type-subscription.md)]
25+
- [!INCLUDE [must have lab plan](./includes/lab-services-class-type-lab-plan.md)]
2626

27-
[!INCLUDE [must have lab plan](./includes/lab-services-class-type-lab-plan.md)]
27+
## Configure your lab
2828

29-
## Lab configuration
30-
31-
[!INCLUDE [create lab](./includes/lab-services-class-type-lab.md)] Use the following settings when creating the lab.
29+
[!INCLUDE [create lab](./includes/lab-services-class-type-lab.md)] Use the following settings when creating the lab.
3230

3331
| Lab settings | Value |
3432
| ------------ | ------------------ |
3533
| Virtual machine (VM) size | Medium (Nested Virtualization) |
3634
| VM image | Windows 11 |
3735

38-
## Template machine configuration
36+
## Configure your template
3937

4038
[!INCLUDE [configure template vm](./includes/lab-services-class-type-template-vm.md)]
4139

42-
To configure the template VM, complete the following three tasks:
43-
44-
1. Set up the machine for nested virtualization. You enable all the appropriate windows features, like Hyper-V.
45-
46-
2. Set up the [Kali](https://www.kali.org/) Linux image. Kali is a Linux distribution that includes tools for penetration testing and security auditing.
40+
To configure the template VM, complete the following tasks:
4741

48-
3. Set up the Metasploitable image. For this example, you use the [Metasploitable3](https://github.com/rapid7/metasploitable3) image. This image is created to purposely have security vulnerabilities.
42+
- Set up the machine for nested virtualization. Enable all the appropriate windows features, like Hyper-V.
43+
- Set up the [Kali](https://www.kali.org/) Linux image. Kali is a Linux distribution that includes tools for penetration testing and security auditing.
44+
- Set up the Metasploitable image. For this example, use the [Metasploitable3](https://github.com/rapid7/metasploitable3) image. This image is created to purposely have security vulnerabilities.
4945

5046
# [PowerShell](#tab/powershell)
5147

5248
### Prepare template machine for nested virtualization
5349

54-
```powershell
55-
Invoke-WebRequest 'https://aka.ms/azlabs/scripts/hyperV-powershell' -Outfile SetupForNestedVirtualization.ps1
56-
.\SetupForNestedVirtualization.ps1
57-
```
50+
- Launch **PowerShell** in **Administrator** mode. Run these commands.
51+
52+
```powershell
53+
Invoke-WebRequest 'https://aka.ms/azlabs/scripts/hyperV-powershell' -Outfile SetupForNestedVirtualization.ps1
54+
.\SetupForNestedVirtualization.ps1
55+
```
56+
57+
> [!NOTE]
58+
> The script might require the machine to restart. Follow instructions from the script and re-run the script until you see **Script completed** in the output.
5859
5960
### Set up nested virtual machine images
6061

6162
Kali is a Linux distribution that includes tools for penetration testing and security auditing.
6263

63-
The Rapid7 Metasploitable image is an image purposely configured with security vulnerabilities. You use this image to test and find issues. The following instructions show you how to use a precreated Metasploitable image. However, if a newer version of the Metasploitable image is needed, see [https://github.com/rapid7/metasploitable3](https://github.com/rapid7/metasploitable3).
64+
The Rapid7 Metasploitable image is an image purposely configured with security vulnerabilities. Use this image to test and find issues. The following instructions show you how to use a precreated Metasploitable image. However, if you need a newer version of the Metasploitable image, see [https://github.com/rapid7/metasploitable3](https://github.com/rapid7/metasploitable3).
6465

65-
To install Kali Linux and Metasploitable on the template VM, run the following command:
66+
- To install Kali Linux and Metasploitable on the template VM, run the following command:
6667

67-
```powershell
68-
Invoke-WebRequest ' https://aka.ms/azlabs/scripts/EthicalHacking-powershell' -Outfile Setup-EthicalHacking.ps1
69-
.\Setup-EthicalHacking.ps1 -SwitchName 'Default Switch'
70-
```
68+
```powershell
69+
Invoke-WebRequest ' https://aka.ms/azlabs/scripts/EthicalHacking-powershell' -Outfile Setup-EthicalHacking.ps1
70+
.\Setup-EthicalHacking.ps1 -SwitchName 'Default Switch'
71+
```
7172

7273
# [Windows tools](#tab/windows)
7374

@@ -79,85 +80,97 @@ Follow the instructions to [enable nested virtualization](how-to-enable-nested-v
7980

8081
Kali is a Linux distribution that includes tools for penetration testing and security auditing. To install the Kali nested VM on the template VM:
8182

82-
1. Connect to the template VM by using remote desktop.
83+
1. Connect to the template VM by using Remote Desktop.
84+
85+
1. Download the image from [Offensive Security Kali Linux VM images](https://www.kali.org/get-kali/#kali-virtual-machines). The default username and password are noted on the download page.
8386

84-
1. Download the image from [Offensive Security Kali Linux VM images](https://www.kali.org/get-kali/#kali-virtual-machines). Remember the default username and password are noted on the download page.
85-
1. Download the **Kali Linux Hyper-V 64-Bit (7z)** image for Hyper-V.
86-
1. Extract the .7z file. If you don’t already have 7-zip, download it from [https://www.7-zip.org/download.html](https://www.7-zip.org/download.html).
87+
1. Download the **Kali Linux Hyper-V 64-Bit (7z)** image for Hyper-V.
88+
1. Extract the .7z file. If you don’t already have 7-zip, download it from [https://www.7-zip.org/download.html](https://www.7-zip.org/download.html).
8789

88-
1. Follow the instructions to [import a premade Kali Linux image](https://www.kali.org/docs/virtualization/import-premade-hyperv/) into Hyper-V.
90+
1. Follow the instructions to [import a premade Kali image](https://www.kali.org/docs/virtualization/import-premade-hyperv/) into Hyper-V.
8991

90-
1. The Kali-Linux image is now ready for use. From **Hyper-V Manager**, choose **Action** -> **Start**, then choose **Action** -> **Connect** to connect to the virtual machine. The default username is `kali` and the password is `kali`.
92+
1. The Kali image is now ready for use. From **Hyper-V Manager**, choose **Action** > **Start**, then choose **Action** > **Connect** to connect to the virtual machine. The default username is `kali` and the password is `kali`.
9193

9294
### Set up a nested VM with Metasploitable image
9395

94-
The Rapid7 Metasploitable image is an image purposely configured with security vulnerabilities. You use this image to test and find issues. The following instructions show you how to use a precreated Metasploitable image. However, if a newer version of the Metasploitable image is needed, see [https://github.com/rapid7/metasploitable3](https://github.com/rapid7/metasploitable3).
96+
The Rapid7 Metasploitable image is an image purposely configured with security vulnerabilities. Use this image to test and find issues. The following instructions show you how to set up a particular Metasploitable image. If you need a newer version of the Metasploitable, see [https://github.com/rapid7/metasploitable3](https://github.com/rapid7/metasploitable3).
9597

9698
To install the Metasploitable nested VM on the template VM:
9799

98-
1. Connect to the template VM by using remote desktop.
100+
1. Connect to the template VM by using Remote Desktop.
99101

100102
1. Download the Metasploitable image.
101-
1. Navigate to [https://information.rapid7.com/download-metasploitable-2017.html](https://information.rapid7.com/download-metasploitable-2017.html). Fill out the form to download the image and select the **Submit** button.
102103

103-
> [!NOTE]
104-
> You can check for newer versions of the Metasploitable image at [https://github.com/rapid7/metasploitable3](https://github.com/rapid7/metasploitable3).
104+
1. Navigate to [https://information.rapid7.com/download-metasploitable-2017.html](https://information.rapid7.com/download-metasploitable-2017.html). Fill out the form to download the image and select the **Submit** button.
105105

106-
2. Select the **Download Metasploitable Now** button.
107-
3. When the download finishes, extract the zip file, and remember the location of the *Metasploitable.vmdk* file.
106+
> [!NOTE]
107+
> You can check for newer versions of the Metasploitable image at [https://github.com/rapid7/metasploitable3](https://github.com/rapid7/metasploitable3).
108+
109+
1. Select **Download Metasploitable Now**.
110+
1. When the download finishes, extract the zip file, and remember the location of the *Metasploitable.vmdk* file.
108111

109112
1. Convert the extracted vmdk file to a Hyper-V vhdx file with StarWind V2V Converter.
110-
1. Download and install [StarWind V2V Converter](https://www.starwindsoftware.com/starwind-v2v-converter#download).
111-
1. Start **StarWind V2V Converter**.
112-
1. On the **Select location of image to convert** page, choose **Local file**. Select **Next**.
113-
1. On the **Source image** page, navigate to and select the Metasploitable.vmdk extracted in the previous step for the **File name** setting. Select **Next**.
114-
1. On the **Select location of destination image**, choose **Local file**. Select **Next**.
115-
1. On the **Select destination image format** page, choose **VHD/VHDX**. Select **Next**.
116-
1. On the **Select option for VHD/VHDX image format** page, choose **VHDX growable image**. Select **Next**.
117-
1. On the **Select destination file name** page, accept the default file name. Select **Convert**.
118-
1. On the **Converting** page, wait for the image to be converted. Conversion can take several minutes. Select **Finish** when the conversion is completed.
113+
114+
1. Download and install [StarWind V2V Converter](https://www.starwindsoftware.com/starwind-v2v-converter#download).
115+
1. Start **StarWind V2V Converter**.
116+
1. On the **Select the location of image to convert** page, choose **Local file**. Select **Next**.
117+
1. On the **Source image** page, navigate to and select *Metasploitable.vmdk* extracted in the previous step for the **File name** setting. Select **Next**.
118+
1. On the **Select the location of destination image**, choose **Local file**. Select **Next**.
119+
1. On the **Select destination image format** page, choose **VHD/VHDX**. Select **Next**.
120+
1. On the **Select option for VHD/VHDX image format** page, choose **VHDX growable image**. Select **Next**.
121+
1. On the **Select destination file name** page, accept the default file name. Select **Convert**.
122+
1. On the **Converting** page, wait for the image to be converted. Conversion can take several minutes. Select **Finish** when the conversion is completed.
119123

120124
1. Create a new Hyper-V virtual machine.
121-
1. Open **Hyper-V Manager**.
122-
1. Choose **Action** -> **New** -> **Virtual Machine**.
123-
1. On the **Before You Begin** page of the **New Virtual Machine Wizard**, select **Next**.
124-
1. On the **Specify Name and Location** page, enter **Metasploitable** for the **name**, and select **Next**.
125-
:::image type="content" source="./media/class-type-ethical-hacking/new-vm-wizard-1.png" alt-text="Screenshot of New Virtual Machine Wizard in Hyper V.":::
126-
1. On the **Specify Generation** page, accept the defaults, and select **Next**.
127-
1. On the **Assign Memory** page, enter **512 MB** for the **startup memory**, and select **Next**.
128-
:::image type="content" source="./media/class-type-ethical-hacking/assign-memory-page.png" alt-text="Screenshot of Assign Memory page of New Virtual Machine Wizard in Hyper V.":::
129-
1. On the **Configure Networking** page, leave the connection as **Not Connected**. You'll set the network adapter later.
130-
1. On the **Connect Virtual Hard Disk** page, select **Use an existing virtual hard disk**. Browse to the location for the **metasploitable.vhdx** file created in the previous step, and select **Next**.
131-
:::image type="content" source="./media/class-type-ethical-hacking/connect-virtual-network-disk.png" alt-text="Screenshot of Connect Virtual Hard Disk page of New Virtual Machine Wizard in Hyper V.":::
132-
1. On the **Completing the New Virtual Machine Wizard** page, and select **Finish**.
133-
1. Once the virtual machine is created, select it in the Hyper-V Manager. Don't turn on the machine yet.
134-
1. Choose **Action** -> **Settings**.
135-
1. On the **Settings for Metasploitable** dialog for, select **Add Hardware**.
136-
1. Select **Legacy Network Adapter**, and select **Add**.
137-
:::image type="content" source="./media/class-type-ethical-hacking/network-adapter-page.png" alt-text="Screenshot of settings dialog for Hyper V VM.":::
138-
1. On the **Legacy Network Adapter** page, select **Default Switch** for the **Virtual Switch** setting, and select **OK**.
139-
:::image type="content" source="./media/class-type-ethical-hacking/legacy-network-adapter-page.png" alt-text="Screenshot of Legacy Network adapter settings page for Hyper V VM.":::
140-
1. The Metasploitable image is now ready for use. From **Hyper-V Manager**, choose **Action** -> **Start**, then choose **Action** -> **Connect** to connect to the virtual machine. The default username is `msfadmin` and the password is `msfadmin`.
125+
126+
1. Open **Hyper-V Manager**.
127+
1. Choose **Action** > **New** > **Virtual Machine**.
128+
1. On the **Before You Begin** page of the **New Virtual Machine Wizard**, select **Next**.
129+
1. On the **Specify Name and Location** page, enter **Metasploitable** for the **name**, and select **Next**.
130+
131+
:::image type="content" source="./media/class-type-ethical-hacking/new-vm-wizard-1.png" alt-text="Screenshot of New Virtual Machine Wizard in Hyper V.":::
132+
133+
1. On the **Specify Generation** page, accept the defaults, and select **Next**.
134+
1. On the **Assign Memory** page, enter **512 MB** for the **startup memory**, and select **Next**.
135+
136+
:::image type="content" source="./media/class-type-ethical-hacking/assign-memory-page.png" alt-text="Screenshot of Assign Memory page of New Virtual Machine Wizard in Hyper V.":::
137+
138+
1. On the **Configure Networking** page, leave the connection as **Not Connected**. Set the network adapter later.
139+
1. On the **Connect Virtual Hard Disk** page, select **Use an existing virtual hard disk**. Browse to the location for the *Metasploitable.vhdx* file in the previous step, and select **Next**.
140+
141+
:::image type="content" source="./media/class-type-ethical-hacking/connect-virtual-network-disk.png" alt-text="Screenshot of Connect Virtual Hard Disk page of New Virtual Machine Wizard in Hyper V.":::
142+
143+
1. On the **Completing the New Virtual Machine Wizard** page, and select **Finish**.
144+
1. After the virtual machine is created, select it in the Hyper-V Manager. Don't turn on the VM yet.
145+
1. Choose **Action** > **Settings**.
146+
1. On the **Settings for Metasploitable** page, select **Add Hardware**.
147+
1. Select **Legacy Network Adapter**, and select **Add**.
148+
149+
:::image type="content" source="./media/class-type-ethical-hacking/network-adapter-page.png" alt-text="Screenshot of settings dialog for Hyper V VM.":::
150+
151+
1. On the **Legacy Network Adapter** page, select **Default Switch** for the **Virtual Switch** setting, and select **OK**.
152+
153+
:::image type="content" source="./media/class-type-ethical-hacking/legacy-network-adapter-page.png" alt-text="Screenshot of Legacy Network adapter settings page for Hyper V VM.":::
154+
155+
1. The Metasploitable image is now ready for use. From **Hyper-V Manager**, choose **Action** > **Start**, then choose **Action** > **Connect** to connect to the virtual machine. The default username is `msfadmin` and the password is `msfadmin`.
141156

142157
---
143158

144159
The template is now updated and has the nested VM images needed for an ethical hacking penetration testing class: an image with tools to do the penetration testing, and another image with security vulnerabilities to discover. You can now [publish the template VM](how-to-create-manage-template.md#publish-the-template-vm) to the class.
145160

146-
## Cost
161+
## Estimate cost
147162

148163
If you would like to estimate the cost of this lab, you can use the following example:
149164

150165
For a class of 25 students with 20 hours of scheduled class time and 10 hours of quota for homework or assignments, the price for the lab would be:
151166

152167
25 students \* (20 + 10) hours \* 55 Lab Units \* 0.01 USD per hour = 412.50 USD
153168

154-
>[!IMPORTANT]
155-
>This cost estimate is for example purposes only. For current details on pricing, see [Azure Lab Services Pricing](https://azure.microsoft.com/pricing/details/lab-services/).
169+
> [!IMPORTANT]
170+
> This cost estimate is for example purposes only. For current details on pricing, see [Azure Lab Services Pricing](https://azure.microsoft.com/pricing/details/lab-services/).
156171
157-
## Conclusion
172+
## Related content
158173

159174
In this article, you went through the steps to create a lab for ethical hacking class. The lab VM contains two nested virtual machines to practice penetrating testing.
160175

161-
## Next steps
162-
163176
[!INCLUDE [next steps for class types](./includes/lab-services-class-type-next-steps.md)]

0 commit comments

Comments
 (0)