-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (21 loc) · 907 Bytes
/
Dockerfile
File metadata and controls
30 lines (21 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Use the official PHP with Apache base image
FROM php:8.2-apache
# Copy custom Apache configuration into the image
COPY server-config/custom-apache.conf /etc/apache2/sites-available/000-default.conf
# enable production config so we dont display internal errors
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
# Enable necessary Apache modules
RUN a2enmod rewrite
# Copy application source code to the Apache document root
COPY src/ /var/www/html/
# Set permissions for the web root directory (optional)
RUN chown -R www-data:www-data /var/www/html && \
chmod -R 755 /var/www/html
# Add a new user 'flag' with password 'abc'
RUN echo "flag:0DAYAAR{FLAG3_Why_Is_Apache2_Running_As_ROOT!!}" >> /etc/shadow
# Make /etc/shadow vulnarable
RUN chmod 777 /etc/shadow
# Expose port 80 (optional since Compose can do this)
EXPOSE 80
# Start the Apache service
CMD ["apache2-foreground"]