• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Bulk Switch on antivirus protection for all Mailboxes

Richard1

New Pleskian
Is there a command to turn on antivirus for all mailboxes without having to enter each mailbox and update manually. I have over 800 mailboxes which need updating, thanks.
 
Thank you for your response Abdi,

I forgot to mention that I have this turned on as per screengrab below, sorry:

rckco4.gif


Yet in Subscription Control Panel --> Mail --> [email protected] and on the Antivirus tab, by default I see the following:

2yzaixx.gif


So while server wide antivirus appears to be enabled, this doesn't appear to be the case for individual mailboxes.
 
Hi Richard1,

please have a look at the command "/usr/local/psa/bin/mail --help". You will see, that you have as well the option to define the antivirus settings.

Code:
-antivirus    <off|inout|in|out>    manages antivirus filtering for mail traffic.
              "Off" disables antivirus filtering,
              "Inout" enables it for mail traffic going in any direction,
              "In" enables it for incoming mail only, and
              "Out" for outgoing mail only.


A possible command would be: /usr/local/psa/bin/mail -update YOUR_EMAIL_NAME@YOUR_DOMAIN:COM -antivirus inout


To manage a bunch of eMail - adresses in one go, please create a TXT - file with the eMail - adresses ( f.e.: vim /root/emails.txt ) and add each eMail - adress, one for each line:
and create afterwards a shell - script ( f.e.: vim /root/set_av_inout.sh ):
Code:
for MAIL in $(cat /root/emails.txt)
do
    /usr/local/psa/bin/mail -update $MAIL -antivirus inout
done

Now you modify this script to be executable with: chmod +x /root/set_av_inout.sh
... and run the script with:
cd /root
./set_av_inout.sh



If you are unsure, how to get all eMail - adresses on your server, please use the SQL - query as f.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;
 
Use this script for mass update of all your mailboxes:

# 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 inout; done
 
Sorry for the late reply UGHH01 and IgorG,

And thank you very much - this is exactly what I needed. Are there any plans to implement this within the Plesk GUI? Having this functionality within Service Plan settings would be a great feature.

Thanks again.
 
Automatic activation of antispam or antivirus through Service Plan synchronization was not implemented because it would have led to a serious drop in performance of the Plesk server in the case of mass mailboxes creation. For example, spamassassin is very demanding of system resources.
Therefore as possible solution you can use Event Manager for event 'mailbox creation' or something else. You can use variables for defining needed domains and mailboxes. More information in Plesk documentation.
 
Back
Top