[courier-users] Pythonfilter not running

This is a discussion on [courier-users] Pythonfilter not running within the Courier-Imap forums, part of the Mail Servers and Related category; This is a multi-part message in MIME format. --------------000004040008060104050303 Content-Type: text/plain; charset=ISO-8859-1; format=flowed ...


Go Back   Usenet Forums > Mail Servers and Related > Courier-Imap

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-12-2007
Jérôme Blion
 
Posts: n/a
Default [courier-users] Pythonfilter not running

This is a multi-part message in MIME format.
--------------000004040008060104050303
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hello,

I'm trying to install pythonfilter for the first time. I thought that I
installed everything correctly...
But... (there is always a but), test mails I tried to send are not filtered.

I want pythonfilter to scan my mails for viruses.
I modified it a bit to use pyclamd instead of pyclamav (see attachments)

I send test mails using the following command: echo "Hello world" | nail
-a clam.zip [my personal mail here]
Clam.zip is one of the test files provided by clamav to check everything
is OK.
I cannot test it from outside for now, as no user are defined (and no
maildirs are created). So, for the moment, I'm sending mail from the server.

In /var/log/mail.log, I see that the mail is processed by Courier but I
don't see Pythonfilter running (neither clamd, neither debug)

Do you have any idea I could test to solve my problem?
Any help will be appreciated :)

Here are some useful data pieces:

# ls -l /usr/lib/courier/etc/filters/active/
total 0
lrwxrwxrwx 1 root root 45 2007-05-12 19:23 pythonfilter ->
/usr/lib/courier/libexec/filters/pythonfilter
# ls -l /usr/lib/courier/libexec/filters/pythonfilter
lrwxrwxrwx 1 root root 21 2007-05-12 18:40
/usr/lib/courier/libexec/filters/pythonfilter -> /usr/bin/pythonfilter
# ls -l /usr/bin/python
lrwxrwxrwx 1 root root 9 2007-05-11 18:30 /usr/bin/python -> python2.4
# ls -l /usr/bin/pythonfilter
-rwxr-xr-x 1 root root 8580 2007-05-12 18:37 /usr/bin/pythonfilter

# egrep -v "#|^$" /etc/pythonfilter.conf
debug
clamd
nosuccessdsn

# cat /usr/lib/courier/etc/enablefiltering
esmtp
local

# courier-config
prefix=/usr/lib/courier
exec_prefix=/usr/lib/courier
bindir=/usr/lib/courier/bin
sbindir=/usr/lib/courier/sbin
libexecdir=/usr/lib/courier/libexec
sysconfdir=/usr/lib/courier/etc
datadir=/usr/lib/courier/share
localstatedir=/usr/lib/courier/var
mailuser=daemon
mailgroup=daemon
mailuid=1
mailgid=1
configure_args="'--with-paranoid-smtpext' '--enable-unicode'
'CPPFLAGS=-I/usr/lib/courier/include' --prefix=/usr/lib/courier
--with-db=gdbm --enable-utf7-folder-encoding"



--------------000004040008060104050303
Content-Type: text/plain;
name="clamd.py"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="clamd.py"

#!/usr/bin/python
# clamav -- Courier filter which scans messages with ClamAV
# Copyright (C) 2004 Robert Penz <robert@penz.name>
#
# 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.sock')
avresult = pyclamd.scan_file(bodyFile)

#avresult = pyclamav.scanfile(bodyFile)

except Exception, e:
return "554 " + str(e)
if avresult[bodyFile]:
return "554 %s was detected. Abort!" % avresult[bodyFile]
return ''


if __name__ == '__main__':
# we only work with 2 parameter
if len(sys.argv) != 2:
print "Usage: clamd.py <message_body_file> <controlFileList"
sys.exit(0)
print doFilter(sys.argv[1], "")

--------------000004040008060104050303
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
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/
--------------000004040008060104050303
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/.../courier-users

--------------000004040008060104050303--


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:09 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0