-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
In an attempt to keep my prior email short i left the detail about the parameters to execl. "--user foo" is indeed two seperate parameters, but it looks like you figured that part out, hopefully without much trouble.
I'm pretty sure my plugin is running as 'nobody', but it really doesn't matter what it runs as since the signature contains the userid (if dspam is configured as such, seems like a requirement) and it changes to that context. In my setup, each email address (user@domain.tld) has their own userid in dspam, i just added a 'dovecot' dummy user and a --user dovecot to the execl statement... Worked like a charm!
Hopefully some of this info can end up on Johannes' wiki page, as I presume that these issues will be common.
Working out a few other kinks but i think i finally got everything setup just right.
Ryan
On Wed, April 12, 2006 6:17 pm, Stefan Schmidt said:
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@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
PGP Fingerprint - E15C CC7D 5830 AB8A C2AE 5C5E 80D8 6B63 D40B 015C
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFEPY32gNhrY9QLAVwRApz6AJ9H0IvXGvFfj1u40yRTqKYLjYrV+QCgswP/ xHqsZuJczVEp8yb3sx/X9Ts= =PcfR -----END PGP SIGNATURE-----