Page 1 of 1

Roundcube 1.4.x markasjunk

Posted: 2020-01-09 14:27
by RvdH
The old markasjunk2 plugin is now part off the new Roundcube 1.4.x distribution (named markasjunk)

I was trying to get this plugin working, with sa-learn (using cmd_learn driver)

Code: Select all

$config['markasjunk_learning_driver'] = 'cmd_learn';
$config['markasjunk_debug'] = true; (this makes a \logs\markasjunk.log in rouncdube)
$config['markasjunk_spam_cmd'] = 'C:\Program Files\JAM Software\SpamAssassin for Windows\sa-learn.exe --spam %f';
$config['markasjunk_ham_cmd'] = 'C:\Program Files\JAM Software\SpamAssassin for Windows\sa-learn.exe --ham %f';
I really doubt that this is working correctly, eg, the null value in second line and i would expect something like: 'Learned tokens from 1 message(s) (1 message(s) examined)'

Code: Select all

[09-Jan-2020 11:49:15 +0100]: <mrv06onu> C:\Program Files\JAM Software\SpamAssassin for Windows\sa-learn.exe --spam "C:\Inetpub\wwwroot\temp\rcm168D.tmp"
[09-Jan-2020 11:49:15 +0100]: <mrv06onu> NULL
When ran from commandline itself it returns:

Code: Select all

C:\Program Files\JAM Software\SpamAssassin for Windows>sa-learn.exe --spam C:\Inetpub\wwwroot\temp\rcm1964.tmp
Learned tokens from 1 message(s) (1 message(s) examined)
I also tried escaping the path to sa-learn.exe with double quotes, but with that change roundcube/php hangs
Anyone ever tried to enable this plugin and got it working?

Re: Roundcube 1.4.x markasjunk

Posted: 2020-01-09 19:10
by SorenR
oops :oops:

Re: Roundcube 1.4.x markasjunk

Posted: 2020-01-09 19:25
by SorenR
RvdH wrote:
2020-01-09 14:27
The old markasjunk2 plugin is now part off the new Roundcube 1.4.x distribution (named markasjunk)

I was trying to get this plugin working, with sa-learn (using cmd_learn driver)

Code: Select all

$config['markasjunk_learning_driver'] = 'cmd_learn';
$config['markasjunk_debug'] = true; (this makes a \logs\markasjunk.log in rouncdube)
$config['markasjunk_spam_cmd'] = 'C:\Program Files\JAM Software\SpamAssassin for Windows\sa-learn.exe --spam %f';
$config['markasjunk_ham_cmd'] = 'C:\Program Files\JAM Software\SpamAssassin for Windows\sa-learn.exe --ham %f';
I really doubt that this is working correctly, eg, the null value in second line and i would expect something like: 'Learned tokens from 1 message(s) (1 message(s) examined)'

Code: Select all

[09-Jan-2020 11:49:15 +0100]: <mrv06onu> C:\Program Files\JAM Software\SpamAssassin for Windows\sa-learn.exe --spam "C:\Inetpub\wwwroot\temp\rcm168D.tmp"
[09-Jan-2020 11:49:15 +0100]: <mrv06onu> NULL
When ran from commandline itself it returns:

Code: Select all

C:\Program Files\JAM Software\SpamAssassin for Windows>sa-learn.exe --spam C:\Inetpub\wwwroot\temp\rcm1964.tmp
Learned tokens from 1 message(s) (1 message(s) examined)
I also tried escaping the path to sa-learn.exe with double quotes, but with that change roundcube/php hangs
Anyone ever tried to enable this plugin and got it working?

Code: Select all

$config['markasjunk_spam_cmd'] = 'C:\Program Files\JAM Software\SpamAssassin for Windows\sa-learn.exe --spam %f -D 2>&1';
$config['markasjunk_ham_cmd'] = 'C:\Program Files\JAM Software\SpamAssassin for Windows\sa-learn.exe --ham %f -D 2>&1';

Re: Roundcube 1.4.x markasjunk

Posted: 2020-01-09 20:05
by Dravion
Sometimes replacing \ with / works or you can try \\ instead of \

