#!/bin/sh # Generates a CA and a certificate for use with squid # After running the script, the CA will be in ${destDir}/rootCA.crt, clients # will need it, but the squid container has no need for it # The only file squid needs is ${destDir}/squid.pem # # The certificate is only valid for 127.0.0.1, localhost and 192.168.122.1 # If certificates for other hostnames/IPs are needed, modify the [alt_names] # section # # The certificate used by squid can be overriden when starting the container: # podman run -v ./pki/:/etc/pki/squid:z ... set -euo pipefail destDir=${1:-pki} baseName=${2:-squid} mkdir -p $destDir cat >${destDir}/rootCA.cnf <${destDir}/${baseName}.cnf <${destDir}/${baseName}.pem echo "Successfully generated root CA and certificate" echo "" echo "Add 'https_port 3129 tls-cert=${destDir}/${baseName}.pem' to your squid configuration file" echo "" echo "The public CA certificate is ${destDir}/rootCA.crt" echo "This can be used with curl with: curl --proxy-cacert ${destDir}/rootCA.crt -L https://gandi.net"