From stuart at bmsi.com Mon Mar 22 18:29:05 2004 From: stuart at bmsi.com (Stuart D. Gathman) Date: Mon, 22 Mar 2004 18:29:05 -0500 (EST) Subject: [Pymilter] Version 0.6.7 Message-ID: New features planned for 0.6.7 include integration with pysrs. Pysrs is available at http://www.python.org/pypi I am also decoding obfuscated headers and a few other minor things. -- Stuart D. Gathman Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154 "Very few of our customers are going to have a pure Unix or pure Windows environment." - Dennis Oldroyd, Microsoft Corporation From chris at newcenturycomputers.net Tue Mar 23 10:05:19 2004 From: chris at newcenturycomputers.net (Chris Gonnerman) Date: Tue, 23 Mar 2004 09:05:19 -0600 Subject: [Pymilter] How to shut down milter properly (I'm sure this is a FAQ but can't find it) Message-ID: <4060522F.7030806@newcenturycomputers.net> How do you shut down a Python Milter gracefully? I want a chance to clean up. I know it's a signals thing but I'm not even sure how to know which of the threads to send the signal to. Linux 2.4, Python 2.2, milter 0.6.5 Thanks in advance! -- Chris. From stuart at bmsi.com Tue Mar 23 10:36:29 2004 From: stuart at bmsi.com (Stuart D. Gathman) Date: Tue, 23 Mar 2004 10:36:29 -0500 (EST) Subject: [Pymilter] How to shut down milter properly In-Reply-To: <4060522F.7030806@newcenturycomputers.net> Message-ID: On Tue, 23 Mar 2004, Chris Gonnerman wrote: > How do you shut down a Python Milter gracefully? I want a > chance to clean up. I know it's a signals thing but I'm not even > sure how to know which of the threads to send the signal to. Method 1 - libmilter responds to SIGTERM. It spawns a signal thread to listen for signals. On earlier version of Linux (RH7.3), each thread is a separate process entry. The signal thread for libmilter can be recognized by 'rt_sig': set - `ps -e -o pid,wchan,cmd | grep "rt_sig ${python} bms.py"` [ "$3" != "grep" ] && kill $1 The sysv init script provided with the RPM does this for the bms milter. On other systems, like AIX and later Linux distros, there is only one process entry for a multi-threaded process. Send the signal to that process - and it goes to the signal thread(s). Method 2 - when your milter decides to shutdown based on some other event, it can call milter.stop. It could be listening on a socket for commands, like RELOAD config and SHUTDOWN. -- Stuart D. Gathman Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154 "Very few of our customers are going to have a pure Unix or pure Windows environment." - Dennis Oldroyd, Microsoft Corporation From stuart at bmsi.com Tue Mar 23 19:59:08 2004 From: stuart at bmsi.com (Stuart D. Gathman) Date: Tue, 23 Mar 2004 19:59:08 -0500 (EST) Subject: [Pymilter] milter-0.6.7 Message-ID: Apart from very minor changes to Milter.py, this new version adds SRS forgery detection to the bms.py milter. To use it, you'll need the pysrs package at http://bmsi.com/python/pysrs.html I am hoping to finally create a framework for version 1.0. It will support reloading configs without restarting, and have registered modules for various features. For example, SPF checking would be its own module as would SRS checking. -- Stuart D. Gathman Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154 "Very few of our customers are going to have a pure Unix or pure Windows environment." - Dennis Oldroyd, Microsoft Corporation From chris at newcenturycomputers.net Wed Mar 24 10:10:07 2004 From: chris at newcenturycomputers.net (Chris Gonnerman) Date: Wed, 24 Mar 2004 09:10:07 -0600 Subject: [Pymilter] Error message I just found Message-ID: <4061A4CF.7090108@newcenturycomputers.net> While digging through my logfile I found this message: Traceback (most recent call last): File "/usr/lib/python2.2/site-packages/Milter.py", line 138, in closecallback rc = m.close() This was followed by an error in my script where I tried to remove a tempfile that did not exist; I'm still puzzled as to exactly how that happened. The script kept running, and seems to be fine, but I thought someone might like to know. Linux 2.4, Python 2.2, milter-0.6.5 -- Chris. From chris at newcenturycomputers.net Wed Mar 24 10:31:05 2004 From: chris at newcenturycomputers.net (Chris Gonnerman) Date: Wed, 24 Mar 2004 09:31:05 -0600 Subject: [Pymilter] Error message I just found In-Reply-To: <4061A4CF.7090108@newcenturycomputers.net> References: <4061A4CF.7090108@newcenturycomputers.net> Message-ID: <4061A9B9.7080408@newcenturycomputers.net> Chris Gonnerman wrote: > While digging through my logfile I found this message: > > Traceback (most recent call last): > File "/usr/lib/python2.2/site-packages/Milter.py", line 138, in > closecallback > rc = m.close() > > This was followed by an error in my script where I tried to remove a > tempfile > that did not exist; I'm still puzzled as to exactly how that happened. Ok, call me stupid. Evidently the line in Milter.py calls through the milter module back into my code, and the tempfile-removal error triggered this message. Sorry to waste time and bandwidth. -- Chris. From stuart at bmsi.com Wed Mar 24 10:31:02 2004 From: stuart at bmsi.com (Stuart D. Gathman) Date: Wed, 24 Mar 2004 10:31:02 -0500 (EST) Subject: [Pymilter] Error message I just found In-Reply-To: <4061A4CF.7090108@newcenturycomputers.net> Message-ID: On Wed, 24 Mar 2004, Chris Gonnerman wrote: > Traceback (most recent call last): > File "/usr/lib/python2.2/site-packages/Milter.py", line 138, in > closecallback > rc = m.close() > > This was followed by an error in my script where I tried to remove a > tempfile > that did not exist; I'm still puzzled as to exactly how that happened. > > The script kept running, and seems to be fine, but I thought someone might > like to know. Any uncaught exceptions in a callback to your milter code are reported to stderr, and the callback immediately returns with Milter.TEMPFAIL. If the exception occurs in the close callback, libmilter ignores the return code. If your milter code gets an exception in any other callback (except abort), the mail sender will get a "451 4.3.0 Filter failure" error. The sender should then try later - after you have noticed the problem in your logs and fixed it. In any case, after calling the close callback, Python milter releases its reference to the user connection object and removes the miltermodule connection context and Python threadstate. Libmilter then recycles the libmilter connection context. -- Stuart D. Gathman Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154 "Very few of our customers are going to have a pure Unix or pure Windows environment." - Dennis Oldroyd, Microsoft Corporation From stuart at bmsi.com Mon Mar 29 18:34:16 2004 From: stuart at bmsi.com (Stuart D. Gathman) Date: Mon, 29 Mar 2004 18:34:16 -0500 (EST) Subject: [Pymilter] Out of thread resources error solved Message-ID: milter-0.6.7-3 detects an "out of thread resources" error. I was getting this on systems running pydspam. It turns out there was a bug where a lock was being released in the wrong finally clause. pydspam-1.1.6 fixes this problem. -- Stuart D. Gathman Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154 "Very few of our customers are going to have a pure Unix or pure Windows environment." - Dennis Oldroyd, Microsoft Corporation