-
Notifications
You must be signed in to change notification settings - Fork 4
Addressed issue #117 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,16 @@ | ||
| FROM php:7.2-apache as builder | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add the same structure as |
||
| # Copy the flag file and source files | ||
| COPY flag ./flag | ||
| COPY src/ ./src/ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't need to copy the flag, copy only the file that has the flag and change it. Like |
||
|
|
||
| # Generate flag.php by substituting __TEMPLATE__ with the flag content | ||
| RUN sed "s|__TEMPLATE__|$(cat ./flag)|g" ./src/flag-template.php > ./src/flag.php | ||
|
|
||
| FROM php:7.2-apache | ||
|
|
||
| # Copy all source files from host | ||
| COPY src/ /var/www/html/ | ||
|
|
||
| # Copy the generated flag.php from the builder stage | ||
| COPY --from=builder ./src/flag.php /var/www/html/flag.php | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,20 +1,17 @@ | ||||||||||||||||||||
| FILE := ../flag | ||||||||||||||||||||
| FLAG := $(shell cat $(FILE)) | ||||||||||||||||||||
| EXTERNAL_PORT := 8002 | ||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets use EXTERNAL_PORT := 30100 for this one. |
||||||||||||||||||||
| INTERNAL_PORT := 80 | ||||||||||||||||||||
| NAME := sss-web-08_todo-app | ||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets name this one |
||||||||||||||||||||
|
|
||||||||||||||||||||
| run: generate build | ||||||||||||||||||||
| docker run -d -p 8002:80 --name sss-web-08_todo-app sss-web-08_todo-app | ||||||||||||||||||||
| run: build | ||||||||||||||||||||
| docker run -d -p $(EXTERNAL_PORT):$(INTERNAL_PORT) --name $(NAME) $(NAME) | ||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| build: generate | ||||||||||||||||||||
| docker build -f Dockerfile -t sss-web-08_todo-app .. | ||||||||||||||||||||
|
|
||||||||||||||||||||
| generate: | ||||||||||||||||||||
| sed 's/__TEMPLATE__/$(FLAG)/g' ../src/flag-template.php > ../src/flag.php | ||||||||||||||||||||
| build: | ||||||||||||||||||||
| docker build -f Dockerfile -t $(NAME) .. | ||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| stop: | ||||||||||||||||||||
| docker stop sss-web-08_todo-app | ||||||||||||||||||||
| docker stop $(NAME) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| clean: stop | ||||||||||||||||||||
| docker rm sss-web-08_todo-app | ||||||||||||||||||||
| rm ../src/flag.php | ||||||||||||||||||||
| docker rm $(NAME) | ||||||||||||||||||||
|
Comment on lines
+11
to
+14
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| .PHONY: build run stop clean | ||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| namespace: exotic-attacks | ||
|
|
||
| challenge: | ||
| name: todo-app | ||
| category: web-application-security | ||
|
|
||
| image: | ||
| repository: todo-app | ||
| tag: latest | ||
| pullPolicy: IfNotPresent | ||
|
|
||
| replicaCount: 1 | ||
|
|
||
| containerPort: 80 | ||
|
|
||
| service: | ||
| type: NodePort | ||
| port: 80 | ||
| nodePort: 30015 # Port for accessing the challenge | ||
|
|
||
| resources: | ||
| limits: | ||
| cpu: 100m | ||
| memory: 128Mi | ||
| requests: | ||
| cpu: 50m | ||
| memory: 64Mi | ||
|
|
||
| # Healthcheck configuration for PHP/Apache application | ||
| # Using "/" (main application endpoint) for liveness/readiness checks is appropriate here because: | ||
| # 1. The application is stateless and has no external dependencies (DB, cache, etc.) | ||
| # 2. If Apache responds successfully to HTTP requests, the application is ready | ||
| # 3. PHP/Apache automatically restarts PHP engine on failures, so HTTP response indicates health | ||
| # Unlike database-backed services, a dedicated /_healthcheck endpoint is not needed. | ||
| healthCheck: | ||
| enabled: true | ||
| path: "/" | ||
| initialDelaySeconds: 5 | ||
| periodSeconds: 15 | ||
|
|
||
| nodeSelector: {} | ||
|
|
||
| tolerations: [] | ||
|
|
||
| affinity: {} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need for this ones. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use alpine, no need to use apache image here since it is bigger.