| 1 |
.. cyrusman:: cyr_virusscan(8) |
| 2 |
|
| 3 |
.. highlight:: none |
| 4 |
|
| 5 |
.. author: Nic Bernstein (Onlight) |
| 6 |
|
| 7 |
.. _imap-reference-manpages-systemcommands-cyr_virusscan: |
| 8 |
|
| 9 |
================= |
| 10 |
**cyr_virusscan** |
| 11 |
================= |
| 12 |
|
| 13 |
Scan for viruses using configured virus scanner or manage infected messages using search criteria. |
| 14 |
|
| 15 |
Synopsis |
| 16 |
======== |
| 17 |
|
| 18 |
.. parsed-literal:: |
| 19 |
|
| 20 |
**cyr_virusscan** [ **-C** *config-file* ] [ **-s** *imap-search-string* ] [ **-r** [ **-n**] ] [**-v**] [ *mboxpattern1* ... ] |
| 21 |
|
| 22 |
Description |
| 23 |
=========== |
| 24 |
|
| 25 |
**cyr_virusscan** can be used to invoke an external virus scanner (currently |
| 26 |
only `ClamAV <https://www.clamav.net/documents/installing-clamav>`_ is |
| 27 |
supported) to scan specified IMAP mailboxes. If no mboxpattern is given, |
| 28 |
**cyr_virusscan** works on all mailboxes. |
| 29 |
|
| 30 |
Alternately, with the **-s** option, the IMAP SEARCH string will be used as a |
| 31 |
specification of messages which are *assumed* to be infected, and will be |
| 32 |
treated as such. The virus scanner is not invoked. Useful for removing messages |
| 33 |
without a distinct signature, such as Phish. |
| 34 |
|
| 35 |
A table of infected messages will be output. |
| 36 |
|
| 37 |
To remove infected messages, use the **-r** flag. Infected messages will be expunged |
| 38 |
from the user's mailbox. |
| 39 |
|
| 40 |
With the notify flag, **-n**, notifications will be appended to the inbox of |
| 41 |
the mailbox owner, containing message digest information for the affected mail. |
| 42 |
This flag only works in combination with **-r**. The notification message |
| 43 |
can by customised by template, for details see `Notifications`_ below. |
| 44 |
|
| 45 |
**cyr_virusscan** can be configured to run periodically by cron(8) |
| 46 |
via crontab(5) or your preferred method (i.e. /etc/cron.hourly), or by |
| 47 |
:cyrusman:`master(8)` via the EVENTS{} section in |
| 48 |
:cyrusman:`cyrus.conf(5)`. |
| 49 |
|
| 50 |
**cyr_virusscan** |default-conf-text| |
| 51 |
|
| 52 |
Note that Cyrus does not ship with any virus scanners: you need to install |
| 53 |
one separately to make use of it with Cyrus. |
| 54 |
|
| 55 |
Options |
| 56 |
======= |
| 57 |
|
| 58 |
.. program:: cyr_virusscan |
| 59 |
|
| 60 |
.. option:: -C config-file |
| 61 |
|
| 62 |
|cli-dash-c-text| |
| 63 |
|
| 64 |
|
| 65 |
.. option:: -n, --notify |
| 66 |
|
| 67 |
Notify mailbox owner of deleted messages via email. This flag is |
| 68 |
only operable in combination with **-r**. |
| 69 |
|
| 70 |
.. option:: -r, --remove-infected |
| 71 |
|
| 72 |
Remove infected messages. |
| 73 |
|
| 74 |
.. option:: -s imap-search-string, --search=imap-search-string |
| 75 |
|
| 76 |
Rather than scanning for viruses, messages matching the search |
| 77 |
criteria will be treated as infected. |
| 78 |
|
| 79 |
.. option:: -v, --verbose |
| 80 |
|
| 81 |
Produce more verbose output |
| 82 |
|
| 83 |
Notifications |
| 84 |
============= |
| 85 |
|
| 86 |
When the **-n** flag is provided, notifications are sent to mailbox owners |
| 87 |
when infected messages are removed. One notification is sent per owner, |
| 88 |
containing a digest of each message that was deleted from any of their |
| 89 |
mailboxes. |
| 90 |
|
| 91 |
The default notification subject is "Automatically deleted mail", which |
| 92 |
can be overridden by setting ``virusscan_notification_subject`` in |
| 93 |
:cyrusman:`imapd.conf(5)` to a UTF-8 value. |
| 94 |
|
| 95 |
Each infected message will be described according to the following template:: |
| 96 |
|
| 97 |
The following message was deleted from mailbox '%MAILBOX%' |
| 98 |
because it was infected with virus '%VIRUS%' |
| 99 |
|
| 100 |
Message-ID: %MSG_ID% |
| 101 |
Date: %MSG_DATE% |
| 102 |
From: %MSG_FROM% |
| 103 |
Subject: %MSG_SUBJECT% |
| 104 |
IMAP UID: %MSG_UID% |
| 105 |
|
| 106 |
To use a custom template, create a UTF-8 file containing your desired text |
| 107 |
and using the same %-delimited substitutions as above, and set the |
| 108 |
``virusscan_notification_template`` option in :cyrusman:`imapd.conf(5)` to |
| 109 |
its path. |
| 110 |
|
| 111 |
The notification message will be properly MIME-encoded at delivery. Do not |
| 112 |
pre-encode the template file or the subject! |
| 113 |
|
| 114 |
When **cyr_virusscan** starts up, if notifications have been requested (with |
| 115 |
the **-n** flag), a basic sanity check of the template will be performed |
| 116 |
prior to initialising the antivirus engine. If it appears that the |
| 117 |
resultant notifications would be undeliverable for some reason, |
| 118 |
**cyr_virusscan** will exit immediately with an error, rather than risk |
| 119 |
deleting messages without notifying. |
| 120 |
|
| 121 |
Examples |
| 122 |
======== |
| 123 |
|
| 124 |
.. parsed-literal:: |
| 125 |
|
| 126 |
**cyr_virusscan** |
| 127 |
|
| 128 |
.. |
| 129 |
|
| 130 |
Scan all mailboxes, printing report on the screen. Do not |
| 131 |
remove infected messages. |
| 132 |
|
| 133 |
.. only:: html |
| 134 |
|
| 135 |
:: |
| 136 |
|
| 137 |
Using ClamAV virus scanner |
| 138 |
Loaded 5789330 virus signatures. |
| 139 |
|
| 140 |
Mailbox Name Msg UID Status Virus Name |
| 141 |
---------------------------------------- ---------- ------ -------------------------------------------------- |
| 142 |
user.betty 185395 READ Heuristics.Phishing.Email.SpoofedDomain |
| 143 |
user.betty.Bank stuff 9 READ Html.Phishing.Bank-1172 |
| 144 |
user.betty.Bank stuff 10 READ Html.Phishing.Bank-1172 |
| 145 |
user.betty.Bank stuff 11 READ Html.Phishing.Bank-1172 |
| 146 |
|
| 147 |
Mailbox Name Msg UID Status Virus Name |
| 148 |
---------------------------------------- ---------- ------ -------------------------------------------------- |
| 149 |
user.bovik 17426 READ Email.Trojan.Trojan-1051 |
| 150 |
|
| 151 |
.. parsed-literal:: |
| 152 |
|
| 153 |
**cyr_virusscan** -r -n user/bovik |
| 154 |
|
| 155 |
.. |
| 156 |
|
| 157 |
Scan mailbox *user/bovik*, removing infected messages and append |
| 158 |
notifications to Bovik's inbox. |
| 159 |
|
| 160 |
.. only:: html |
| 161 |
|
| 162 |
:: |
| 163 |
|
| 164 |
Mailbox Name Msg UID Status Virus Name |
| 165 |
---------------------------------------- ---------- ------ -------------------------------------------------- |
| 166 |
user.bovik 17426 READ Email.Trojan.Trojan-1051 |
| 167 |
|
| 168 |
.. only:: html |
| 169 |
|
| 170 |
A message like this would end up in bovik's inbox: |
| 171 |
|
| 172 |
:: |
| 173 |
|
| 174 |
The following message was deleted from mailbox 'INBOX' |
| 175 |
because it was infected with virus 'Email.Trojan.Trojan-1051' |
| 176 |
|
| 177 |
Message-ID: <[email protected]> |
| 178 |
Date: Tue, 13 Aug 2013 18:19:22 +0300 (EEST) |
| 179 |
From: "FEDEX Thomas Cooper" <[email protected]> |
| 180 |
Subject: Problem with the delivery of parcel |
| 181 |
IMAP UID: 17426 |
| 182 |
|
| 183 |
.. |
| 184 |
|
| 185 |
.. parsed-literal:: |
| 186 |
|
| 187 |
**cyr_virusscan** -r -n -s 'SUBJECT "Fedex"' user/bovik |
| 188 |
|
| 189 |
.. |
| 190 |
|
| 191 |
Search mailbox user/bovik for messages which have Fedex in the |
| 192 |
subject line, removing them all, and appending notifications to |
| 193 |
Bovik's inbox. |
| 194 |
|
| 195 |
.. only:: html |
| 196 |
|
| 197 |
:: |
| 198 |
|
| 199 |
Mailbox Name Msg UID Status Virus Name |
| 200 |
---------------------------------------- ---------- ------ -------------------------------------------------- |
| 201 |
user.bovik 17185 READ Cyrus Administrator Targeted Removal (Phish, etc.) |
| 202 |
user.bovik 17203 READ Cyrus Administrator Targeted Removal (Phish, etc.) |
| 203 |
user.bovik 17338 READ Cyrus Administrator Targeted Removal (Phish, etc.) |
| 204 |
user.bovik 17373 READ Cyrus Administrator Targeted Removal (Phish, etc.) |
| 205 |
user.bovik 19238 READ Cyrus Administrator Targeted Removal (Phish, etc.) |
| 206 |
user.bovik 19268 READ Cyrus Administrator Targeted Removal (Phish, etc.) |
| 207 |
|
| 208 |
.. |
| 209 |
|
| 210 |
History |
| 211 |
======= |
| 212 |
|
| 213 |
Virus scan support was first introduced in Cyrus version 3.0. |
| 214 |
|
| 215 |
Files |
| 216 |
===== |
| 217 |
|
| 218 |
/etc/imapd.conf |
| 219 |
|
| 220 |
See Also |
| 221 |
======== |
| 222 |
|
| 223 |
:cyrusman:`imapd.conf(5)`, :cyrusman:`master(8)`, `ClamAV <https://www.clamav.net/documents/installing-clamav>`_ |