Skip to content

Commit

Permalink
Add integration tests for https_redirect module
Browse files Browse the repository at this point in the history
  • Loading branch information
bretfourbe committed Aug 9, 2023
1 parent 6b1d60d commit 6670078
Show file tree
Hide file tree
Showing 18 changed files with 2,520 additions and 2 deletions.
15 changes: 15 additions & 0 deletions tests/integration/docker-compose.setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,19 @@ services:
volumes:
- drupal9_db_data:/var/lib/mysql

# Apache container for the https_redirect module
https_redirect:
build:
context: ./test_mod_https_redirect/
dockerfile: Dockerfile
args:
PHP_HASH_TAG: ${PHP_HASH}
volumes:
- ./test_mod_https_redirect/php/src:/var/www/html
<<: *healthcheck_web
networks:
- test-network

# Apache container for the log4shell module
log4shell:
build:
Expand Down Expand Up @@ -468,6 +481,8 @@ services:
condition: service_healthy
http_headers:
condition: service_healthy
https_redirect:
condition: service_healthy
csrf:
condition: service_healthy
wordpress:
Expand Down
1 change: 1 addition & 0 deletions tests/integration/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ test_mod_csrf \
test_mod_drupal_enum \
test_mod_htaccess \
test_mod_http_headers \
test_mod_https_redirect \
test_mod_exec \
test_mod_file \
test_mod_log4shell \
Expand Down
21 changes: 21 additions & 0 deletions tests/integration/test_mod_https_redirect/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ARG PHP_HASH_TAG=':8.1-apache'
FROM php${PHP_HASH_TAG}
EXPOSE 443 80 8443 8080

RUN apt-get -y update && \
apt-get -y install openssl -y && \
apt-get -y clean && \
apt-get -y autoremove && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
truncate -s 0 /var/log/*log

RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /etc/apache2/server.key -out /etc/apache2/server.crt \
-subj "/C=US/ST=State/L=City/O=Organization/OU=Unit/CN=localhost"

RUN /usr/sbin/a2enmod rewrite ssl

COPY ./apache_conf/000-default.conf /etc/apache2/sites-available/000-default.conf

# Start Apache
CMD ["apache2-foreground"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Listen 8080
NameVirtualHost *:8080

Listen 8443 https
NameVirtualHost *:8443

<VirtualHost *:80 *:8080>
ServerName https_redirect
DocumentRoot /var/www/html/
<Directory /var/www/html/>
AllowOverride All
</Directory>

</VirtualHost>

<VirtualHost *:443 *:8443>
ServerName https_redirect
DocumentRoot /var/www/html/
<Directory /var/www/html/>
AllowOverride All
</Directory>

SSLEngine on
SSLCertificateFile /etc/apache2/server.crt
SSLCertificateKeyFile /etc/apache2/server.key
</VirtualHost>
Loading

0 comments on commit 6670078

Please sign in to comment.