• Debian 11 is approaching its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.80 will be the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

Question How I enable anti-virus for all accounts in Onyx? The old way doesn't work anymore.

HHawk

Regular Pleskian
Hi guys,

I have a quick question, how do I enable anti-virus on all email accounts from SSH in Onyx?

The old way, which was working for Plesk 12.5.3, doesn't work anymore.
This is what I used in the past:

for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select concat(mail.mail_name,\"@\",domains.name) as address from mail,domains,accounts where mail.dom_id=domains.id and mail.account_id=accounts.id order by address"`; do /usr/local/psa/bin/mail -u $i -antivirus in; done

I tried to use the command "plesk db" first and enter the code above, but it doesn't work.

Any ideas?
 
Hi HHawk,

could you pls. tell us the output of the command
Code:
for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select concat(mail.mail_name,\"@\",domains.name) as address from mail,domains,accounts where mail.dom_id=domains.id and mail.account_id=accounts.id order by address"`; do /usr/local/psa/bin/mail -u $i -antivirus in; done
... and in addition, what is stored in your "panel.log" ?
 
Changing the database doesn't change the mailbox itself. you can use this php script to change all mailboxes.

PHP:
<?php

$pwfile = "/etc/psa/.psa.shadow";

$pw = trim(file_get_contents($pwfile));

mysql_connect("localhost","admin", $pw);
mysql_select_db("psa");

if (!($resdoms=mysql_query("SELECT domains.id, domains.name, mail.mail_name, mail.postbox, mail.spamfilter FROM mail, domains WHERE domains.id=mail.dom_id AND mail.postbox=true AND mail.spamfilter=false ORDER BY domains.name;"))) {
        print("MySQL error: " . mysql_error());
}

$domsfound = mysql_num_rows($resdoms);
echo "$domsfound domains found ... Starting\n";
    for ($r = 0; $r < mysql_num_rows( $resdoms); $r++) {
        $row = mysql_fetch_array ($resdoms);
    $mailbox = $row[2] . "@" . $row[1];
    $command = "plesk bin mail -u $mailbox -manage-virusfilter true";
    echo "will do: $command";
    //$done = shell_exec("$command");
    echo "$done";
    }

?>

This runs a test, remover the comment before //$done = shell_exec("$command"); to actualy do it.

change the $command = "plesk bin mail -u $mailbox -manage-virusfilter true";
in $command = "plesk bin spamassassin --update $mailbox -status true -personal-conf true -action mark";
and then the script can enable spam filter on all mailboxes.

Full list of parameters here

mail: Mail Accounts

regards
Jan
 
... mail.spamfilter ... AND mail.spamfilter=false

I see i forgot to change the query. This query is for finding mailboxes with spamfilter not enabled.

the virusfilter query is

SELECT domains.id, domains.name, mail.mail_name, mail.postbox, mail.virusfilter FROM mail, domains WHERE domains.id=mail.dom_id AND mail.postbox=true and virusfilter = 'none' ORDER BY domains.name;

regards
Jan
 
Back
Top