Roundcube 1.4.x markasjunk

Forum for things that doesn't really have anything to do with hMailServer. Such as php.ini, beer, etc etc.
Post Reply
User avatar
RvdH
Senior user
Senior user
Posts: 1080
Joined: 2008-06-27 14:42
Location: Netherlands

Roundcube 1.4.x markasjunk

Post by RvdH » 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?
CIDR to RegEx: d-fault.nl/CIDRtoRegEx
DNS Lookup: d-fault.nl/DNSTools
DNSBL Lookup: d-fault.nl/DNSBLLookup
GEOIP Lookup: d-fault.nl/GeoipLookup

User avatar
SorenR
Senior user
Senior user
Posts: 3582
Joined: 2006-08-21 15:38
Location: Denmark

Re: Roundcube 1.4.x markasjunk

Post by SorenR » 2020-01-09 19:10

oops :oops:
Last edited by SorenR on 2020-01-09 19:27, edited 1 time in total.
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

User avatar
SorenR
Senior user
Senior user
Posts: 3582
Joined: 2006-08-21 15:38
Location: Denmark

Re: Roundcube 1.4.x markasjunk

Post by SorenR » 2020-01-09 19:25

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';
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

User avatar
Dravion
Senior user
Senior user
Posts: 1688
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: Roundcube 1.4.x markasjunk

Post by Dravion » 2020-01-09 20:05

Sometimes replacing \ with / works or you can try \\ instead of \

User avatar
RvdH
Senior user
Senior user
Posts: 1080
Joined: 2008-06-27 14:42
Location: Netherlands

Re: Roundcube 1.4.x markasjunk

Post by RvdH » 2020-01-09 22:03

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
CIDR to RegEx: d-fault.nl/CIDRtoRegEx
DNS Lookup: d-fault.nl/DNSTools
DNSBL Lookup: d-fault.nl/DNSBLLookup
GEOIP Lookup: d-fault.nl/GeoipLookup

User avatar
Dravion
Senior user
Senior user
Posts: 1688
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: Roundcube 1.4.x markasjunk

Post by Dravion » 2020-01-09 23:00

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

palinka
Senior user
Senior user
Posts: 1942
Joined: 2017-09-12 17:57

Re: Roundcube 1.4.x markasjunk

Post by palinka » 2020-01-10 01:39

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?

palinka
Senior user
Senior user
Posts: 1942
Joined: 2017-09-12 17:57

Re: Roundcube 1.4.x markasjunk

Post by palinka » 2020-01-10 02:11

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';
?????

User avatar
SorenR
Senior user
Senior user
Posts: 3582
Joined: 2006-08-21 15:38
Location: Denmark

Re: Roundcube 1.4.x markasjunk

Post by SorenR » 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
Last edited by SorenR on 2020-01-10 04:56, edited 1 time in total.
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

User avatar
Dravion
Senior user
Senior user
Posts: 1688
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: Roundcube 1.4.x markasjunk

Post by Dravion » 2020-01-10 04:46

You can't get out the MS-DOS Devil of Windows, even if you are Bill G. :lol:

User avatar
SorenR
Senior user
Senior user
Posts: 3582
Joined: 2006-08-21 15:38
Location: Denmark

Re: Roundcube 1.4.x markasjunk

Post by SorenR » 2020-01-10 05:04

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)
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

User avatar
RvdH
Senior user
Senior user
Posts: 1080
Joined: 2008-06-27 14:42
Location: Netherlands

Re: Roundcube 1.4.x markasjunk

Post by RvdH » 2020-01-10 09:17

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
CIDR to RegEx: d-fault.nl/CIDRtoRegEx
DNS Lookup: d-fault.nl/DNSTools
DNSBL Lookup: d-fault.nl/DNSBLLookup
GEOIP Lookup: d-fault.nl/GeoipLookup

User avatar
katip
Senior user
Senior user
Posts: 753
Joined: 2006-12-22 07:58
Location: Istanbul

Re: Roundcube 1.4.x markasjunk

Post by katip » 2020-01-10 09:54

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 ?
Katip
--
HMS 5.7.0 x64, MariaDB 10.4.10 x64, SA 3.4.2, ClamAV 0.101.2 + SaneS

palinka
Senior user
Senior user
Posts: 1942
Joined: 2017-09-12 17:57

Re: Roundcube 1.4.x markasjunk

Post by palinka » 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

User avatar
SorenR
Senior user
Senior user
Posts: 3582
Joined: 2006-08-21 15:38
Location: Denmark

Re: Roundcube 1.4.x markasjunk

Post by SorenR » 2020-01-10 19:48

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';
SørenR.

“Those who don't know history are doomed to repeat it.”
― Edmund Burke

User avatar
RvdH
Senior user
Senior user
Posts: 1080
Joined: 2008-06-27 14:42
Location: Netherlands

Re: Roundcube 1.4.x markasjunk

Post by RvdH » 2020-01-12 13:23

: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"';
Last edited by RvdH on 2020-01-12 13:28, edited 2 times in total.
CIDR to RegEx: d-fault.nl/CIDRtoRegEx
DNS Lookup: d-fault.nl/DNSTools
DNSBL Lookup: d-fault.nl/DNSBLLookup
GEOIP Lookup: d-fault.nl/GeoipLookup

User avatar
jimimaseye
Moderator
Moderator
Posts: 8587
Joined: 2011-09-08 17:48

Re: Roundcube 1.4.x markasjunk

Post by jimimaseye » 2020-01-12 13:24

Oops.

(It can happen to any of us. )

[Entered by mobile. Excuse my spelling.]
5.7 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

Post Reply