cfengine can't access logfile when running as non-root

Bug #780410 reported by Andrey Bondarenko on 2011-05-10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cfengine3 (Debian)
Fix Committed
cfengine3 (Ubuntu)

Bug Description

Binary package hint: cfengine3

The problem found in package version 3.0.5+dfsg-1 from Natty.

When running as non-root user, cf-agent complains "Can't open lock-log file". The error happens because it tries to work with files in /var/log, but doesn't have enough permissions.

You may reproduce the issue from a non-root account as follows:

rm -rf ~/.cfagent
mkdir ~/.cfagent ~/.cfagent/bin ~/.cfagent/inputs
cp /usr/sbin/cf-* ~/.cfagent/bin/
cat - >~/.cfagent/inputs/ <<EOF
# -*- coding: utf-8; mode: cfengine -*-
body common control
  bundlesequence => { "test" };

bundle agent test
  "/bin/date" ;
env LANG=C cf-agent; echo $?

The commands will produce something like that:

Q: ".../bin/date": Tue May 10 15:40:36 YEKST 2011
I: Last 1 QUOTed lines were generated by promiser "/bin/date"
Can't open lock-log file /var/log/cf3.<hostname>.runlog
 !!! System error for fopen: "Permission denied"
1 <-- (take note exit code signals about some error)

Andrey Bondarenko (abone) wrote :

The issue was introduced by Debian specific patch debian/patches/fhs-compliance. The patch doesn't take into account that working directory for non-root users is ~/.cfengine and FHS rules can't be applied to this case. In my opinion, we should not change upstream behavior for regular users.

Changed in cfengine3 (Ubuntu):
status: New → In Progress
Andrey Bondarenko (abone) wrote :

The patch forwarded to Debian bug #626280 and should be included into next debian version. After following package resync it should be available in Ubuntu. If you need solution faster you can use my branch or write here.

Changed in cfengine3 (Debian):
status: Unknown → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.