Configuring SSL decryption (SSL Bumping) for HTTPS traffic on a Squid proxy hosted via WSL involves generating a Certificate Authority (CA) certificate, configuring Squid to intercept and decrypt HTTPS traffic, and ensuring clients trust the generated CA certificate. Here's a step-by-step guide:
1. Generate a CA Certificate
Create a Certificate Authority (CA) key and certificate to sign proxy-generated certificates for HTTPS sites.
In your WSL terminal:
sudo mkdir -p /etc/squid/certs
cd /etc/squid/certs
# Generate a CA private key and certificate (valid for 10 years)
sudo openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 \
-subj "/CN=Squid Proxy CA" \
-keyout squid-ca.key -out squid-ca.crt
# Generate a proxy server certificate signed by the CA
sudo openssl req -new -newkey rsa:4096 -nodes \
-subj "/CN=Squid Proxy" \
-keyout squid-proxy.key -out squid-proxy.csr
# Sign the proxy certificate with the CA
sudo openssl x509 -req -in squid-proxy.csr -CA squid-ca.crt -CAkey squid-ca.key -CAcreateserial -out squid-proxy.crt -days 3650
# Combine the proxy certificate and key into a PEM file
sudo cat squid-proxy.key squid-proxy.crt | sudo tee squid-proxy.pem
2. Configure Squid for SSL Decryption
Edit the Squid configuration file (/etc/squid/squid.conf):
sudo nano /etc/squid/squid.conf
Add/modify these lines:
# Configure SSL port with SSL-Bump
http_port 3128 ssl-bump \
cert=/etc/squid/certs/squid-proxy.pem \
generate-host-certificates=on dynamic_cert_mem_cache_size=4MB
# Enable SSL-Bump for HTTPS interception
ssl_bump server-first all
# Define ACLs for SSL-Bump
acl step1 at_step SslBump1
ssl_bump peek step1
ssl_bump bump all
# Allow traffic from clients (adjust IP ranges as needed)
acl localnet src 192.168.0.0/16
http_access allow localnet
http_access deny all
# Required for SSL-Bump
sslcrtd_program /usr/lib/squid/security_file_certgen -s /var/lib/ssl_db -M 4MB
sslcrtd_children 8
3. Prepare Squid SSL Database
Create the SSL database directory for Squid:
sudo /usr/lib/squid/security_file_certgen -c -s /var/lib/ssl_db -M 4MB
sudo chown -R proxy:proxy /var/lib/ssl_db
4. Forward Port from WSL to Windows
Allow Windows to route traffic to Squid in WSL:
# Replace 192.168.x.x with WSL's IP (get via `wsl hostname -I`)
netsh interface portproxy add v4tov4 listenport=3128 listenaddress=0.0.0.0 connectport=3128 connectaddress=192.168.x.x
5. Configure Windows Firewall
Allow inbound traffic on port 3128:
New-NetFirewallRule -DisplayName "Squid Proxy" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 3128
6. Install the CA Certificate on Client Devices
Clients must trust your CA certificate (squid-ca.crt) to avoid certificate warnings.
Steps for Windows Clients:
- Copy
/etc/squid/certs/squid-ca.crt from WSL to Windows.
- Open
squid-ca.crt and install it in the Trusted Root Certification Authorities store.
- Press
Win + R → Run certlm.msc → Right-click Trusted Root Certification Authorities → Import → Select the .crt file.
Steps for Browsers:
- Chrome/Firefox: Import the CA certificate into the browser’s certificate store (Settings → Privacy → Certificates).
7. Restart Squid
Apply the configuration:
sudo service squid restart
8. Test the Proxy
Configure clients to use your Squid proxy (Windows_IP:3128). Test HTTPS sites like https://example.com.
- If configured correctly, there should be no certificate warnings.
Troubleshooting
-
Certificate Errors on Clients:
- Ensure the CA certificate is installed in the Trusted Root store.
- Clear the browser’s SSL cache or restart the browser.
-
Squid Logs:
tail -f /var/log/squid/access.log
tail -f /var/log/squid/cache.log
-
Firewall/Permissions:
- Verify port
3128 is open on Windows and WSL.
- Ensure Squid has read access to
/etc/squid/certs.
Security Notes
- SSL decryption allows the proxy to inspect all HTTPS traffic. Use this only in trusted environments.
- Protect the CA private key (
squid-ca.key)—compromise exposes all intercepted traffic.
- Consider adding client authentication (e.g., username/password in Squid) for added security.