Re: Roundcube 1.4.x markasjunk

Posted: 2020-01-09 22:03
by RvdH
SorenR wrote:
2020-01-09 19:25

Code: Select all

$config['markasjunk_spam_cmd'] = 'C:\Program Files\JAM Software\SpamAssassin for Windows\sa-learn.exe --spam %f -D 2>&1';
$config['markasjunk_ham_cmd'] = 'C:\Program Files\JAM Software\SpamAssassin for Windows\sa-learn.exe --ham %f -D 2>&1';
Yeah, i found that debug info elsewhere as well....but it definitely is a path thingy, but once i try to escape the path with double quotes roundcube hangs and i get a timeout error
Other things i tried:

Code: Select all

[09-Jan-2020 14:08:19 +0100]: <8luai7a3> C:\Program Files\JAM Software\SpamAssassin for Windows\sa-learn.exe -D --spam "C:\Inetpub\wwwroot\temp\rcm69D3.tmp" 2>&1
[09-Jan-2020 14:08:19 +0100]: <8luai7a3> 'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

[09-Jan-2020 14:09:15 +0100]: <8luai7a3> ""C:\Program Files\JAM Software\SpamAssassin for Windows\sa-learn.exe"" -D --spam "C:\Inetpub\wwwroot\temp\rcm43B9.tmp" 2>&1
[09-Jan-2020 14:09:15 +0100]: <8luai7a3> '""C:\Program' is not recognized as an internal or external command,
operable program or batch file.

[09-Jan-2020 14:10:26 +0100]: <8luai7a3> C:/Program Files/JAM Software/SpamAssassin for Windows/sa-learn.exe -D --spam "C:\Inetpub\wwwroot\temp\rcm5867.tmp" 2>&1
[09-Jan-2020 14:10:26 +0100]: <8luai7a3> 'C:/Program' is not recognized as an internal or external command,
operable program or batch file.
Dravion wrote:
2020-01-09 20:05
Sometimes replacing \ with / works or you can try \\ instead of \
I think i have tried every possible combination...it simply does not work

I even tried to run it after adding 'C:\Program Files\JAM Software\SpamAssassin for Windows\' to the Windows PATH Environment Variables

Code: Select all

[09-Jan-2020 14:15:12 +0100]: <8luai7a3> sa-learn -D --spam "C:\Inetpub\wwwroot\temp\rcmB547.tmp" 2>&1
[09-Jan-2020 14:15:12 +0100]: <8luai7a3> 'sa-learn' is not recognized as an internal or external command,
operable program or batch file.
FYI, running it from the commandline using only sa-learn and Windows PATH Environment Variable doesn't work either

Re: Roundcube 1.4.x markasjunk

Posted: 2020-01-09 23:00
by Dravion
Ok, maybe the program cant handle special chars and whitespaces in path or has a lenght maximum for a path.

maybe something like this wirks better

c:\test\yourprog.exe

Re: Roundcube 1.4.x markasjunk

Posted: 2020-01-10 01:39
by palinka

Code: Select all

$config['markasjunk_spam_cmd'] = '"C:\\Program Files\\JAM Software\\SpamAssassin for Windows\\sa-learn.exe" --spam %f';
$config['markasjunk_ham_cmd'] = '"C:\\Program Files\\JAM Software\\SpamAssassin for Windows\\sa-learn.exe" --ham %f';
Maybe try this?

Re: Roundcube 1.4.x markasjunk

Posted: 2020-01-10 02:11
by palinka
Or...

Code: Select all

$config['markasjunk_spam_cmd'] = 'cmd.exe /C "C:\\Program Files\\JAM Software\\SpamAssassin for Windows\\sa-learn.exe" --spam %f';
$config['markasjunk_ham_cmd'] = 'cmd.exe /C "C:\\Program Files\\JAM Software\\SpamAssassin for Windows\\sa-learn.exe" --ham %f';
?????

Re: Roundcube 1.4.x markasjunk

Posted: 2020-01-10 04:37
by SorenR
1: Create a symbolic link...

Code: Select all

