Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1cbcf35

Browse files
committedOct 4, 2019
Class type - Ethical hacking
1 parent 3827599 commit 1cbcf35

14 files changed

+221
-0
lines changed
 

‎articles/lab-services/TOC.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@
7878
href: classroom-labs/class-type-deep-learning-natural-processing.md
7979
- name: Shell scripting on Linux
8080
href: classroom-labs/class-type-shell-scripting-linux.md
81+
- name: Ethical hacking
82+
href: classroom-labs/class-type-ethical-hacking.md
8183
- name: Classroom labs
8284
items:
8385
- name: Create and configure lab accounts (lab account owner)
@@ -90,6 +92,8 @@
9092
href: classroom-labs/how-to-connect-peer-virtual-network.md
9193
- name: Attach or detach a shared image gallery
9294
href: classroom-labs/how-to-attach-detach-shared-image-gallery.md
95+
- name: Enable nested virtualization on a template VM
96+
href: classroom-labs/how-to-enable-nested-virtualization-template-vm.md
9397
- name: Create and configure classroom labs (instructor)
9498
items:
9599
- name: Create and manage classroom labs
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
---
2+
title: Set up an Ethical Hacking lab with Azure Lab Services | Microsoft Docs
3+
description: Learn how to set up a lab using Azure Lab Services to teach ethical hacking.
4+
services: lab-services
5+
documentationcenter: na
6+
author: spelluru
7+
manager:
8+
editor: ''
9+
10+
ms.service: lab-services
11+
ms.workload: na
12+
ms.tgt_pltfrm: na
13+
ms.devlang: na
14+
ms.topic: article
15+
ms.date: 10/04/2019
16+
ms.author: spelluru
17+
18+
---
19+
20+
# Set up a lab to teach shell scripting on Linux
21+
This article shows you how to set up a class that focuses on forensics side of ethical hacking. Penetration testing, a practice used by the ethical hacking community, occurs when someone attempts to gain access to the system or network to demonstrate vulnerabilities that a malicious attacker may exploit.
22+
23+
In an ethical hacking class, students can learn modern techniques for defending against vulnerabilities. Each student gets a Windows Server host virtual machine that has two nested virtual machines – one virtual machine with **Metaspoiltable** image and another machine with [Kali Linux](https://www.kali.org/) image. The Metasploitable virtual machine is used for exploiting purposes and Kali virtual machine provides access to the tools needed to execute forensic tasks.
24+
25+
This article has two main sections. The first section covers how to create the classroom 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.
26+
27+
## Lab configuration
28+
To set up this lab, you need an Azure subscription to get started. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/) before you begin. Once you get an Azure subscription, you can either create a new lab account in Azure Lab Services or use an existing account. See the following tutorial for creating a new lab account: [Tutorial to setup a lab account](tutorial-setup-lab-account.md).
29+
30+
Follow [this tutorial](tutorial-setup-classroom-lab.md) to create a new lab and then apply the following settings:
31+
32+
| Virtual machine size | Image |
33+
| -------------------- | ----- |
34+
| Medium (Nested Virtualization) | Windows Server 2019 Datacenter |
35+
36+
## Template machine
37+
38+
After the template machine is created, start the machine and connect to it to complete the following three major tasks.
39+
40+
1. Set up the machine for nested virtualization. It enables all the appropriate windows features, like Hyper-V, and sets up the networking for the Hyper-V images to be able to communicate with each other and the internet.
41+
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.
42+
3. Set up the Metasploitable image. For this example, the [Metasploitable3](https://github.com/rapid7/metasploitable3) image will be used. This image is created to purposely have security vulnerabilities.
43+
44+
![Overall image](../media/class-type-ethical-hacking/overall-image.png)
45+
46+
### Prepare template machine for nested virtualization
47+
Follow instructions in [this article](how-to-enable-netsted-virtualization-template-vm.md) to prepare your template virtual machine for nested virtualization.
48+
49+
### Set up a nested virtual machine with Kali Linux Image
50+
Kali is a Linux distribution that includes tools for penetration testing and security auditing.
51+
52+
1. Download image from [https://www.offensive-security.com/kali-linux-vm-vmware-virtualbox-image-download/](https://www.offensive-security.com/kali-linux-vm-vmware-virtualbox-image-download/).
53+
1. Download the **Kali Linux Hyper-V 64 Bit** for Hyper-V.
54+
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). Remember the location of the extracted folder as you'll need it later.
55+
2. Open **Hyper-V Manager** from Administrative Tools.
56+
1. Select **Action**, and then select **Import Virtual Machine**.
57+
1. On the **Locate Folder** page of the **Import Virtual Machine** wizard, choose the location of the extracted folder that holds the Kali Linux image.
58+
59+
![Locate Folder dialog](../media/class-type-ethical-hacking/locate-folder.png)
60+
1. On the **Select Virtual Machine** page, select the Kali Linux image. In this case, the image is **kali-linux-2019.3-hyperv**.
61+
62+
![Select Kali image](../media/class-type-ethical-hacking/select-kali-image.png)
63+
1. On the **Choose Import Type** page, select **Copy the virtual machine (create a new unique ID)**.
64+
65+
![Choose import type](../media/class-type-ethical-hacking/choose-import-type.png)
66+
1. Accept the default settings on **Choose Folders for Virtual Machine Files** and **Choose Folders to Store Virtual Hard Disks** pages, and then select **Next**.
67+
1. On the **Connect Network** page, choose **LabServicesSwitch** created earlier in the **Prepare Template for Nested Virtualization** section of this article, and then select **Next**.
68+
69+
![Connect network page](../media/class-type-ethical-hacking/connect-network.png)
70+
1. Select **Finish** on the **Summary** page. Wait until copy and importing operations are completed. The Kali Linux virtual machine will now be available in Hyper-V.
71+
1. From **Hyper-V Manager**, choose **Action** -> **Start**, then choose **Action** -> **Connect** to connect to the virtual machine.
72+
12. The default username is `root` and the password is `toor`.
73+
74+
> [!NOTE]
75+
> If you need to unlock the image, press the CTRL key and drag the mouse upwards.
76+
77+
## Set up a nested virtual machine with Metasploitable Image
78+
The Rapid7 Metasploitable image is an image purposely configured with security vulnerabilities. You'll use this image to test and find issues. The following instructions show you how to use a pre-created Metasploitable image. However, if a newer version of the Metasploitable image is needed, see [https://github.com/rapid7/metasploitable3](https://github.com/rapid7/metasploitable3).
79+
80+
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.
81+
1. Select the **Download Metasploitable Now** button.
82+
1. When the zip file is downloaded, extract the zip file, and remember the location.
83+
1. Convert the extracted vmdk file to a vhdx file so that you can use with Hyper-V. To do so, open PowerShell with administrative privileges and navigate to the folder where the vmdk file resides, and follow these instructions:
84+
1. Download the [Microsoft Virtual Machine Converter](https://www.microsoft.com/download/details.aspx?id=42497), and run mvmc_setup.msi file when prompted.
85+
1. Import the PowerShell module. The default location in which the module is installed is C:\Program Files\Microsoft Virtual Machine Converter\
86+
87+
```powershell
88+
Import-Module 'C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1'
89+
```
90+
1. Convert the vmdk to a vhd file that can be used by Hyper-V. This operation may take several minutes.
91+
92+
```powershell
93+
ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath .\Metasploitable.vmdk -DestinationLiteralPath .\Metasploitable.vhdx -VhdType DynamicHardDisk -VhdFormat vhdx
94+
```
95+
1. Copy the newly created metasploitable.vhdx to C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\.
96+
1. Create a new Hyper-V virtual machine.
97+
1. Open **Hyper-V Manager**.
98+
1. Choose **Action** -> **New** -> **Virtual Machine**.
99+
1. On the **Before You Begin** page of the **New Virtual Machine Wizard**, click **Next**.
100+
1. On the **Specify Name and Location** page, enter **Metasploitable** for the **name**, and select **Next**.
101+
102+
![New VM image wizard](../media/class-type-ethical-hacking/new-vm-wizard-1.png)
103+
1. On the **Specify Generation** page, accept the defaults, and select **Next**.
104+
1. On the **Assign Memory** page, enter **512 MB** for the **startup memory**, and select **Next**.
105+
106+
![Assign memory page](../media/class-type-ethical-hacking/assign-memory-page.png)
107+
1. On the **Configure Networking** page, leave the connection as **Not Connected**. You'll set up the network adapter later.
108+
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**.
109+
110+
![Connect virtual network disk page](../media/class-type-ethical-hacking/connect-virtual-network-disk.png)
111+
1. On the **Completing the New Virtual Machine Wizard** page, and select **Finish**.
112+
1. Once the virtual machine is created, select it in the Hyper-V Manager. Don't turn on the machine yet.
113+
1. Choose **Action** -> **Settings**.
114+
1. On the **Settings for Metasploitable** dialog for, select **Add Hardware**.
115+
1. Select **Legacy Network Adapter**, and select **Add**.
116+
117+
![Network adapter page](../media/class-type-ethical-hacking/network-adapter-page.png)
118+
1. On the **Legacy Network Adapter** page, select **LabServicesSwitch** for the **Virtual Switch** setting, and select **OK**. LabServicesSwitch was created when preparing the template machine for Hyper-V in the **Prepare Template for Nested Virtualization** section.
119+
120+
![Legacy Network adapter page](../media/class-type-ethical-hacking/legacy-network-adapter-page.png)
121+
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**.
122+
123+
124+
The template is now updated and has 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. The template image can now be published to the class. Select the **Publish** button on template page to publish the template to the lab.
125+
126+
127+
## Cost
128+
If you would like to estimate the cost of this lab, you can use the following example:
129+
130+
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: 25 students * (20 + 10) hours * 55 Lab Units * 0.01 USD per hour = 412.50. FOr more details on pricing, see [Azure Lab Services Pricing](https://azure.microsoft.com/pricing/details/lab-services/).
131+
132+
## Conclusion
133+
This article walked you through the steps to create a lab for ethical hacking class. It includes steps to set up nested virtualization for creating two virtual machines inside the host virtual machine for penetrating testing.
134+
135+
## Next steps
136+
Next steps are common to setting up any lab:
137+
138+
- [Add users](tutorial-setup-classroom-lab.md#add-users-to-the-lab)
139+
- [Set quota](tutorial-setup-classroom-lab.md#set-quotas-for-users)
140+
- [Set a schedule](tutorial-setup-classroom-lab.md#set-a-schedule-for-the-lab)
141+
- [Email registration links to students](tutorial-setup-classroom-lab.md#send-an-email-with-the-registration-link).
142+
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
title: Enable nested virtualization on a template VM in Azure Lab Services | Microsoft Docs
3+
description: Learn how to Enable nested virtualization on a template VM in Azure Lab Services.
4+
services: lab-services
5+
documentationcenter: na
6+
author: spelluru
7+
manager:
8+
editor: ''
9+
10+
ms.service: lab-services
11+
ms.workload: na
12+
ms.tgt_pltfrm: na
13+
ms.devlang: na
14+
ms.topic: article
15+
ms.date: 10/04/2019
16+
ms.author: spelluru
17+
18+
---
19+
# Enable nested virtualization on a template virtual machine in Azure Lab Services
20+
This article covers how to set up nested virtualization on a template virtual machine in Azure Lab Services. Nested virtualization is used in Azure Lab Services when each student in a class requires multiple machines.
21+
22+
## Considerations
23+
Before setting up a lab with nested virtualization, here are a few things to take into consideration.
24+
25+
1. When creating a new lab, select **Medium (Nested Virtualization)** or **Large** sizes for the virtual machine size. These virtual machine sizes support nested virtualization.
26+
1. Choose a size that will provide good performance for both the host and client virtual machines. Remember, when using virtualization, the size you choose must be adequate for not just one machine, but the host as well as any client machines that must be run concurrently.
27+
1. Client virtual machines will not have access to Azure resources, such as DNS servers on the Azure virtual network.
28+
1. Host virtual machine requires setup to allow for the client machine to have internet connectivity.
29+
1. Client virtual machines are licensed as independent machines. See [Microsoft Licensing](https://www.microsoft.com/licensing/default) for information about licensing for Microsoft operation systems and products. Check licensing agreements for any other software being used before setting up the template machine.
30+
31+
## Set up a template VM to enable nested virtualization
32+
The steps in this section focus on setting up nested virtualization for Windows Server 2016 or Windows Server 2019. You will use a script to set up template machine with Hyper-V. For an automated solution, see scripts at [Lab Services Hyper-V Scripts](https://github.com/Azure/azure-devtestlab/tree/master/samples/ClassroomLabs/Scripts/HyperV). The following steps will walk you through how to use the script.
33+
34+
1. If you're using Internet Explorer, you may have to add `https://github.com` to the trusted sites list.
35+
1. Open Internet Explorer.
36+
1. Select the gear icon, and choose **Internet options**.
37+
1. When the **Internet Options** dialog appears, select **Security**, select **Trusted Sites**, click **Sites** button.
38+
1. When the **Trusted sites** dialog appears, add `https://github.com` to the trusted websites list, and select **Close**.
39+
40+
![Trusted sites](../media/how-to-enable-nested-virtualization-template-vm/trusted-sites-dialog.png)
41+
1. Download the Git repository files as outlined in the following steps. Alternatively, the Git repository can be cloned from [https://github.com/Azure/azure-devtestlab.git](https://github.com/Azure/azure-devtestlab.git).
42+
1. Go to [https://github.com/Azure/azure-devtestlab/](https://github.com/Azure/azure-devtestlab/).
43+
1. Click the ***Clone or Download** button.
44+
1. Click **Download ZIP**.
45+
1. Extract the ZIP file
46+
1. Launch **PowerShell** in **Administrator** mode.
47+
1. In the PowerShell window, navigate to the folder with the downloaded script. If you're navigating from the top folder of the repository files, the script is located at `azure-devtestlab\samples\ClassroomLabs\Scripts\HyperV\`.
48+
1. You may have to change the execution policy to successfully run the script. Run the following command:
49+
50+
```powershell
51+
Set-ExecutionPolicy bypass -force
52+
```
53+
1. Run the script:
54+
55+
```powershell
56+
.\SetupForNestedVirtualization.ps1
57+
```
58+
59+
> [!NOTE]
60+
> The script may require the machine to be restarted. Follow instructions from the script and re-run the script until **Script completed** is seen in the output.
61+
1. Don’t forget to reset the execution policy. Run the following command:
62+
63+
```powershell
64+
Set-ExecutionPolicy default -force
65+
```
66+
67+
## Conclusion
68+
Now your template machine is ready to create Hyper-V virtual machines. See [Create a Virtual Machine in Hyper-V](/windows-server/virtualization/hyper-v/get-started/create-a-virtual-machine-in-hyper-v) for instructions on how to create Hyper-V virtual machines. Also, see [Microsoft Evaluation Center](https://www.microsoft.com/evalcenter/) to check out available operating systems and software.
69+
70+
## Next steps
71+
See the following articles:
72+
73+
- [How to enable nested virtualization in an Azure VM](../../virtual-machines/windows/nested-virtualization.md)
74+
- [Install the Hyper-V role on Windows Server](/windows-server/virtualization/hyper-v/get-started/install-the-hyper-v-role-on-windows-server)
75+
- [Lab Services Hyper-V scripts](https://github.com/Azure/azure-devtestlab/tree/master/samples/ClassroomLabs/Scripts/HyperV)
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.