You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2007/08/17 21:43:39 UTC

[Bug 5611] New: Running spamd with -u and without -x no longer reads user prefs

http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5611

           Summary: Running spamd with -u and without -x no longer reads
                    user prefs
           Product: Spamassassin
           Version: 3.2.2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: spamc/spamd
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: brettcsmith@brettcsmith.org


My system has a setup where:

* spamd runs as a dedicated spamd user, which is in a spamd group
* every user has their own configuration in $HOME/.spamassassin
* configurations are 660 user:spamd, so that both the user and spamd can
read/write them, but none of the other local users can

This configuration stopped working in 3.2.2; instead of reading the preferences
of the user who invoked spamc, SpamAssassin would read the spamd user's
(non-existent) preferences.

I think this is a side effect of the patch installed from bug 5522.

I've fixed this problem with the attached patch.  This is sloppy and so I would
imagine this is something you won't want to install directly, but I think the
end result has to be that handle_user_set_user_prefs always loads the
preferences of the user who called spamc, rather than the user spamd is running
as (which it currently does).

I think the check for $opt{'user-config'} around the handle_user_set_user_prefs
call in handle_user_setuid_basic should make sure the -x case still works, but I
haven't tested that.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5611] Running spamd with -u and without -x no longer reads user prefs

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5611





------- Additional Comments From jm@jmason.org  2007-08-20 04:17 -------
(In reply to comment #2)
> Justin, is that something you thought about when doing the patch for bug 5522,
> or were you just cleaning up wording of the comment in the patch that someone
> else had submitted?

Yes.  I think we have two use cases, the bug-5522 one, and this one.  They are
diametrically opposed :(  

What about using the "--user-config" switch to differentiate?

"spamd --nouser-config -u spamduser": the bug 5522 case. turns off reading
~/.spamassassin/user_prefs from the remote username's home dir

"spamd --user-config -u spamduser": this case.  turns ON reading
~/.spamassassin/user_prefs from the remote username's home dir

does that make sense?

for reference, here's the POD docs for those 2 options:


=item B<-x>, B<--nouser-config>, B<--user-config>

Turn off(on) reading of per-user configuration files (user_prefs) from the
user's home directory.  The default behaviour is to read per-user
configuration from the user's home directory.

This option does not disable or otherwise influence the SQL, LDAP or
Virtual Config Dir settings.

=item B<-u> I<username>, B<--username>=I<username>

Run as the named user.  If this option is not set, the default behaviour
is to setuid() to the user running C<spamc>, if C<spamd> is running
as root.

Note: "--username=root" is not a valid option.  If specified, C<spamd> will
exit with a fatal error on startup.



> What is the right thing to do here?
> 
> Is this related to what I saw in bug 5606 that spamd is now reading the user
> prefs of the userid it is running at at initialization time (which I think is a
> bug)?

no, I don't think it's related.





------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5611] Running spamd with -u and without -x no longer reads user prefs

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5611





------- Additional Comments From brettcsmith@brettcsmith.org  2007-08-23 19:09 -------
(In reply to comment #3)
> (In reply to comment #2)
> > Justin, is that something you thought about when doing the patch for bug 5522,
> > or were you just cleaning up wording of the comment in the patch that someone
> > else had submitted?
> 
> Yes.  I think we have two use cases, the bug-5522 one, and this one.  They are
> diametrically opposed :(  
> 
> What about using the "--user-config" switch to differentiate?

This makes sense to me; in fact, for whatever it's worth, that's how I expected
spamd to work when I was reading the documentation.  I figured -u without -x
would get my desired behavior, and -u with -x would get the behavior requested
in bug 5522.




------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5611] [review] Running spamd with -u and without -x no longer reads user prefs

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5611


spamassassin@dostech.ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard|needs 2 votes for 3.2       |needs 1 votes for 3.2






------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5611] Running spamd with -u and without -x no longer reads user prefs

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5611


jm@jmason.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|Undefined                   |3.2.4






------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5611] [review] Running spamd with -u and without -x no longer reads user prefs

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5611


sidney@sidney.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard|needs 1 votes for 3.2       |ready to commit for 3.2




------- Additional Comments From sidney@sidney.com  2007-12-16 12:14 -------
+1




------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5611] Running spamd with -u and without -x no longer reads user prefs

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5611





------- Additional Comments From brettcsmith@brettcsmith.org  2007-08-17 12:45 -------
Created an attachment (id=4092)
 --> (http://issues.apache.org/SpamAssassin/attachment.cgi?id=4092&action=view)
Patch for spamd to read user preferences




------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5611] [review] Running spamd with -u and without -x no longer reads user prefs

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5611


jm@jmason.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From jm@jmason.org  2007-12-16 13:28 -------
in 3.2.x: r604711



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5611] Running spamd with -u and without -x no longer reads user prefs

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5611





------- Additional Comments From sidney@sidney.com  2007-08-17 14:21 -------
This seems not only a side effect of the patch for bug 5522, but something that
was intended. Notice that Justin fixed a comment in the patch to explain more
clearly that this is what it is doing: When you use the --username option in
spamd  then that is the id whose user prefs are read, not the one passed in from
spamc.

Justin, is that something you thought about when doing the patch for bug 5522,
or were you just cleaning up wording of the comment in the patch that someone
else had submitted?

What is the right thing to do here?

Is this related to what I saw in bug 5606 that spamd is now reading the user
prefs of the userid it is running at at initialization time (which I think is a
bug)?



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5611] [review] Running spamd with -u and without -x no longer reads user prefs

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5611


parkerm@pobox.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |parkerm@pobox.com






------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5611] [review] Running spamd with -u and without -x no longer reads user prefs

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5611





------- Additional Comments From spamassassin@dostech.ca  2007-11-06 13:14 -------
+1



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5611] [review] Running spamd with -u and without -x no longer reads user prefs

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5611


jm@jmason.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Running spamd with -u and   |[review] Running spamd with
                   |without -x no longer reads  |-u and without -x no longer
                   |user prefs                  |reads user prefs
  Status Whiteboard|                            |needs 2 votes for 3.2






------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 5611] Running spamd with -u and without -x no longer reads user prefs

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5611


jm@jmason.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
Attachment #4092 is|0                           |1
           obsolete|                            |




------- Additional Comments From jm@jmason.org  2007-09-27 05:37 -------
Created an attachment (id=4137)
 --> (http://issues.apache.org/SpamAssassin/attachment.cgi?id=4137&action=view)
fix

OK, I think this will do it.

it implements what I discussed in #3; I had to add an additional getpwnam()
lookup, and clarify some variable names, since we now potentially need to
setuid to one uid, but read config details from another uid's home dir.

all t/root*.t tests pass in trunk.  Now checked in:

: jm 177...; svn commit -m "bug 5611: support 'spamd --nouser-config -u
username', which setuids to 'username' but does not read user_prefs files from
anywhere"
Sending        spamd/spamd.raw
Transmitting file data .
Committed revision 579988.




------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.