From 2dd51c56c75bd388baee71479a591485c24e9c14 Mon Sep 17 00:00:00 2001 From: Ahmet Oeztuerk Date: Tue, 17 Feb 2026 14:38:49 +0100 Subject: [PATCH] make apache2 listen on [::1] for ipv6 tests --- .github/prepare_debian.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/prepare_debian.sh b/.github/prepare_debian.sh index c8621644..f7301f14 100755 --- a/.github/prepare_debian.sh +++ b/.github/prepare_debian.sh @@ -80,12 +80,13 @@ a2ensite default-ssl rm /etc/ssl/certs/ssl-cert-snakeoil.pem rm /etc/ssl/private/ssl-cert-snakeoil.key openssl req -nodes -newkey rsa:2048 -x509 -sha256 -days 365 -nodes -keyout /etc/ssl/private/ssl-cert-snakeoil.key -out /etc/ssl/certs/ssl-cert-snakeoil.pem -subj "/C=GB/ST=London/L=London/O=Global Security/OU=IT Department/CN=$(hostname)" + # add a subdomain for testing cat >/etc/apache2/sites-available/subdomain1.conf < ServerName subdomain1.localhost.com DocumentRoot /var/www/subdomain1 - + ErrorLog \${APACHE_LOG_DIR}/subdomain1_error.log CustomLog \${APACHE_LOG_DIR}/subdomain1_access.log combined @@ -93,11 +94,11 @@ cat >/etc/apache2/sites-available/subdomain1.conf < ServerName subdomain1.localhost.com DocumentRoot /var/www/subdomain1 - + SSLEngine on SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key - + ErrorLog \${APACHE_LOG_DIR}/subdomain1_ssl_error.log CustomLog \${APACHE_LOG_DIR}/subdomain1_ssl_access.log combined @@ -110,9 +111,15 @@ echo '127.0.0.1 subdomain1.localhost' >> /etc/hosts echo '127.0.0.1 subdomain1.localhost.com' >> /etc/hosts apache2ctl configtest a2ensite subdomain1.conf + +# Make it listen to both IPv4 on IPv6 on localhost +sed -i 's/^Listen 80/Listen 0.0.0.0:80\nListen [::1]:80/' /etc/apache2/ports.conf +sed -i 's/^[[:space:]]*Listen 443/Listen 0.0.0.0:443\nListen [::1]:443/' /etc/apache2/ports.conf + service apache2 restart # squid +openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout /etc/squid/squid.key -out /etc/squid/squid.pem -subj "/CN=localhost" cp tools/squid.conf /etc/squid/squid.conf service squid start