Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 523960

Summary: mail-filter/spamassassin-3.4 - /etc/conf.d/spamd should no longer need to mention the location of the pid file
Product: Gentoo Linux Reporter: Juan David Ibáñez Palomar <jdavid.ibp>
Component: [OLD] ServerAssignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it <maintainer-needed>
Status: RESOLVED FIXED    
Severity: normal CC: bug
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 583908    
Attachments: 3.0.0-spamd.conf.patch

Description Juan David Ibáñez Palomar 2014-09-28 17:07:19 UTC
In the /etc/conf.d/spamd file there is an obsolete comment, this is:

  # Note: if you plan on using the -u flag to spamd you will need to
  # make sure the location of the PID file is writable by that user.
  # This can be done by making the directory /var/run/spamd and
  # changing the owner to the UID that runs spamd.  You will then
  # need to edit $pidfile in /etc/init.d/spamd. This should fix the
  # problem with stop/restart in the init scripts.
  #
  # See http://bugs.gentoo.org/show_bug.cgi?id=70124 for a full
  # explanation.

I added a new user (spamd) and added the "-u spamd" option to SPAMD_OPTS,
without chaging the PIDFILE variable. Now spamd runs, stops/restarts,
without any issue. The pidfile, /run/spamd.id, is owned by root, and there
are three processes runing:

  # pstree -u
  init─┬─/usr/sbin/spamd───2*[spamd child(spamd)]

While I have only tested with 3.4.0, I suspect this works since 3.1.0, when
spamassassin changed to preforking. See first item in the 3.1.0 announcement
http://mail-archives.apache.org/mod_mbox/spamassassin-announce/200509.mbox/%3C20050914235232.814A45900BA@radish.jmason.org%3E

This is the syslog output when restarting spamd:

  # tail -f messages | grep spamd
  Sep 28 19:02:30 postaria spamd[21979]: spamd: server killed by SIGTERM, shutting down
  Sep 28 19:02:30 postaria spamd[24549]: logger: removing stderr method
  Sep 28 19:02:31 postaria spamd[24551]: spamd: server started on IO::Socket::INET6 [127.0.0.1]:783, IO::Socket::INET6 [::1]:783 (running version 3.4.0)
  Sep 28 19:02:31 postaria spamd[24551]: spamd: server pid: 24551
  Sep 28 19:02:31 postaria spamd[24551]: spamd: server successfully spawned child process, pid 24552
  Sep 28 19:02:31 postaria spamd[24551]: spamd: server successfully spawned child process, pid 24553
  Sep 28 19:02:31 postaria spamd[24551]: prefork: child states: IS
  Sep 28 19:02:31 postaria spamd[24551]: prefork: child states: II

The coment above confused me quite a little bit, I think it is worth
removing.
Comment 1 Marcin Mirosław 2016-05-31 12:01:15 UTC
Created attachment 435928 [details, diff]
3.0.0-spamd.conf.patch

Master process works with root privilleges but childs use user set by "-u". Indeed, this comment is confusing.
Comment 2 Marcin Mirosław 2016-05-31 12:27:57 UTC
This bug should wait for bug #455604
Comment 3 Michael Orlitzky gentoo-dev 2016-06-04 15:39:17 UTC
Done in a new revision:

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=19ff5b04b9db6b1319b35e9a6da3d26972bf04b5

I removed all mention of the PID file handling and permissions. It should just work out-of-the-box, no matter what you do. The PID is hard-coded to /run/spamd/spamd.pid, but you shouldn't need to mess with it.