From 46a95ff5a49a95cfd7a59b6b7763110e3553dc28 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 3 Feb 2025 16:28:30 +0100 Subject: [PATCH] Create new challenge Docker image --- countries_list/Dockerfile | 9 ++++++++- countries_list/docker/add_flag.php | 12 ++++++++++++ countries_list/docker/start.sh | 7 +++++++ countries_list/src/.htaccess | 3 +++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 countries_list/docker/add_flag.php create mode 100644 countries_list/docker/start.sh create mode 100644 countries_list/src/.htaccess diff --git a/countries_list/Dockerfile b/countries_list/Dockerfile index 86db698..da20801 100644 --- a/countries_list/Dockerfile +++ b/countries_list/Dockerfile @@ -1,4 +1,11 @@ FROM php:8.3-apache COPY src/ /var/www/html/ -ENV FLAG=CHANGEME \ No newline at end of file +ENV FLAG=CHANGEME + +COPY docker/start.sh /start.sh +COPY docker/add_flag.php /add_flag.php + + +EXPOSE 80 +ENTRYPOINT ["/start.sh"] \ No newline at end of file diff --git a/countries_list/docker/add_flag.php b/countries_list/docker/add_flag.php new file mode 100644 index 0000000..553bb8d --- /dev/null +++ b/countries_list/docker/add_flag.php @@ -0,0 +1,12 @@ +getMessage(); +} + + +$stmt = $db->prepare("INSERT INTO secret (flag) VALUES (?)"); +$stmt->execute(array(getenv("FLAG"))); diff --git a/countries_list/docker/start.sh b/countries_list/docker/start.sh new file mode 100644 index 0000000..6e653e1 --- /dev/null +++ b/countries_list/docker/start.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +echo Add flag to database +php /add_flag.php + +echo Run main server +docker-php-entrypoint apache2-foreground \ No newline at end of file diff --git a/countries_list/src/.htaccess b/countries_list/src/.htaccess new file mode 100644 index 0000000..c5c4f94 --- /dev/null +++ b/countries_list/src/.htaccess @@ -0,0 +1,3 @@ + + Require all denied + \ No newline at end of file