]> git.proxmox.com Git - pmg-api.git/commit
add custom_check handling
authorStoiko Ivanov <s.ivanov@proxmox.com>
Wed, 13 Mar 2019 20:39:41 +0000 (21:39 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 14 Mar 2019 06:15:29 +0000 (07:15 +0100)
commit89d4d1555a454be5cdb00122cb980b2a01a6a3d7
tree0082e894cdc1f36a3cb2eb113d59c9cf11d9fe81
parent84b19e6d79c1e5db34f951108fe2f8ef75c05636
add custom_check handling

This patch enables users to create their own script for analyzing mails.
The 'custom_check' needs to be enabled via pmg.conf (optionally the check's
executable path ('custom_check_path') can be set, defaulting to
'/usr/local/bin/pmg-custom-check').

'pmg-smtp-filter' calls the check before analyze_virus (which in turn calls
clamav or avast). The custom_check 'api' is kept simple:
* Input: the check gets 2 arguments:
  * the 'api-version' (currently 'v1') - for potential future change of the
    invocation
  * the 'queue-file-name' - a filename, which contains the complete e-mail as
    rfc822/eml file
* Output: the check needs to return 2 lines on STDOUT:
  * the 'api-version' (currently 'v1') - see above
  * one of the following 3 results:
    * 'OK' - mail is ok
    * 'VIRUS: <virusdescription>' - mail is treated as if it contained a virus
      (the virusdescription is logged and added to the mail's headers)
    * 'SCORE: <number>' - <number> is added (negative numbers are also possible)
      to the mail's spamscore
* The check will be killed after a 5 minute timeout - and the mail is
  treated as OK
* All output written to STDERR by the check is written to the journal/mail.log
  (with priority 'err')

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
PMG/Config.pm
PMG/Utils.pm