Nmap/Short Course/Running the Labs: Difference between revisions
From charlesreid1
(Created page with "This page describes how to run the labs for this nmap short course. Notes for myself, but also for anyone who might be interested. =Overview= The aim is to provide students...") |
No edit summary |
||
| Line 1: | Line 1: | ||
This page describes how to run the labs for this nmap short course. Notes for myself, but also for anyone who might be interested. | This page describes how to run the labs for this nmap short course. Notes for myself, but also for anyone who might be interested. | ||
TODO: GitHub repo link | |||
=Overview= | =Overview= | ||
Revision as of 22:13, 26 May 2025
This page describes how to run the labs for this nmap short course. Notes for myself, but also for anyone who might be interested.
TODO: GitHub repo link
Overview
The aim is to provide students with a laboratory environment to supplement lectures about nmap and allow them the freedom to explore and learn in a structured and well-defined environment, so that they can focus on learning how to use their tools.
The environment we define will be entirely virtual, so that we can define 1 host or 10 or 50, all of them will run as virtual machines on one single server. We will use infrastructure as code to define the virtual network and the virtual hosts living on it, their software, their configuration, etc. All of this virtual infra will run on a large EC2 instance. (As large as budget allows.)
Students will be logging into a (virtual) bastion host inside the (virtual) network they will be exploring, all of which are hosted on the main EC2 instance (which must be accessible to students so that they can log into the bastion host).
The core idea is to use a single, reasonably powerful EC2 instance as the hypervisor and host for your entire virtual network. Inside this EC2 instance, we'll use a combination of Vagrant (with libvirt/KVM) for managing any full virtual machines (like an attacker machine or specific OS targets) and Docker/Docker Compose for deploying a variety of lightweight target services and "machines" (containers). Ansible will be the glue for configuring everything consistently.
Core Lab Infrastructure on EC2
EC2 Instance Choice:
- Operating System: Use a Linux distribution that supports KVM, such as Ubuntu Server LTS or Amazon Linux 2. Ubuntu Server often has more readily available documentation for tools like Vagrant with libvirt.
- Instance Type: You'll need an instance with sufficient vCPUs and RAM to run multiple VMs/containers. Start with something like a t3.xlarge (4 vCPUs, 16 GiB RAM) or m5.large/m5.xlarge (2-4 vCPUs, 8-16 GiB RAM). Monitor resource usage and adjust as needed. Ensure your chosen instance type supports nested virtualization if you plan to run VMs within VMs (though for this setup, KVM on the EC2 host is primary).
- Storage: Allocate sufficient EBS storage (SSD, e.g., gp3 for balanced performance and cost) for the OS, VM images, Docker images, and student data.
- Security Group:
- Allow SSH (port 22) from your IP and your students' IPs (or a bastion/VPN exit IP).
- If using a VPN hosted on this EC2, allow the VPN port (e.g., UDP 1194 for OpenVPN).
- Other ports should generally not be exposed directly to the internet; students will access target services from within the lab environment.
Virtualization Software Setup:
- KVM/QEMU & Libvirt: Install these on your EC2 host instance to enable running full virtual machines.