Welcome to the Linux Command Line Capture The Flag (CTF) lab on Microsoft Azure! This project sets up a learning environment where you can practice your Linux command line skills by solving various challenges.
Before you begin, ensure you have the following installed and configured on your local machine:
If you leave this lab running, it's going to cost you $8/month, as it is running Standard B1s
VM in Azure. Use the terraform destroy
command to clean resources, once completed with CTFs.
Note
You might encounter an error, if your Azure account is a Student account, please look at this work aroud.
Follow these steps to set up and access your CTF lab environment:
-
Clone this repository to your local machine:
git clone https://github.com/learntocloud/ltc-linux-challenge cd ltc-linux-challenge/azure
-
Log in to Azure using the Azure CLI:
az login
-
Initialize Terraform:
terraform init
-
Apply the Terraform configuration:
terraform apply -var="az_region=YOUR_AZURE_REGION"
Replace
YOUR_AZURE_REGION
with Azure Region that you want to use, by default it uses East US.When prompted, type
yes
to confirm. -
After the apply completes, note the
public_ip_address
output. You'll use this to connect to your lab environment.
To access your lab environment:
-
Use SSH to connect to the Azure VM as the CTF user:
ssh ctf_user@<public_ip_address>
-
When prompted for a password, enter:
CTFpassword123!
-
Once logged in, you'll see a welcome message with instructions for your first challenge.
Note: There's also an admin user azureuser
with password CTFAdminPassword123!
, but you should use the ctf_user
account for the challenges.
Your CTF lab consists of 7 challenges, each testing different Linux command line skills. The challenges are:
- Find a hidden file
- Locate a file with "secret" in its name
- Find the largest file in a specific directory
- Identify a user with a specific UID
- Locate a file with specific permissions
- Find a process running on a specific port
- Decode a base64 encoded message
Work through these challenges to improve your command line skills and find all the flags!
When you're done with the lab, don't forget to destroy the Azure resources to avoid unnecessary charges:
terraform destroy
Type yes
when prompted to confirm.
This lab is designed for learning purposes and uses password-based login for simplicity. In real-world scenarios, key-based authentication is recommended for better security.
If you encounter any issues:
- Ensure your Azure CLI is correctly installed and configured.
- Check that you're using a compatible Terraform version.
- Verify that you have the necessary Azure permissions to create the required resources.
- If you can't log in immediately after creating the VM, wait a few minutes for the startup script to complete.
If problems persist, please open an issue in this repository.
Happy learning, and good luck with your CTF challenges!