Skip to content

Instantly share code, notes, and snippets.

@paigeadelethompson
Last active December 4, 2024 23:07
Show Gist options
  • Save paigeadelethompson/9ca716bad91b41c03e7bc63c2016a3b6 to your computer and use it in GitHub Desktop.
Save paigeadelethompson/9ca716bad91b41c03e7bc63c2016a3b6 to your computer and use it in GitHub Desktop.
ex0ch Dockerfile
FROM ubuntu:noble
RUN apt -y update
RUN apt -y install apache2 perl git cpanminus
WORKDIR /tmp
RUN git clone https://github.com/PrefKarafuto/ex0ch.git
WORKDIR /tmp/ex0ch/test
RUN cp -rvp . /var/www/html
WORKDIR /
RUN a2enmod cgid ssl
RUN cpanm -n CGI::Cookie JSON LWP::UserAgent
ADD apache.conf /etc/apache2/apache2.conf
RUN ln -s /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-enabled/default-ssl.conf
RUN echo "Options +ExecCGI +FollowSymLinks" > /var/www/html/.htaccess
RUN echo "AddHandler cgi-script .cgi" >> /var/www/html/.htaccess
RUN echo "DirectoryIndex search.cgi" >> /var/www/html/.htaccess
RUN echo "RedirectMatch 301 ^/info/ /" >> /var/www/html/.htaccess
RUN echo "RedirectMatch 301 ^/admin/ /" >> /var/www/html/.htaccess
RUN echo "RedirectMatch 301 ^/module/ /" >> /var/www/html/.htaccess
RUN echo "RedirectMatch 301 ^/plugin/ /" >> /var/www/html/.htaccess
RUN echo "RedirectMatch 301 ^/perllib/ /" >> /var/www/html/.htaccess
RUN echo "RedirectMatch 301 ^/plugin_conf/ /" >> /var/www/html/.htaccess
RUN chown -R www-data:www-data /var/www/html /usr/lib/cgi-bin
RUN mkdir -p /var/run/apache2
RUN chown -R www-data:www-data /var/run/apache2
RUN chown -R www-data:www-data /var/log/apache2
EXPOSE 80
EXPOSE 443
VOLUME /var/www/html/info
VOLUME /var/log/apache2
CMD apachectl -D FOREGROUND
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment