Bug 126189

Summary: Squid startup not setting permissions on cache directories
Product: [Fedora] Fedora Reporter: John Horne <john.horne>
Component: squidAssignee: Jay Fenlason <fenlason>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 2CC: jfeeney
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-06-17 18:14:57 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description John Horne 2004-06-17 05:55:32 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040510

Description of problem:
Installed squid. Configured squid to use separate cache and log disk
partitions - that is, I set the 'cache_dir' and 'cache_log' options.
Starting squid fails because the disk partitions are mounted as root -
they need to be owned by the user 'squid'.

I have modifed /etc/init.d/squid to fix this. At line 49 put:

49:  [ -z "$CACHE_SWAP" ] && CACHE_SWAP=/var/spool/squid
51:  # determine which one is the cache_log directory
52:  CACHE_LOG=`sed -e 's/#.*//g' /etc/squid/squid.conf | \
53:          grep cache_log |  awk '{ print $2 }'`
54:  [ -z "$CACHE_LOG" ] && CACHE_LOG=/var/log/squid/xx
55:  CACHE_LOG=`dirname $CACHE_LOG`

Then further down simply change the script to:

  start() {
      for adir in $CACHE_LOG; do
          chown squid:squid $adir
          chmod 0770 $adir

      for adir in $CACHE_SWAP; do
          chown squid:squid $adir
          chmod 0770 $adir

This now takes care of the permissions for any cache_dir or cache_log
entries. CACHE_LOG could be expanded to include some of the other
squid 'log' directives - such as, cache_store_log.


Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Install squid and configure the cache_dir/cache_log options to use
specific disk partitions.
2. Make the disk partitions and create the mount points. Modify
/etc/fstab to mount the partitions.
3. Reboot the system and start up squid.

Actual Results:  Squid start up fails because the disk partitions are
mounted as root. Squid gives 'permission denied' errors (in cache_log
and access_log).

Expected Results:  Squid should start up and set the disk partitions
onwer and group id's as well as the mode.

Additional info:
Comment 1 John Horne 2004-06-17 17:25:25 EDT
Sorry, but I think you can close this one as 'user error'.

I shutdown squid, unmounted the relevant partitions and then set the
permissions on the mount points to 'squid:squid' with mode 770 and
then rebooted. The squid cache and log disk partitions were correctly
mounted with the correct ownership and mode. Squid came up fine. (I
had already removed the bit I added to the startup script.)

Apologies for the hassle.