mklink /D "C:\Program Files\JAM Software\SpamAssassin for Windows" "C:\SpamAssassin"
2: Edit the config.php

Code: Select all

$config['markasjunk_spam_cmd'] = 'C:\SpamAssassin\sa-learn.exe --spam %f -D 2>&1';
$config['markasjunk_ham_cmd'] = 'C:\SpamAssassin\sa-learn.exe --ham %f -D 2>&1';
This the main reason I NEVER install stuff in pre-selected directories. I've had these f***ing problems with Windows since Windows 95!

More than once I have had to manually go thru the registry database and modify stuff... :evil:

You could also try "dir /x" to find the DOS 8.3 directory name... "Program Files" become "PROGRA~1" ;-)

A bit of nostalgia... I remember this from my programming classes while doing my BSc.EE...

https://www.youtube.com/watch?v=lbz2i5pCsuo

Re: Roundcube 1.4.x markasjunk

Posted: 2020-01-10 04:46
by Dravion
You can't get out the MS-DOS Devil of Windows, even if you are Bill G. :lol:

Re: Roundcube 1.4.x markasjunk

Posted: 2020-01-10 05:04
by SorenR
Dravion wrote:
2020-01-10 04:46
You can't get out the MS-DOS Devil of Windows, even if you are Bill G. :lol:
I have actually installed http://getgnuwin32.sourceforge.net/ on all my machines... Sometimes unix commands just fit my fingers better... Like "ls -l" 8)

Re: Roundcube 1.4.x markasjunk

Posted: 2020-01-10 09:17
by RvdH
SorenR wrote:
2020-01-10 04:37
1: Create a symbolic link...

Code: Select all

mklink /D "C:\Program Files\JAM Software\SpamAssassin for Windows" "C:\SpamAssassin"
2: Edit the config.php

Code: Select all

$config['markasjunk_spam_cmd'] = 'C:\SpamAssassin\sa-learn.exe --spam %f -D 2>&1';
$config['markasjunk_ham_cmd'] = 'C:\SpamAssassin\sa-learn.exe --ham %f -D 2>&1';
This the main reason I NEVER install stuff in pre-selected directories. I've had these f***ing problems with Windows since Windows 95!

More than once I have had to manually go thru the registry database and modify stuff... :evil:

You could also try "dir /x" to find the DOS 8.3 directory name... "Program Files" become "PROGRA~1" ;-)

A bit of nostalgia... I remember this from my programming classes while doing my BSc.EE...

https://www.youtube.com/watch?v=lbz2i5pCsuo
symbolic links don't work either, i got a different error though
FYI i think the --dbpath param directive is needed otherwise it creates a new /.spamassassin/bayes in: %UserProfile%

Code: Select all

[10-Jan-2020 08:10:36 +0100]: <cdptf4pi> C:/Tools/sa/sa-learn.exe -D --spam "C:\Inetpub\wwwroot\temp\rcm1F6C.tmp" --dbpath C:/Windows/System32/config/systemprofile/.spamassassin/bayes 2>&1
[10-Jan-2020 08:10:36 +0100]: <cdptf4pi> Can't open perl script ".\runtime\sa-learn": No such file or directory
(this same error i got while using Windows PATH Environment Variable)

@palinka, tried your suggestions as well, but do not work either...


Only thing left to try is to physically move the SpamAssassin installation, i will try this over the weekend

Re: Roundcube 1.4.x markasjunk

Posted: 2020-01-10 09:54
by katip
RvdH wrote:
2020-01-10 09:17
FYI i think the --dbpath param directive is needed otherwise it creates a new /.spamassassin/bayes in: %UserProfile%
did you try to add also --siteconfigpath=<path_to>\etc\spamassassin ?

Re: Roundcube 1.4.x markasjunk

Posted: 2020-01-10 16:15
by palinka
RvdH wrote:
2020-01-10 09:17
FYI i think the --dbpath param directive is needed otherwise it creates a new /.spamassassin/bayes in: %UserProfile%

Code: Select all

