This file is indexed.

/usr/sbin/update-squidguard is in squidguard 1.5-5.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/sh
#
#       update-squidguard  -  db update script for SquidGuard
#
#       Copyright 2003 Ivan E. Moore II <rkrusty at debian.org>
#       Copyright 2010-2015 Joachim Wiedorn <ad_debian at joonet.de>
#       
#       This program is free software; you can redistribute it and/or modify
#       it under the terms of the GNU General Public License version 2 as
#       published by the Free Software Foundation.
#       
#       This program is distributed in the hope that it will be useful,
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#       GNU General Public License for more details.
#       
#       You should have received a copy of the GNU General Public License
#       along with this program; if not, write to the Free Software
#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#       MA 02110-1301, USA.

set -e

# check command options
if [ $# -gt 0 ]; then
  while [ -n "$*" ]; do
    case "$1" in
  	  -v|--verbose)   VERBOSE=y; VBPAR="-b"  ;;
  	  -c|--checkdb)   CHECKDB=y  ;;
    esac
    shift
  done
fi

CONFDIR=/etc/squidguard
CONFOLD=/etc/squid
CONFFILE=squidGuard.conf
DATADIR=
DBVFILE=
DB_ACT=
DB_OLD=
REBUILD=y
INITRUN=

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Check all needed directories
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# check for new config directory (sg 1.5)
if test ! -e ${CONFDIR}/${CONFFILE}; then
  if test -e ${CONFOLD}/${CONFFILE}
  then CONFDIR=${CONFOLD}; fi
fi

[ ! -z $VERBOSE ] && echo "Check config directory for squidguard."  >&2
test -d ${CONFDIR} || mkdir -p ${CONFDIR}
if test ! -e ${CONFDIR}/${CONFFILE}; then
  echo "No config file $CONFDIR/$CONFFILE found - exiting update-squidguard." >&2
  exit 0
fi
chown proxy:proxy ${CONFDIR}/${CONFFILE}
chmod 0640 ${CONFDIR}/${CONFFILE}

# read default directories in config file
DATADIR=$(grep ^dbhome ${CONFDIR}/${CONFFILE} | cut -d' ' -f2)
DBVFILE=${DATADIR}/../dbversion

[ ! -z $VERBOSE ] && echo "Check data directory for squidguard."    >&2
test -d ${DATADIR} || mkdir -p ${DATADIR}
if [ $(ls -1 ${DATADIR} | wc -l) -eq 0 ]; then
  echo "No data files found in ${DATADIR} - exiting update-squidguard." >&2
  exit 0
fi
chown -R proxy:proxy ${DATADIR}
find ${DATADIR} -type d | xargs chmod 2750

[ ! -z $VERBOSE ] && echo "Check done."  >&2

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Rebuild full database
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DB_ACT=$(squidGuard -v 2>&1 | sed "s/.*DB\ \(.*\):.*/\1/")

# check BDB version whether rebuild is needed (usually for use in postinst)
if [ ! -z $CHECKDB ] && [ -f ${DBVFILE} ]; then
  DB_OLD=$(cat ${DBVFILE})
  [ "$DB_OLD" = "$DB_ACT" ] && REBUILD=n
fi

# rebuild database if needed
if [ $REBUILD = "y" ]; then
  echo "Rebuild SquidGuard database - this can take a while."  >&2
  su -s /bin/sh -c "squidGuard ${VBPAR} -C all" - proxy
  # update info file with Berkeley DB version
  echo ${DB_ACT}  >${DBVFILE}
  [ ! -z $VERBOSE ] && echo "Rebuild done."  >&2
else
  echo "Rebuild of SquidGuard database not needed."  >&2
fi

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Reload squid service
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if which invoke-rc.d >/dev/null 2>&1; then
  # for sysvinit and systemd
  INITRUN="invoke-rc.d"
elif which service >/dev/null 2>&1; then
  # for upstart and sysvinit
  INITRUN="service"
elif [ -n "$VERBOSE" ]; then
  echo "No starter for init scripts found!" >&2
fi

if [ -n "${INITRUN}" ]; then
  if [ -e /etc/init.d/squid3 ]; then
    ${INITRUN} squid3 force-reload
  elif [ -e /etc/init.d/squid ]; then
    ${INITRUN} squid force-reload
  elif [ -n "$VERBOSE" ]; then
    echo "No init script found for reloading Squid!" >&2
  fi
fi