Secure GitOps TryHackMe Walkthrough

Sunny Singh Verma
6 min readAug 20, 2024

--

This room was created today — 20th August 2024 and is available for TryHackMe Subscribers only . So you need to have a Premium subscription for this room .

Link to the TryHackMe Room : https://tryhackme.com/r/room/securegitops

You should also check out the Recommended Pre-Requisites for this room provided by the creator of this room .

Room Difficulty : Easy

Kudos to the room creators :

Room Objectives : Total of 5 Tasks to be completed

Task Number 1

The Task number 1 is an introduction and PreRequisites , which you can give it a read before proceeding :

Task 2

Task 2 talks about the fundamental concepts of the GitOps Framework .

Screenshot taken from TryHackme Room’s Module
Screenshot taken from TryHackme Room’s Module

In today’s rapidly evolving DevOps landscape, secure and efficient deployment practices are more critical than ever. GitOps has emerged as a transformative set of practices that streamline deployment workflows while maintaining a robust security posture. In this walkthrough, we will explore the foundational concepts of GitOps, its framework, and the tools that make it a powerful approach to infrastructure and application deployment.

Question 1: What tool apart from Flux, is commonly used in GitOps?

Apart from Flux, Argo CD is commonly used in GitOps. Both tools help automate the deployment process by continuously monitoring Git repositories and ensuring that the actual state of the system matches the desired state defined in Git.

The answer can be found in the information provided in the module for the Task 2

Question 2 : What type of configuration does GitOps have?

GitOps uses declarative configuration. This means that the desired state of the system is explicitly defined and stored in a Git repository, ensuring transparency, consistency, and ease of management.

The answer can be found in the section below :

Task 2 Complete !

Task 3 :

Screenshots taken from TryHackMe Room : Secure GitOps

Question 1 : What acts as an execution engine for GitOps?

In the context of GitOps, Kubernetes acts as the execution engine. Kubernetes manages the deployment, scaling, and operation of application containers, and in a GitOps workflow, it executes the desired state defined in the Git repository. Tools like Argo CD or Flux interface with Kubernetes to ensure that the actual state of the system matches the desired state. Kubernetes, therefore, serves as the platform that executes the deployment and management of applications and infrastructure in a GitOps model.

The Answer can be found in Kubernetes (K8s) Role in GitOps Deployment section

Question 2: What feature does Argo CD have to sync git repositories whenever there are changes?

Argo CD has a feature called Automated Sync or Auto-Sync that allows it to automatically synchronize Git repositories whenever changes are detected. When enabled, Argo CD continuously monitors the Git repository and automatically applies the changes to the cluster, ensuring that the live state matches the desired state defined in the Git repository. This feature is key for maintaining up-to-date deployments without manual intervention

The answer can be found in this section :

Task 3 Complete !

Task 4 :

Question : What can you implement to improve the security of containerised applications?

To improve the security of containerized applications, you can implement Security Contexts in Kubernetes. A Security Context allows you to define security-related configurations for containers and pods.

The answer can be Found in this section :

Task 4 Complete !

Task 5 :

Before Proceeding with the Next and final Task , we need to fire up the machine and login to the said port number :

Login Credentials and Login details are provided :

Your IP address could be different than mine here but the login port will remain same

So in this walkthrough we are going to use the TryHackMe’s Attackbox

Let’s login to the page : http://YOUR-IP:8443

We see the dashboard after logging in

Question 1 : What status shows if the resource is in sync with the Git repository?

The question above asks us to show the status of the resource when in sync with the Git Repo. as we see the current state is out of sync

Lets now synchronize !

Now after the sync is turned on , we see the status is changed

Question 1 : Done !

Question 2: What security context ensures the container is not running as root?

as we go up a bit we can see our answer

Question 2 Done !

Question 3: What security context can specify a profile to restrict syscalls to the container?

The reference for the question 2 and question 3 will remain the same

Question 3 Done !

Question 4: What is the kernel version of the minikube node?

There is not much to find even after exploring the whole

Let’s check the hint :

After Playing around with different View types we finally find our answer for the Question 4

After switching to different view types :

We Found our answer in the second view type option :

Question 5: What are the first 7 characters of the commit ID that it was synced to?

If we look closely , while solving question 4 , we also solved question 5 as the answer for question 5 was also there :

Commit ID :  a22f5a6d9aad0c0d2b785692ebcd67db77d71945

We can count the first 7 characters and solve the Question 5 as well !

Task 5 Complete !

This was an easy and a very informative Room about GitOps ,
Hope you liked this TryHackMe Walkthrough ,

if you did you can add a clap to this article to let me know .
You can also follow me on medium to get more articles about CTFs and Cybersecurity in the near Future

Thank you !
SuNnY

--------------(・SSV・)-------------

★〓★〓★〓★〓★〓★〓★〓★〓★〓★〓★〓★〓★〓★〓★〓★〓★〓★

#tryhackme #thm #walkthrough #SecureGitOps #SecureGitOpsTryhackme ##SecureGitOpswalkthrough

--

--

Sunny Singh Verma

Blogger & Cyber Security Enthusiast || TryHackMe Wall of Fame - in Top 50 Ethical Hackers Worldwide || HTB-Elite Hacker || Follow for Cyber World & CTF updates!