einot / gross

Automatically exported from code.google.com/p/gross
Other
1 stars 2 forks source link

Grossd won't start if statefile enabled in Ubuntu 10.10 and Gross 1.0.2-2 #87

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
# while using Ubuntu 10.10 and Gross 1.0.2-2:

1. Using a working grossd
2. add line: statefile = /var/lib/gross/grossd.state to /etc/grossd.conf
grep '^[^# ]' /etc/default/gross /etc/grossd.conf
  /etc/default/gross:DAEMON_OPTS=""
  /etc/grossd.conf:protocol = sjsms
  /etc/grossd.conf:protocol = postfix
  /etc/grossd.conf:statefile = /var/lib/gross/grossd.state
  /etc/grossd.conf:check = dnsbl
  /etc/grossd.conf:dnsbl = bl.spamcop.net;2
  /etc/grossd.conf:dnsbl = combined.njabl.org
  /etc/grossd.conf:dnsbl = cbl.abuseat.org
  /etc/grossd.conf:dnsbl = dnsbl.sorbs.net

3. sudo -i -u gross "/usr/sbin/grossd -C"
  will silently end but no /var/lib/gross/grossd.state will be created

4. sudo /etc/init.d/gross restart
 * Restarting gross policy server gross  [ OK ]
tail /var/log/syslog
  (...)grossd version 1.0.2 starting...
  (...)creating pidfile /var/run/gross/gross.pid
  (...)Grossd shutdown with exit code 2: stat(): statefile opening failed No such file or directory

5. sudo /etc/init.d/gross status
 * gross is not running

6. sudo ls -la /var/run/gross/gross.pid /var/lib/gross
-rw-r--r-- 1 gross gross    4 2011-02-05 11:48 /var/run/gross/gross.pid
/var/lib/gross:
total 8
drwx------  2 gross gross 4096 2011-02-05 11:35 .
drwxr-xr-x 71 root  root  4096 2011-02-05 10:26 ..

7. (cd /var/lib/gross/;sudo touch grossd.state; sudo chown gross.gross 
grossd.state) ; sudo /etc/init.d/gross restart ; sudo tail /var/log/syslog
  Grossd shutdown with exit code 2: statefile size differs from the calculated size

Am I missing anything in the config file or at the restart procedure?

Regards,

M.

Original issue reported on code.google.com by an...@e-healthexpert.org on 5 Feb 2011 at 12:04

GoogleCodeExporter commented 9 years ago
Does gross (user) have write permission to /var/lib/gross directory? Try 
creating /var/db/gross (or something similar), and then give write permission 
to gross user to that directory. Then, configure statefile to be created in 
that directory and run grossd -C.

However, I don't see how statefile creation could fail without grossd 
complaining. (Statefile is created in create_statefile() function in srvutils.c)

Original comment by eino.tuominen@gmail.com on 5 Feb 2011 at 12:33

GoogleCodeExporter commented 9 years ago
The gross user has write permissions to /var/lib/gross, as shown by
results of the above line '6. sudo ls
-la /var/run/gross/gross.pid /var/lib/gross'.

I did create /var/db/gross and chown'ed it to gross and the
results were are the same.

It seems to be related with the following line in file src/gross.c:
    if ((ctx->config.flags & FLG_CREATE_STATEFILE) ==
FLG_CREATE_STATEFILE) {

Otherwise we should be seeing some output from:
        } else {
            daemon_shutdown(EXIT_FATAL, "statefile not
configured");

Anyway I think that, for now, we will abandon Gross.
It follows a nice idea, but at least in Linux it does not seem to be
mature enough and does not justify the time lost with it.

Best wishes,

M.

Original comment by an...@e-healthexpert.org on 5 Feb 2011 at 5:42

GoogleCodeExporter commented 9 years ago
Could you please run grossd -C with strace and send me the output? You can mail 
the trace to me directly if you are not comfortable to attach it here.

Also, I'd be grateful if you told me what you think is not "mature enough in 
Linux". I ask because I'm not aware of any current stability issues.

Original comment by eino.tuominen@gmail.com on 5 Feb 2011 at 6:21

GoogleCodeExporter commented 9 years ago
[SOLVED] please close ticket.

The Ubuntu Gross .deb package postinst uses 'install -d -o gross -g gross -m 
0700 /var/lib/gross' to create the /var/lib/gross directory in which the 
statefile should be stored.

In Ubuntu (at least with with apparmor on and using strict permissions 
enforcement), one must assure that sudoers & apparmor are configured to permit 
'sudo -u gross /usr/sbin/grossd -C' to use the /var/lib/gross directory.

Original comment by an...@e-healthexpert.org on 6 Feb 2011 at 11:42

GoogleCodeExporter commented 9 years ago
Great that you found a solution.

Original comment by eino.tuominen@gmail.com on 6 Feb 2011 at 11:53