#!/bin/sh set -e # N4D module must be enabled to make more easier # the installation process dconf update case $1 in configure) if grep -Fxq "redirect_program /usr/bin/squidGuard -c /etc/squidguard/squidGuard.conf.lliurex" /etc/squid3/squid.conf then echo "squid configuration is done" else echo "\nredirect_program /usr/bin/squidGuard -c /etc/squidguard/squidGuard.conf.lliurex\n" >> /etc/squid3/squid.conf fi if [ ! -L /var/www/lliurexguard ]; then ln -s /usr/share/lliurex-guard/www /var/www/lliurexguard || true fi a2enmod authnz_ldap || true a2ensite lliurexguard || true service apache2 restart || true if [ -d /var/lib/squidguard/db ]; then chown -R proxy:www-data /var/lib/squidguard/db chmod 775 /var/lib/squidguard/db/* fi if [ -f /var/www/lliurexguard/squid_wrapper ]; then chown root:www-data /var/www/lliurexguard/squid_wrapper chmod 754 /var/www/lliurexguard/squid_wrapper fi if [ -f /etc/squidguard/squidGuard.conf.lliurex ]; then chown proxy:www-data /etc/squidguard/squidGuard.conf.lliurex chmod 664 /etc/squidguard/squidGuard.conf.lliurex fi if [ -d /var/log/squidguard ]; then chown -R proxy:www-data /var/log/squidguard fi if [ ! -d /var/lib/dnsmasq/config ]; then mkdir -p /var/lib/dnsmasq/config fi DOMINI=$(n4d-vars getvalues INTERNAL_DOMAIN | cut -d"'" -f2) SRVNAME=$(n4d-vars getvalues HOSTNAME | cut -d"'" -f2) if [ ! -f /var/lib/dnsmasq/config/cname-lliurex-guard ]; then echo "cname=lliurexguard.$DOMINI,$SRVNAME.$DOMINI" > /var/lib/dnsmasq/config/cname-lliurex-guard sudo service dnsmasq restart fi IPINTERNA=$(n4d-vars getvalues SRV_IP | cut -d"'" -f2) if grep -Fq "IP_SERVIDOR" /etc/squidguard/squidGuard.conf.lliurex then sed -i "s/IP_SERVIDOR/$IPINTERNA/g" /etc/squidguard/squidGuard.conf.lliurex fi service squid3 restart ;; *) echo "[DEBUG] Unknow action ..." ;; esac #DEBHELPER# exit 0