Step 8: Integrate Squid and Web Safety ICAP

To integrate Squid and Web Safety ICAP server run the script.


# all packages are installed as root
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root" 1>&2
   exit 1

# integrate with apache
a2dissite 000-default
a2ensite websafety

# replace the squid config
if [ ! -f /etc/squid/squid.conf.default ]; then
    cp -f /etc/squid/squid.conf /etc/squid/squid.conf.default
cp -f squid.conf /etc/squid/squid.conf

# create squid storage for mimicked ssl certificates
if [ -d $SSL_DB ]; then
    rm -Rf $SSL_DB

# see what squid we have now installed
echo "Creating SSLDB for version 4 in $SSL_DB ..."

/usr/lib/squid/security_file_certgen -c -s $SSL_DB -M 4MB
if [ $? -ne 0 ]; then
    echo "Error $? while initializing SSL certificate storage, exiting..."
    exit 1
chown -R proxy:proxy $SSL_DB

# reset owner of installation path
chown -R websafety:websafety /opt/websafety

# restart all daemons
systemctl restart wsicapd && systemctl restart apache2 && systemctl restart squid