FM a écrit :
Hello everybody,

To force pythonfilter to use the clamd and clamd.conf config , I remove pyclamav.so.

in clamd.conf I have :
LocalSocket /var/run/clamav/clamd.sock

but I receive these error from pythonfilter :
(...)
Jan 4 10:40:20 verona courierfilter: Uncaught exception in "clamav" doFilter function: ScanError:Could not reach clamd using unix socket (/var/run/clamd) Jan 4 10:40:20 verona courierfilter: File "/etc/courier/filters/active/pythonfilter", line 194, in processMessage Jan 4 10:40:20 verona courierfilter: replyCode = i_filter[1](bodyFile, controlFileList) Jan 4 10:40:20 verona courierfilter: File "/usr/lib/python2.2/site-packages/pythonfilter/clamav.py", line 50, in doFilter
Jan  4 10:40:20 verona courierfilter: return scanMessage(bodyFile)
Jan 4 10:40:20 verona courierfilter: File "/usr/lib/python2.2/site-packages/pythonfilter/clamav.py", line 35, in scanMessage
Jan  4 10:40:20 verona courierfilter: pyclamd.init_unix_socket()
Jan 4 10:40:20 verona courierfilter: File "/usr/lib/python2.2/site-packages/pyclamd.py", line 111, in init_unix_socket
Jan  4 10:40:20 verona courierfilter: ping()
Jan 4 10:40:20 verona courierfilter: File "/usr/lib/python2.2/site-packages/pyclamd.py", line 167, in ping
Jan  4 10:40:20 verona courierfilter: s = __init_socket__()
Jan 4 10:40:20 verona courierfilter: File "/usr/lib/python2.2/site-packages/pyclamd.py", line 414, in __init_socket__ Jan 4 10:40:20 verona courierfilter: raise ScanError, 'Could not reach clamd using unix socket (%s)' % (clamd_SOCKET)
(...)

Is there a way to set the unix socket to /var/run/clamav/clamd.sock instead of /var/run/clamd ?

Regards,


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
Which pythonfilter do you use ?
With 1.0, I posted a message some days ago...
Here is a version which allow to use a specific socket...

You have to modify /etc/pythonfilter-modules.conf

Add:

[clamav.py]
LocalSocket = '/var/run/clamav/clamd.sock'

HTH.
Jerome Blion.


#!/usr/bin/python
# clamav -- Courier filter which scans messages with ClamAV
# Copyright (C) 2004  Robert Penz <[EMAIL PROTECTED]>
# Copyright (C) 2007  Gordon Messmer <[EMAIL PROTECTED]>
# Copyright (C) 2008  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 courier.config

LocalSocket = ''

try:
    import pyclamav
    def scanMessage(bodyFile):
        try:
            avresult = pyclamav.scanfile(bodyFile)
        except Exception, e:
            return "554 " + str(e)
        if avresult[0]:
            return "554 Virus found - Signature is %s" % avresult[1]
        return ''
except ImportError:
    import pyclamd
    def scanMessage(bodyFile):
        try:
            pyclamd.init_unix_socket(LocalSocket)
            avresult = pyclamd.scan_file(bodyFile)
        except Exception, e:
            return "554 " + str(e)
        if avresult != None and avresult.has_key(bodyFile):
            return "554 Virus found - Signature is %s" % avresult[bodyFile]
        return ''


def initFilter():
    courier.config.applyModuleConfig('clamav.py', globals())
    
    # Record in the system log that this filter was initialized.
    sys.stderr.write('Initialized the "clamav" python filter\n')

def doFilter(bodyFile, controlFileList):
    return scanMessage(bodyFile)


if __name__ == '__main__':
    # we only work with 1 parameter
    if len(sys.argv) != 2:
        print "Usage: clamav.py <message_body_file>"
        sys.exit(0)
    initFilter()
    print doFilter(sys.argv[1], "")
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to