[Dovecot] dovecot-dspam-plugin not launching dspam

Stefan Schmidt stefan.schmidt at gmx.de
Thu Apr 13 02:17:15 EEST 2006


hello,

yes, all my virtual users in the vmail-database have the uid of the user 
'virtual'. anyway, i seem to have found the reason why it didn't work. 
as ryan pointed out:

"Even though dspam can determine the user from the signature, it still 
needs to startup as a valid user. If the user is notspecified on the 
command line with the --user parameter, dspam uses the user that invoked 
dspam"

okay, so far so good. i had already added the user virtual to my 
dspam-database but for the sake of it i tried again, but again no success.

"Unable to determine the destination user. DSPAM agent misconfigured: 
aborting"

same thing when trying to call dspam without the "--user foo" option 
logged in as user 'virtual' on the commandline. oddly enough when logged 
in with my "normal" system account i do not need the "--user foo" option 
and a user with my name is automatically created in the dspam database 
(fits together with ryans statement). however i did not go in 
researching on this behaviour, so let's for now settle on the fact that 
on my current configuration i need the "--user foo" option to call dspam 
with the user 'virtual' for whatever reason that is ;-)

thus i inserted a user 'retrain' in my database by feeding dspam some 
spam for this user. (could have probably used 'virtual' as a 
dspam-dummyuser, but i wanted to be on the safe side). now i inserted 
the parameter "--user retrain" and "--debug" into the plugin-source, 
compiled it and copied it the dovecot plugin directory.

execl ("/usr/bin/dspam", "dspam", "--user 
retrain","--debug","--source=error", "--stdout", class_arg, sign_arg, NULL);

when trying to move mails into or out of the spam folder this results in 
the well known above error message, although - as pointed out before - 
executing the same command with the user virtual from the command line 
works fine. to debug this i substituted the executable with a little 
shell script logging the command line arguments and the user that called 
the script, but it didn't shed any light. somehow i got the idea to 
seperate the command line argument and it's value in the execl-statement.

execl ("/usr/bin/dspam", "dspam", 
"--user","retrain","--debug","--source=error", "--stdout", class_arg, 
sign_arg, NULL);

compiled it, copied it to the dovecot plugin directory and now it 
magically worked ! i again substituted the dspam-executable with my 
debugging shell script to check what was different, but as far as i 
could see the results in my logfile were exactly the same(!) (didn't use 
a hex-editor though, so there could be a remote possibility of a blank 
not being a blank or something like that). further checking my logs, it 
seems as if dspam is now working correctly.

No QuarantineAgent option found. Using standard quarantine.
DSPAM Instance Startup
input args: dspam --user retrain --debug --source=error --stdout 
--class=spam --signature=4,443a49e9305501142080570
pass-thru args:
processing user retrain
uid = 107, euid = 107, gid = 107, egid = 101
loading preferences for user retrain
Loading preferences for uid 7
Loading preferences for uid 0
Loading preferences for uid 0
default preferences empty. reverting to dspam.conf preferences.
Loading preferences from dspam.conf
using /var/spool/dspam/opt-in/local/retrain.dspam as path
using /var/spool/dspam/opt-out/local/retrain.nodspam as path
sedation level set to: 0
loading preferences for user the_virtual_user_of_the_signature at mydomain.tld
Loading preferences for uid 4
Loading preferences for uid 0
Loading preferences for uid 0
default preferences empty. reverting to dspam.conf preferences.
Loading preferences from dspam.conf
processing signature.  length: 10944
reversing 912 tokens
Control: [10 10] [11 9] Delta: [1 -1]
reclassifying iteration 1 result: 0
libdspam returned probability of 1.000000
message result: SPAM
DSPAM Instance Shutdown.  Exit Code: 0

so maybe the execl-statement doesn't allow any blanks in it's arguments 
- could this possibly be ?

resumé: for most users the plugin should work just fine if they insert 
the user that dspam is called as into the dspam-database, but in some 
special cases the "--user foo"-option seems to needed (for whatever 
reason). i hope this thread is useful to some other potential 
dovecot-dspam-plugin-user :-)

stefan

Johannes Berg schrieb:
> On Tue, 2006-04-11 at 15:12 +0200, Stefan Schmidt wrote:
>   
>> no, dovecot is running as user dovecot. but to my understanding it 
>> switches to the userid of the virtual user accounts before 
>> reading/writing data to the maildirs.
>>     
>
> Right. But is that the 'virtual' user for all virtual users?
>
> johannes
>   


More information about the dovecot mailing list