Gordon Messmer a écrit :
Enrique Verdes wrote:
Gordon Messmer escribió:
clamd probably doesn't have access to the mail spool unless you run it either as root, or as the same user that Courier uses.

I encourage you to use the clamav.py filter from the distribution. It won't have that problem.
clamav.py from the distribution uses pyclamav. In the page of pyclamav they encourage to use the new pyclamd.

So it does. I'm not sure why... the scanfile() function isn't affected, and still works as it always has.

Also, pyclamav uses clamav and libclamav 0.88 and I'm running clamav 0.90.3.

You can rebuild pyclamav 0.4.0 with clamav 0.90.3.  It works.
No need...

Jun 8 18:29:42 jupiter courierfilter: File "/usr/lib/python2.4/site-packages/pythonfilter/clamav.py", line 34, in doFilter
Jun  8 18:29:42 jupiter courierfilter: if avresult[0]:
It's not sufficient to just replace pyclamav with pyclamd. pyclamd.scan_file returns a different data type than pyclamav.scanfile does. You might check the list archives, someone else was recently using pyclamd.
Here is the clamd.py I use on 2 servers...

HTH.
Jerome Blion.
#!/usr/bin/python
# clamav -- Courier filter which scans messages with ClamAV
# Copyright (C) 2007  Jerome Blion <[EMAIL PROTECTED]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

import sys
import pyclamd


# Record in the system log that this filter was initialized.
sys.stderr.write('Initialized the "clamdfilter" python filter\n')


def doFilter(bodyFile, controlFileList):
    # check for viruses
    try:
        pyclamd.init_unix_socket('/tmp/clamd')
        avresult = pyclamd.contscan_file(bodyFile)

    except Exception, e:
        return "554 " + str(e)

    if avresult == None:
        return ''

    if avresult.has_key(bodyFile):
        return "554 %s was detected. Abort!" % avresult[bodyFile]

if __name__ == '__main__':
    # we only work with 1 parameter
    if len(sys.argv) != 2:
        print "Usage: clamd.py <message_body_file>"
        sys.exit(0)
    print doFilter(sys.argv[1], "")
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to