How to Secure Your Penetration Testing Environment with Full Disk Encryption

By Red Siege | September 3, 2024

by Douglas Berdeaux, Senior Security Consultant

 

As penetration testers, ensuring the security and integrity of our tools and data is paramount. One key aspect of this is creating a secure “gold image”—a master copy of an operating system that we use as a base for all assessments. In this blog, I’ll guide you through setting up a fully encrypted Linux environment in a virtualized setting, specifically designed for penetration testing. This process will cover creating a gold image, encrypting the filesystem, and configuring logical volumes. Let’s dive in!

Why Use a Gold Image?

A gold image is a standardized template for deploying virtual machines (VMs). It’s continuously updated with the latest tools, custom scripts, and configurations, ensuring consistency across all testing environments. However, this image is never directly used in assessments. Instead, we create a linked clone from this gold image for each new engagement. This clone acts as a secure, isolated container for client data, ensuring each assessment remains separate and protected.

Importance of Encryption

Encrypting the entire filesystem of our gold image is crucial. Let’s consider a scenario: you’re conducting an on-site assessment, and your laptop gets stolen while you’re momentarily away. Even with a locked host OS, a determined attacker could boot up your VM or mount its virtual disk, potentially accessing sensitive client data. By encrypting the VM’s filesystem, we add a vital layer of security that safeguards data, even if the device falls into the wrong hands.

Encryption also helps maintain compliance with industry standards and regulations. Data breaches resulting from unencrypted storage can lead to significant financial and reputational damage. As penetration testers, we must ensure our practices do not introduce additional risks to our clients.

Tools and Technologies

For this setup, we’ll be using:

  1. Debian Linux (Debian 12 “Bookworm”): A stable, widely-used Linux distribution that offers robust encryption options.
  2. VMware Workstation: A reliable hypervisor for creating and managing virtual machines.
  3. LUKS (Linux Unified Key Setup): A standard for Linux disk encryption that provides a secure way to encrypt partitions.

Setting Up the Encrypted Gold Image

Step 1: Preparing the Environment
  1. Download Debian 12: Get the latest Debian ISO from the official Debian website. We’ll be using the NetInstall image.
  2. Create a New VM in VMware:
    • Allocate at least 100 GB of disk space, 8 GB of RAM, and 4 CPUs.
    • Set the Debian ISO as the boot image and start the VM using the graphical installer.
Step 2: Basic Configuration
  1. Language and Keyboard Setup: Choose your preferred language and keyboard layout.
  2. Hostname and Domain Name: Set a unique hostname for the VM. For the domain name, it can be left blank unless you have a specific domain for your network.
  3. User Configuration: Create a user account with sudo access and leave the root password blank to disable root login via SSH.
Step 3: Disk Partitioning and Encryption
  1. Manual Partitioning:
    • Start by creating a new partition table on the virtual disk.
    • Create a small 2 GB partition for /boot using the ext2 filesystem. This partition remains unencrypted to allow the system to boot.
  2. Create Encrypted Volume:
    • Use the remaining disk space to create a logical partition.
    • Configure this partition as a physical volume for encryption. LUKS will handle the encryption using AES-256.
Step 4: Setting Up Logical Volumes
  1. Configure Encrypted Volumes: After encrypting the partition, proceed to set up Logical Volume Manager (LVM).
  2. Create Logical Volumes:
    • Create a Volume Group (VG) named pentestvmvg.
    • Within this VG, create logical volumes for different directories: /root, /var, /tmp, /home, and swap. Allocate space according to your needs:
      • /root: 40 GB for penetration testing tools and environments.
      • /var: 10 GB for server logs and other data.
      • /tmp: 5 GB for temporary files.
      • swap: 10 GB for swap space, ensuring that it’s also encrypted.
      • /home: Use the remaining space.
Step 5: Finalizing the Installation
  1. Set Filesystem Types and Mount Points: Assign ext4 as the filesystem for each logical volume and set appropriate mount points (/, /var, /tmp, /home, and swap for swap area).
  2. Install the Base System: Proceed with the installation, selecting necessary software packages and configuring the GRUB bootloader on /dev/sda.
Step 6: Post-Installation Configuration
  1. Change LUKS Passphrase: Once the system is up, it’s wise to change the LUKS passphrase. You can do this using cryptsetup luksChangeKey.
  2. System Hardening: Apply additional hardening measures as per your organizational policies, such as disabling unnecessary services, configuring firewall rules, and setting up automatic updates.

Conclusion

By following this guide, you’ve created a secure, fully encrypted gold image tailored for penetration testing. This setup not only protects sensitive data but also ensures compliance with security standards, providing peace of mind for both you and your clients. Remember, security is an ongoing process—always update your tools, review your configurations, and adapt to new threats.

Happy testing!


About Douglas Berdeaux, Senior Security Consultant

Douglas was a manager of a Red Team for a consulting company and has performed penetration testing for clients with high security maturity on internal networks, internal and externally facing web applications, and desktop applications. Douglas was a full-stack enterprise-class web developer for close to a decade building, securing, and testing the security of business-critical web and mobile applications. He has taught cybersecurity as an adjunct professor for Duquesne University and has published multiple books and articles about penetration testing, hardware hacking, and programming.

Certifications:

OSWP, OSCP

DigDug: Making Your Payload Too Big to Scan

By Red Siege | November 5, 2026

by Jason Downey This is Dig Dug. A Red Siege tool for avoiding av/edr can offer valuable solutions for penetration testers and red teamers. If you spend any amount of […]

Learn More
DigDug: Making Your Payload Too Big to Scan

Trust, But Verify: What Clients Should Know Before a Mobile Application Assessment

By Red Siege | October 5, 2026

by Stuart Rorer Most weeks, the tests I run are fairly routine: web applications, externals, and internals with a tight scope. But mobile application assessments have a way of getting […]

Learn More
Trust, But Verify: What Clients Should Know Before a Mobile Application Assessment

This is not the Access Policy you’re looking for

By Red Siege | October 1, 2026

by Mike Saunders The AWS ReadOnlyAccess policy might be providing more access than you’re intending to grant. On a recent assessment, we observed widespread use of IAM roles with the […]

Learn More
This is not the Access Policy you’re looking for

Find Out What’s Next

Stay in the loop with our upcoming events.