Roundcube/Plugin/markasjunk: Unterschied zwischen den Versionen
K Textersetzung - „ “ durch „ “ |
|||
| (3 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
<noinclude> | |||
<!-- | |||
---- | |||
{{Navigation|<zurück>|<nachste>}} | |||
---- | |||
--> | |||
'''Roundcube/Plugin/markasjunk - Mark-as-junk''' | |||
</noinclude> | |||
== Beschreibung == | |||
Adds the sender's email address to the blacklist, or run a command such as sa_learn. | Adds the sender's email address to the blacklist, or run a command such as sa_learn. | ||
* Shipped with Roundcube | |||
* Shipped with | |||
* README (detailed drivers howto) | * README (detailed drivers howto) | ||
| Zeile 11: | Zeile 18: | ||
cp config.inc.php.dist config.inc.php | cp config.inc.php.dist config.inc.php | ||
=== | === sa_blacklist driver === | ||
Requires <code>spamassassin-user-prefs</code> (<code>sauserprefs</code>) plugin and <code>Spamassassin Userprefs</code> | |||
Clicking on the button "Mark as Junk" creates a new "Black_list from" record in the database and moves the message in the Junk folder eventually marking it as read. Clicking on the button "Mark as Ham" creates a record "White_list from" in the database and restores the message in the Inbox. | Clicking on the button "Mark as Junk" creates a new "Black_list from" record in the database and moves the message in the Junk folder eventually marking it as read. Clicking on the button "Mark as Ham" creates a record "White_list from" in the database and restores the message in the Inbox. | ||
| Zeile 21: | Zeile 27: | ||
----The following <code>cmd_learn</code> driver should not be used anymore, as we already setup a cronjob for training our bayesian filter and reporting our spam (more info here). | ----The following <code>cmd_learn</code> driver should not be used anymore, as we already setup a cronjob for training our bayesian filter and reporting our spam (more info here). | ||
=== | === cmd_learn driver === | ||
This driver calls an external command to process the message. You can use it to call <code>sa_learn</code> and <code>spamassassin</code> in cascade. Be aware that you have to eventually remove <code>shell_exec</code> from <code>disable_functions</code> in your <code>php.ini</code> so that <code>php</code> can execute shell commands. | This driver calls an external command to process the message. You can use it to call <code>sa_learn</code> and <code>spamassassin</code> in cascade. Be aware that you have to eventually remove <code>shell_exec</code> from <code>disable_functions</code> in your <code>php.ini</code> so that <code>php</code> can execute shell commands. | ||
| Zeile 41: | Zeile 44: | ||
/usr/local/bin/spamassassin --nocreate-prefs --revoke < $2 >> /var/log/spamassassin/spamassassin.log 2>&1 | /usr/local/bin/spamassassin --nocreate-prefs --revoke < $2 >> /var/log/spamassassin/spamassassin.log 2>&1 | ||
__EOF__ | __EOF__ | ||
Again, the first command feeds the mail to <code>SpamAssassin</code>, allowing it to 'learn' which signs are likely to mean ham. The latter one revoke the report to <code>Razor</code>. Apparently the revocation is not possible with <code>Pyzor</code> and <code>Spamcop</code> (but I didn't look deeply in my log yet). | Again, the first command feeds the mail to <code>SpamAssassin</code>, allowing it to 'learn' which signs are likely to mean ham. The latter one revoke the report to <code>Razor</code>. Apparently the revocation is not possible with <code>Pyzor</code> and <code>Spamcop</code> (but I didn't look deeply in my log yet). | ||
Provide execute priviledges to the newly created scripts | Provide execute priviledges to the newly created scripts | ||
chmod +x /usr/local/bin/teach_spam.sh /usr/local/bin/revoke_spam.sh | chmod +x /usr/local/bin/teach_spam.sh /usr/local/bin/revoke_spam.sh | ||
Set these options | Set these options | ||
$config['markasjunk_learning_driver'] = 'cmd_learn'; | $config['markasjunk_learning_driver'] = 'cmd_learn'; | ||
$config['markasjunk_spam_cmd'] = '/usr/local/bin/teach_spam.sh %u %f'; | $config['markasjunk_spam_cmd'] = '/usr/local/bin/teach_spam.sh %u %f'; | ||
$config['markasjunk_ham_cmd'] = '/usr/local/bin/revoke_spam.sh %u %f'; | $config['markasjunk_ham_cmd'] = '/usr/local/bin/revoke_spam.sh %u %f'; | ||
Setup che logrotate for the above log files: | Setup che logrotate for the above log files: | ||
cat > /etc/logrotate.d/spam_reports << __EOF__ | cat > /etc/logrotate.d/spam_reports << __EOF__ | ||
| Zeile 62: | Zeile 68: | ||
} | } | ||
__EOF__ | __EOF__ | ||
You have to assign <code>+w</code> priviledges to <code>apache</code> in the log dir and to <code>Razor</code>'s ''identity-*'' files, as <code>Roundcube</code> is runned by apache: | You have to assign <code>+w</code> priviledges to <code>apache</code> in the log dir and to <code>Razor</code>'s ''identity-*'' files, as <code>Roundcube</code> is runned by apache: | ||
chgrp apache /var/log/spamassassin | chgrp apache /var/log/spamassassin | ||
| Zeile 69: | Zeile 76: | ||
chmod 644 /etc/mail/spamassassin/.razor/razor-agent.log | chmod 644 /etc/mail/spamassassin/.razor/razor-agent.log | ||
=== | === multi_driver driver === | ||
* Original driver for the ancient <code>markasjunk2</code> plugin | * Original driver for the ancient <code>markasjunk2</code> plugin | ||
* <code>multi_driver</code> plugin patched for <code>markasjunk</code> (diff here) | * <code>multi_driver</code> plugin patched for <code>markasjunk</code> (diff here) | ||
| Zeile 84: | Zeile 90: | ||
Be aware that the <code>markasjunk</code>'s <code>multi_driver</code> driver, when enabled, seems to prevent the display of the attached images. Why this driver is related to this problem is a mistery. Any comment on this will be welcome. | Be aware that the <code>markasjunk</code>'s <code>multi_driver</code> driver, when enabled, seems to prevent the display of the attached images. Why this driver is related to this problem is a mistery. Any comment on this will be welcome. | ||
== Installation == | |||
<syntaxhighlight lang="bash" highlight="1" line copy> | |||
< /syntaxhighlight> | |||
== Anwendung == | |||
<syntaxhighlight lang="bash" highlight="1" line copy> | |||
< /syntaxhighlight> | |||
<!-- output --> | |||
<syntaxhighlight lang="bash" highlight="" line> | |||
< /syntaxhighlight> | |||
=== Problembehebung === | |||
== Konfiguration == | |||
=== Dateien === | |||
{| class="wikitable options big" | |||
|- | |||
! Datei !! Beschreibung | |||
|- | |||
| || | |||
|- | |||
| || | |||
|} | |||
<noinclude> | |||
<!-- | |||
---- | |||
{{Navigation|<zurück>|<nachste>}} | |||
---- | |||
--> | |||
== Anhang == | |||
=== Siehe auch === | |||
<div style="column-count:2"> | |||
<categorytree hideroot=on mode="pages">{{BASEPAGENAME}}</categorytree> | |||
</div> | |||
---- | |||
{{Special:PrefixIndex/{{BASEPAGENAME}}/}} | |||
=== Dokumentation === | |||
<!-- | |||
; Man-Page | |||
# [https://manpages.debian.org/stable/procps/pgrep.1.de.html prep(1)] | |||
; Info-Pages | |||
--> | |||
=== Links === | |||
==== Projekt ==== | |||
==== Weblinks ==== | |||
# https://github.com/roundcube/roundcubemail/tree/master/plugins/markasjunk | |||
# https://www.allerstorfer.at/roundcube-nachricht-als-spam-markieren/ | # https://www.allerstorfer.at/roundcube-nachricht-als-spam-markieren/ | ||
<!-- | |||
{{DEFAULTSORT:new}} | |||
{{DISPLAYTITLE:new}} | |||
--> | |||
[[Kategorie:Roundcube/Plugin]] | [[Kategorie:Roundcube/Plugin]] | ||
</noinclude> | |||
Aktuelle Version vom 7. Juli 2026, 08:44 Uhr
Roundcube/Plugin/markasjunk - Mark-as-junk
Beschreibung
Adds the sender's email address to the blacklist, or run a command such as sa_learn.
- Shipped with Roundcube
- README (detailed drivers howto)
With this nice plugin the end user can add the sender's email address to the blacklist, or run a command such as sa_learn.
Create the config file from the template
cp config.inc.php.dist config.inc.php
sa_blacklist driver
Requires spamassassin-user-prefs (sauserprefs) plugin and Spamassassin Userprefs
Clicking on the button "Mark as Junk" creates a new "Black_list from" record in the database and moves the message in the Junk folder eventually marking it as read. Clicking on the button "Mark as Ham" creates a record "White_list from" in the database and restores the message in the Inbox.
To use the plugin with the driver sa_blacklist:
$config['markasjunk_learning_driver'] = 'sa_blacklist';
The following cmd_learn driver should not be used anymore, as we already setup a cronjob for training our bayesian filter and reporting our spam (more info here).
cmd_learn driver
This driver calls an external command to process the message. You can use it to call sa_learn and spamassassin in cascade. Be aware that you have to eventually remove shell_exec from disable_functions in your php.ini so that php can execute shell commands.
Prepare the shell script with the commands to run when clicking on the "Mark as junk" button. Save as /usr/local/bin/teach_spam.sh the following code
cat > /usr/local/bin/teach_spam.sh << __EOF__ #!/bin/bash /usr/local/bin/sa-learn --spam --username=$1 $2 >> /var/log/spamassassin/sa_learn.log 2>&1 /usr/local/bin/spamassassin --nocreate-prefs --report < $2 >> /var/log/spamassassin/spamassassin.log 2>&1 __EOF__
The first command feeds the mail to SpamAssassin, allowing it to 'learn' what signs are likely to mean spam. The latter one reports the mail as spam to Razor, Pyzor and Spamcop.
Now prepare the shell script with the commands to run when clicking on the "Mark as ham" button. Save as /usr/local/bin/revoke_spam.sh the following code
cat > /usr/local/bin/revoke_spam.sh << __EOF__ #!/bin/bash /usr/local/bin/sa-learn --ham --username=$1 $2 >> /var/log/spamassassin/sa_learn.log 2>&1 /usr/local/bin/spamassassin --nocreate-prefs --revoke < $2 >> /var/log/spamassassin/spamassassin.log 2>&1 __EOF__
Again, the first command feeds the mail to SpamAssassin, allowing it to 'learn' which signs are likely to mean ham. The latter one revoke the report to Razor. Apparently the revocation is not possible with Pyzor and Spamcop (but I didn't look deeply in my log yet).
Provide execute priviledges to the newly created scripts
chmod +x /usr/local/bin/teach_spam.sh /usr/local/bin/revoke_spam.sh
Set these options
$config['markasjunk_learning_driver'] = 'cmd_learn'; $config['markasjunk_spam_cmd'] = '/usr/local/bin/teach_spam.sh %u %f'; $config['markasjunk_ham_cmd'] = '/usr/local/bin/revoke_spam.sh %u %f';
Setup che logrotate for the above log files:
cat > /etc/logrotate.d/spam_reports << __EOF__
/var/log/spamassassin/spamassassin.log /var/log/spamassassin/sa_learn.log {
su root apache
rotate 5
daily
missingok
notifempty
delaycompress
create 664 root apache
sharedscripts
}
__EOF__
You have to assign +w priviledges to apache in the log dir and to Razor's identity-* files, as Roundcube is runned by apache:
chgrp apache /var/log/spamassassin chmod g+w /var/log/spamassassin chgrp apache /etc/mail/spamassassin/.razor/identity-* chmod 640 /etc/mail/spamassassin/.razor/identity-* chmod 644 /etc/mail/spamassassin/.razor/razor-agent.log
multi_driver driver
- Original driver for the ancient
markasjunk2plugin multi_driverplugin patched formarkasjunk(diff here)
It is possible to run multiple drivers when marking a message as spam/ham. I patched the original version by Philip Weir to work with markasjunk and run sa_blacklist followed by cmd_learn.
Install as follows:
cd /var/www/roundcube/plugins/markasjunk/drivers wget https://notes.sagredo.eu/files/qmail/patches/roundcube/markasjunk-multi_driver/multi_driver.txt mv multi_driver.txt multi_driver.php
Set the correct driver in the config file:
$config['markasjunk_learning_driver'] = 'multi_driver';
Be aware that the markasjunk's multi_driver driver, when enabled, seems to prevent the display of the attached images. Why this driver is related to this problem is a mistery. Any comment on this will be welcome.
Installation
<syntaxhighlight lang="bash" highlight="1" line copy> < /syntaxhighlight>
Anwendung
<syntaxhighlight lang="bash" highlight="1" line copy> < /syntaxhighlight>
<syntaxhighlight lang="bash" highlight="" line> < /syntaxhighlight>
Problembehebung
Konfiguration
Dateien
| Datei | Beschreibung |
|---|---|
Anhang
Siehe auch
Dokumentation
Links
Projekt
Weblinks
- https://github.com/roundcube/roundcubemail/tree/master/plugins/markasjunk
- https://www.allerstorfer.at/roundcube-nachricht-als-spam-markieren/