From 0ee1b074f2758df9919d47437caf67db42e50c34 Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Fri, 20 Jun 2025 07:34:57 +0000 Subject: [PATCH 01/21] Completed the k8s deployment resource --- Dep-def.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Dep-def.yaml diff --git a/Dep-def.yaml b/Dep-def.yaml new file mode 100644 index 0000000..bdd08bf --- /dev/null +++ b/Dep-def.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: sc-deployment + labels: + app: securitycheck + namespace: dev +spec: + replicas: 3 + template: + metadata: + name: sc-pod + labels: + app: securitycheck + spec: + containers: + - name: sc-container + image: us-central1-docker.pkg.dev/secure-air-461520-g7/juneserver/security-playground + selector: + matchLabels: + app: securitycheck \ No newline at end of file From 1052d7a4aea928b91b05168c7868e4cb8a29703b Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Fri, 20 Jun 2025 14:05:19 +0000 Subject: [PATCH 02/21] Added services and resource-limits for k8s resources --- Loadbalancer.yaml | 14 ++++++++++++++ resource-limit.yaml | 14 ++++++++++++++ resource-quota.yaml | 13 +++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 Loadbalancer.yaml create mode 100644 resource-limit.yaml create mode 100644 resource-quota.yaml diff --git a/Loadbalancer.yaml b/Loadbalancer.yaml new file mode 100644 index 0000000..65d60d2 --- /dev/null +++ b/Loadbalancer.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: sc-loadbalancer + labels: + app: securitycheck + namespace: dev +spec: + type: LoadBalancer + ports: + - port: 80 + targetPort: 80 + selector: + app: securitycheck diff --git a/resource-limit.yaml b/resource-limit.yaml new file mode 100644 index 0000000..abc6fed --- /dev/null +++ b/resource-limit.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: LimitRange +metadata: + name: sc-limitrange + namespace: dev +spec: + limits: + - default: + cpu: "200m" + memory: "256Mi" + defaultRequest: + cpu: "100m" + memory: "128Mi" + type: container \ No newline at end of file diff --git a/resource-quota.yaml b/resource-quota.yaml new file mode 100644 index 0000000..cf49780 --- /dev/null +++ b/resource-quota.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: ResourceQuota +metadata: + name: sc-resourcequota + namespace: dev +spec: + hard: + limits.cpu: "1200m" + requests.cpu: "600m" + limits.memory: "2000Mi" + requests.memory: "1000Mi" + pods: 10 + \ No newline at end of file From a4e10399d708bb05a31deec8bd29f39ec57014de Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Fri, 20 Jun 2025 14:18:49 +0000 Subject: [PATCH 03/21] Updated Limits and Resources for PODS --- resource- | 0 resource-limit.yaml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 resource- diff --git a/resource- b/resource- new file mode 100644 index 0000000..e69de29 diff --git a/resource-limit.yaml b/resource-limit.yaml index abc6fed..0c2ebdb 100644 --- a/resource-limit.yaml +++ b/resource-limit.yaml @@ -11,4 +11,4 @@ spec: defaultRequest: cpu: "100m" memory: "128Mi" - type: container \ No newline at end of file + type: Container From 5c0e2c8f3a65b85880a51e07c7c35cca20ff9942 Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Fri, 20 Jun 2025 14:24:16 +0000 Subject: [PATCH 04/21] Corrected the Loadbalancer service --- Loadbalancer.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Loadbalancer.yaml b/Loadbalancer.yaml index 65d60d2..d3fd582 100644 --- a/Loadbalancer.yaml +++ b/Loadbalancer.yaml @@ -2,9 +2,9 @@ apiVersion: v1 kind: Service metadata: name: sc-loadbalancer + namespace: dev labels: app: securitycheck - namespace: dev spec: type: LoadBalancer ports: From f0cf30cdf386742445670d863beb22fd23d510d2 Mon Sep 17 00:00:00 2001 From: Jai Sharma <60392846+Jaisharma2512@users.noreply.github.com> Date: Sun, 22 Jun 2025 08:10:38 +0530 Subject: [PATCH 05/21] Updated README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7f0fbd1..4755fcb 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Deploy the docker image in your environment, and setup the probe health check to You can also run the image locally: ```bash -$ docker run --rm -p 8080:8080 sysdiglabs/security-playground +$ docker run --rm -p 8081:8080 sysdiglabs/security-playground ``` @@ -42,13 +42,13 @@ The health check endpoint is `/health` on port `8080` and returns the `200` HTTP You can retrieve a file's contents by sending a `GET` request to the application's URL. ```bash -$ curl :8080/ +$ curl :8081/ ``` For example: ```bash -$ curl localhost:8080/etc/shadow +$ curl localhost:8081/etc/shadow ``` This will return the content of the `/etc/shadow` file in the container running locally. @@ -60,13 +60,13 @@ This will return the content of the `/etc/shadow` file in the container running You can write data to a file by sending a `POST` request to the application's URL with the desired content. ```bash -$ curl -X POST :8080/ -d 'content=' +$ curl -X POST :8081/ -d 'content=' ``` For example: ```bash -$ curl -X POST localhost:8080/bin/hello -d 'content=hello-world' +$ curl -X POST localhost:8081/bin/hello -d 'content=hello-world' ``` This command writes the string hello-world to /bin/hello. From 89fe2f0a693ad775472fa1a75b5966f2e18cbbd1 Mon Sep 17 00:00:00 2001 From: Jai Sharma <60392846+Jaisharma2512@users.noreply.github.com> Date: Sun, 22 Jun 2025 08:11:27 +0530 Subject: [PATCH 06/21] Updated README.md again for ports --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4755fcb..307c9b8 100644 --- a/README.md +++ b/README.md @@ -78,13 +78,13 @@ This command writes the string hello-world to /bin/hello. To execute a command, send a `POST` request to the `/exec` endpoint with the command as the payload. ```bash -$ curl -X POST :8080/exec -d 'command=' +$ curl -X POST :8081/exec -d 'command=' ``` For example: ```bash -$ curl -X POST localhost:8080/exec -d 'command=ls' +$ curl -X POST localhost:8081/exec -d 'command=ls' ``` This will run the command and return its STDOUT output. From bba75134a2d4262da7d590881dacd4416a80de1e Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Fri, 20 Jun 2025 14:24:16 +0000 Subject: [PATCH 07/21] Corrected the Loadbalancer service --- Loadbalancer.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Loadbalancer.yaml b/Loadbalancer.yaml index 65d60d2..d3fd582 100644 --- a/Loadbalancer.yaml +++ b/Loadbalancer.yaml @@ -2,9 +2,9 @@ apiVersion: v1 kind: Service metadata: name: sc-loadbalancer + namespace: dev labels: app: securitycheck - namespace: dev spec: type: LoadBalancer ports: From 70109329065ae28d70bdbab0ce32fec12d65b250 Mon Sep 17 00:00:00 2001 From: Jai Sharma Date: Mon, 23 Jun 2025 03:40:34 +0530 Subject: [PATCH 08/21] Fixed Loadbalancer service --- Loadbalancer.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Loadbalancer.yaml b/Loadbalancer.yaml index d3fd582..797c921 100644 --- a/Loadbalancer.yaml +++ b/Loadbalancer.yaml @@ -9,6 +9,6 @@ spec: type: LoadBalancer ports: - port: 80 - targetPort: 80 + targetPort: 8081 selector: app: securitycheck From 773d8c46c8ed64c33959b13454d95c901391f34a Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Mon, 23 Jun 2025 18:08:14 +0000 Subject: [PATCH 09/21] Added Jenkinsfile --- Jenkinsfile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..de951e4 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,18 @@ +pipeline{ + agent any + environment{ + PROJECT_ID= 'secure-air-461520-g7' + REGION= 'us-central1' + REPO= 'juneserver' + } + stages{ + stage(){ + stage('Build'){ + steps{ + echo 'Code is pushed' + } + + } + } +} +} \ No newline at end of file From 751d6f79f1f77f3fe0001f3de9e532d967d32446 Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Mon, 23 Jun 2025 18:09:46 +0000 Subject: [PATCH 10/21] Testing GIT webhook --- a.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 a.txt diff --git a/a.txt b/a.txt new file mode 100644 index 0000000..e69de29 From 7ef418bb32a941a79169d3acf9911efeff07bd93 Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Mon, 23 Jun 2025 18:12:50 +0000 Subject: [PATCH 11/21] Fixed Jenkinsfile --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index de951e4..38ffba3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,6 @@ pipeline{ REPO= 'juneserver' } stages{ - stage(){ stage('Build'){ steps{ echo 'Code is pushed' From 0bcc46e5a8b8e60dd660fa225c55627f928361a6 Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Mon, 23 Jun 2025 18:13:51 +0000 Subject: [PATCH 12/21] Added c file for testing --- c.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 c.txt diff --git a/c.txt b/c.txt new file mode 100644 index 0000000..e69de29 From d5f44e467aa1e095924318e0951a24a10d4eee96 Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Mon, 23 Jun 2025 18:19:10 +0000 Subject: [PATCH 13/21] Fixed Jenkinsfile for the final time --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 38ffba3..c380686 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,4 +14,3 @@ pipeline{ } } } -} \ No newline at end of file From ddac38a7c913535d15fbd343481c71ad8e8eb760 Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Mon, 23 Jun 2025 18:20:02 +0000 Subject: [PATCH 14/21] Adding d file --- d.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 d.txt diff --git a/d.txt b/d.txt new file mode 100644 index 0000000..e69de29 From 72098a70ae1bc5358bdd48132971ca51ffd661bf Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Mon, 23 Jun 2025 18:29:19 +0000 Subject: [PATCH 15/21] Added e file --- e.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 e.txt diff --git a/e.txt b/e.txt new file mode 100644 index 0000000..e69de29 From 750d3bde74d2e18d340892e55887d4fe6fbb6dde Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Mon, 23 Jun 2025 18:31:52 +0000 Subject: [PATCH 16/21] Revert "Added e file" This reverts commit 72098a70ae1bc5358bdd48132971ca51ffd661bf. --- e.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 e.txt diff --git a/e.txt b/e.txt deleted file mode 100644 index e69de29..0000000 From 878f0e9adb96b2d53d9a1b4708787abcbccc4625 Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Mon, 23 Jun 2025 18:31:57 +0000 Subject: [PATCH 17/21] Revert "Adding d file" This reverts commit ddac38a7c913535d15fbd343481c71ad8e8eb760. --- d.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 d.txt diff --git a/d.txt b/d.txt deleted file mode 100644 index e69de29..0000000 From 7483057770a3f5c5c3d81c638f941e05277193e9 Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Mon, 23 Jun 2025 18:32:05 +0000 Subject: [PATCH 18/21] Revert "Added c file for testing" This reverts commit 0bcc46e5a8b8e60dd660fa225c55627f928361a6. --- c.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 c.txt diff --git a/c.txt b/c.txt deleted file mode 100644 index e69de29..0000000 From 854cdd83fcf27fedac42a2b35cd650f3c92703ba Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Mon, 23 Jun 2025 18:36:30 +0000 Subject: [PATCH 19/21] Revert "Testing GIT webhook" This reverts commit 751d6f79f1f77f3fe0001f3de9e532d967d32446. --- a.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 a.txt diff --git a/a.txt b/a.txt deleted file mode 100644 index e69de29..0000000 From f3638ba7a8ca3f69347bbb880b5a06c5700708bd Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Tue, 24 Jun 2025 06:40:50 +0000 Subject: [PATCH 20/21] Added a.txt for testing --- a.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 a.txt diff --git a/a.txt b/a.txt new file mode 100644 index 0000000..e69de29 From 5fcdd099720eb845374fd1518ead80aa5ff6443e Mon Sep 17 00:00:00 2001 From: Jaisharma2512 Date: Tue, 24 Jun 2025 06:42:28 +0000 Subject: [PATCH 21/21] Revert "Added a.txt for testing" This reverts commit f3638ba7a8ca3f69347bbb880b5a06c5700708bd. --- a.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 a.txt diff --git a/a.txt b/a.txt deleted file mode 100644 index e69de29..0000000