[10-Jan-2020 08:10:36 +0100]: <cdptf4pi> C:/Tools/sa/sa-learn.exe -D --spam "C:\Inetpub\wwwroot\temp\rcm1F6C.tmp" --dbpath C:/Windows/System32/config/systemprofile/.spamassassin/bayes 2>&1
[10-Jan-2020 08:10:36 +0100]: <cdptf4pi> Can't open perl script ".\runtime\sa-learn": No such file or directory
(this same error i got while using Windows PATH Environment Variable)
I don't think so, but... the location should be declared in local.cf anyway.

Code: Select all

use_bayes 1
bayes_path C:/Windows/System32/config/systemprofile/.spamassassin/bayes
bayes_auto_learn 0
# bayes_ignore_header X-Bogosity
bayes_ignore_header X-Spam-Flag
bayes_ignore_header X-Spam-Status
For what its worth, although not performed in real-time, Soren's bayes "bootcamp" does an excellent job at training and all you need to do as a user is put the offending message in the spam folder (or ham folder(s) for FPs).

https://www.hmailserver.com/forum/viewtopic.php?t=26866

Re: Roundcube 1.4.x markasjunk

Posted: 2020-01-10 19:48
by SorenR
palinka wrote:
2020-01-10 16:15
RvdH wrote:
2020-01-10 09:17
FYI i think the --dbpath param directive is needed otherwise it creates a new /.spamassassin/bayes in: %UserProfile%

Code: Select all

[10-Jan-2020 08:10:36 +0100]: <cdptf4pi> C:/Tools/sa/sa-learn.exe -D --spam "C:\Inetpub\wwwroot\temp\rcm1F6C.tmp" --dbpath C:/Windows/System32/config/systemprofile/.spamassassin/bayes 2>&1
[10-Jan-2020 08:10:36 +0100]: <cdptf4pi> Can't open perl script ".\runtime\sa-learn": No such file or directory
(this same error i got while using Windows PATH Environment Variable)
I don't think so, but... the location should be declared in local.cf anyway.

Code: Select all

use_bayes 1
bayes_path C:/Windows/System32/config/systemprofile/.spamassassin/bayes
bayes_auto_learn 0
# bayes_ignore_header X-Bogosity
bayes_ignore_header X-Spam-Flag
bayes_ignore_header X-Spam-Status
For what its worth, although not performed in real-time, Soren's bayes "bootcamp" does an excellent job at training and all you need to do as a user is put the offending message in the spam folder (or ham folder(s) for FPs).

https://www.hmailserver.com/forum/viewtopic.php?t=26866
Sorry I can't help with the markasjunk2 stuff since my Roundcube is hosted on my NAS. I have been thinking of letting spamc do the job ... it's the only way when Roundcube and SpamAssassin are on two different hosts.

The latest sa-learn.vbs from the Bootcamp code demonstrate the use of spamc...

I would imagine it should look like this...

Code: Select all

$config['markasjunk_spam_cmd'] = 'spamc -d sahost.mydomain.tld -p 783 -L spam < &f';
$config['markasjunk_ham_cmd'] = 'spamc -d sahost.mydomain.tld -p 783 -L ham < &f';

Re: Roundcube 1.4.x markasjunk

Posted: 2020-01-12 13:23
by RvdH
:oops: :oops: :oops:

Sorry guys, seems my original command worked just fine once i added access & read/write permission for IUSR on 'C:\Windows\system32\config\systemprofile\.spamassassin'

the complete commands are:

Code: Select all

$config['markasjunk_spam_cmd'] = '"C:\Program Files\JAM Software\SpamAssassin for Windows\sa-learn.exe" --spam %f --dbpath "C:\Windows\System32\config\systemprofile\.spamassassin\bayes"';
$config['markasjunk_ham_cmd'] = '"C:\Program Files\JAM Software\SpamAssassin for Windows\sa-learn.exe" --ham %f --dbpath "C:\Windows\System32\config\systemprofile\.spamassassin\bayes"';

Re: Roundcube 1.4.x markasjunk

Posted: 2020-01-12 13:24
by jimimaseye
Oops.

(It can happen to any of us. )

[Entered by mobile. Excuse my spelling.]