File size: 1,320 Bytes
d594a43
 
 
 
 
 
1e3b3f3
d594a43
 
 
 
 
 
1e3b3f3
 
d594a43
 
 
 
 
1e3b3f3
d594a43
 
 
 
 
 
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
# Use the solipsist01/rapidleech image as the base
FROM solipsist01/rapidleech:latest

# Install necessary tools to modify configuration
RUN apt-get update && apt-get install -y nano

# Enable Apache headers module to control X-Frame-Options and Content Security Policy
RUN a2enmod headers

# Modify the Apache configuration to listen on port 7860
RUN sed -i 's/80/7860/g' /etc/apache2/ports.conf && \
    sed -i 's/80/7860/g' /etc/apache2/sites-available/000-default.conf

# Add Content-Security-Policy header to allow iframe from specific domain
RUN sed -i '/<\/VirtualHost>/i <IfModule mod_headers.c>\n    Header always unset X-Frame-Options\n    Header always set Content-Security-Policy "frame-ancestors \'self\' https://rapidleech-iframe-test.pages.dev"\n</IfModule>' /etc/apache2/sites-available/000-default.conf

# Restart Apache to apply the configuration
RUN service apache2 restart

# Ensure the same configuration in the main apache2.conf for redundancy
RUN echo '<IfModule mod_headers.c>\n    Header always unset X-Frame-Options\n    Header always set Content-Security-Policy "frame-ancestors \'self\' https://rapidleech-iframe-test.pages.dev"\n</IfModule>' >> /etc/apache2/apache2.conf

# Expose the new port
EXPOSE 7860

# Restart Apache again to ensure all settings are applied
CMD ["apache2-foreground"]