Page 1 of 1

Python exception with pyzor

Posted: Mon Mar 19, 2012 8:39 pm
by kram
Hello ALL,

I started noticing these in my /var/log/messages today.

python: abrt: detected unhandled Python exception in /usr/bin/pyzor
Mar 20 02:36:36 sa1 abrtd: New client connected
Mar 20 02:36:36 sa1 abrt-server[2010]: Saved Python crash dump of pid 2009 to /var/spool/abrt/pyhook-2012-03-20-02:36:36-2009
Mar 20 02:36:36 sa1 abrtd: Directory 'pyhook-2012-03-20-02:36:36-2009' creation detected
Mar 20 02:36:36 sa1 abrt-server[2010]: statvfs('(null)'): Bad address
Mar 20 02:36:36 sa1 abrtd: Package 'pyzor' isn't signed with proper key
Mar 20 02:36:36 sa1 abrtd: Corrupted or bad dump /var/spool/abrt/pyhook-2012-03-20-02:36:36-2009 (res:2), deleting

Anything to worry about?
Pyzor pyzor-0.5.0-4.el6.art.noarch
ASL Version : ASL Version 3.0.21: CentOS 6 (SUPPORTED)

Re: Python exception with pyzor

Posted: Sat Apr 07, 2012 2:23 pm
by kram
Any thoughts or suggestions?

I now have 45065 entries in /var/log/messages

Re: Python exception with pyzor

Posted: Sun Apr 08, 2012 10:30 am
by faris
I don't think this will help you, but how old is your Pyzor install?

The thing is that after installing the package you need to perform additional steps to make it actually work.

Add to /etc/mail/spamassassin/local.cf

Code: Select all

pyzor_options --homedir /etc/mail/spamassassin/.pyzor
then create /etc/mail/spamassassin/.pyzor and chown it popuser.popuser

Next, run the following as root:

Code: Select all

pyzor --homedir /etc/mail/spamassassin/.pyzor discover
and chown the resulting /etc/mail/spamassassin/.pyzor/servers to popuser.popuser

Next, change the 1st line in /usr/bin/pyzor to add -Wignore ::DeprecationWarning. i.e. the 1st line should read:

Code: Select all

#!/usr/bin/python -Wignore::DeprecationWarning
Finally, you may need to add port 24441 (I think!) which is used by pyzor to your firwall allow rule.
For a number of years I'd just allowed the IP of the server mentioned in the "server" file, but it appears that its IP is regularly changing and occasionally I get errors.

Now, as I said, this may not be your problem, but I hope it is as hopefully it will solve it for you.

Note that there is also the need to configure razor, but dcc is fine after installation, with the possible exception of needing to add a particular directive to local.cf to make it happier.

*** It is a great shame that there's no mechanism in RPMs to display a little message after command-line package installation via yum or rpm to say something like "package installed, but you now need to confgure it - see https://blah.domain.tld for info" or something like that. Without such a message is it difficult to know if you are done after install, or if there's more to do!

Re: Python exception with pyzor

Posted: Sun Apr 08, 2012 2:27 pm
by kram
@faris - thanks for taking the time to explain those steps.
Pyzor is now up and running without any erros in the logs :)

My first test got pyzor: check failed: no response

spamassassin -D pyzor 2>&1 | less

Apr 8 18:41:14.758 [18027] dbg: pyzor: network tests on, attempting Pyzor
Apr 8 18:41:17.215 [18027] dbg: pyzor: pyzor is available: /usr/bin/pyzor
Apr 8 18:41:17.216 [18027] dbg: pyzor: opening pipe: /usr/bin/pyzor --homedir /etc/mail/spamassassin/.pyzor check < /tmp/.spamassassin18027cqV0TItmp
Apr 8 18:41:17.243 [18027] dbg: pyzor: [18036] finished: exit 1
Apr 8 18:41:17.244 [18027] dbg: pyzor: check failed: no response
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sa1.2large.co.za
X-Spam-Flag: YES
X-Spam-Level: *******
X-Spam-Status: Yes, score=8.0 required=6.0 tests=EMPTY_MESSAGE,MISSING_DATE,
MISSING_FROM,MISSING_HEADERS,MISSING_MID,MISSING_SUBJECT,NO_HEADERS_MESSAGE,
NO_RECEIVED,NO_RELAYS autolearn=no version=3.3.1
X-Spam-Report:
* -0.0 NO_RELAYS Informational: message was not relayed via SMTP
* 1.0 MISSING_HEADERS Missing To: header
* 0.5 MISSING_MID Missing Message-Id: header
* 1.8 MISSING_SUBJECT Missing Subject: header
* 2.3 EMPTY_MESSAGE Message appears to have no textual parts and no
* Subject: text
* 1.0 MISSING_FROM Missing From: header
* -0.0 NO_RECEIVED Informational: message has no Received headers
* 1.4 MISSING_DATE Missing Date: header
* 0.0 NO_HEADERS_MESSAGE Message appears to be missing most RFC-822
* headers
test
Subject: ***SPAM***
X-Spam-Prev-Subject: (nonexistent)


I opened the port 24441 on the Firewall.
I then downloaded a sample spam file from wget http://www200.pair.com/mecham/spam/sample-spam.txt

and ran -- spamassassin -D pyzor < sample-spam.txt
I then got a postive responce - pyzor: got response: public.pyzor.org:24441 (200, 'OK') 332 0

Apr 8 18:34:47.591 [15611] dbg: pyzor: network tests on, attempting Pyzor
Apr 8 18:34:50.520 [15611] dbg: pyzor: pyzor is available: /usr/bin/pyzor
Apr 8 18:34:50.520 [15611] dbg: pyzor: opening pipe: /usr/bin/pyzor --homedir /etc/mail/spamassassin/.pyzor check < /tmp/.spamassassin15611Zi51Hvtmp
Apr 8 18:34:50.717 [15611] dbg: pyzor: [15616] finished successfully
Apr 8 18:34:50.717 [15611] dbg: pyzor: got response: public.pyzor.org:24441 (200, 'OK') 332 0
Apr 8 18:34:50.717 [15611] dbg: pyzor: listed: COUNT=332/5 WHITELIST=0
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sa1.2large.co.za
X-Spam-Flag: YES
X-Spam-Level: **************************************************
X-Spam-Status: Yes, score=1000.9 required=6.0 tests=BAYES_00,DCC_CHECK,
DIGEST_MULTIPLE,GTUBE,NO_RECEIVED,NO_RELAYS,PYZOR_CHECK autolearn=no
version=3.3.1
X-Spam-Report:
* 1000 GTUBE BODY: Generic Test for Unsolicited Bulk Email
* -0.0 NO_RELAYS Informational: message was not relayed via SMTP
* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
* [score: 0.0001]
* 1.1 DCC_CHECK Detected as bulk mail by DCC (dcc-servers.net)
* 1.4 PYZOR_CHECK Listed in Pyzor (http://pyzor.sf.net/)
* 0.3 DIGEST_MULTIPLE Message hits more than one network digest check
* -0.0 NO_RECEIVED Informational: message has no Received headers
Subject: ***SPAM*** Test spam mail (GTUBE)
Message-ID: <GTUBE1.1010101@example.net>
Date: Wed, 23 Jul 2003 23:30:00 +0200
From: Sender <sender@example.net>
To: Recipient <recipient@example.net>
Precedence: junk
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Spam-Prev-Subject: Test spam mail (GTUBE)

This is the GTUBE, the
Generic
Test for
Unsolicited
Bulk
Email

If your spam filter supports it, the GTUBE provides a test by which you
can verify that the filter is installed correctly and is detecting incoming
spam. You can send yourself a test mail containing the following string of
characters (in upper case and with no white spaces and line breaks):

XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

You should send this test mail from an account outside of your network.


--Razor--

Thanks for pointing out "Note that there is also the need to configure razor"
A bit of digging and few changes now everything seems to be working.

Re: Python exception with pyzor

Posted: Sun Apr 08, 2012 3:52 pm
by faris
Glad to hear it is working.

For completeness, readers please note that you need to "service spamassassin restart" to get changes you make to come into effect.

Also for completeness on this forum, here are the Razor instructions:

First: mkdir /etc/mail/spamassassin/.razor then chown it popuser.popuser
Next, run the following commands (as root is fine):

Code: Select all

azor-admin -home=/etc/mail/spamassassin/.razor -register
razor-admin -home=/etc/mail/spamassassin/.razor -create
razor-admin -home=/etc/mail/spamassassin/.razor -discover
Now chown popuser.popuser everything in .razor

Next, tell spamd where to find Razor's config file by editing /etc/mail/spamassassin/local.cf and adding:

Code: Select all

razor_config /etc/mail/spamassassin/.razor/razor-agent.conf
Finally, edit /etc/mail/spamassassin/.razor/razor-agent.conf to add:

Code: Select all

razorhome = /etc/mail/spamassassin/.razor/

FOR DCC

just add: dcc_path /usr/bin/dccproc to local.cf, although I don't know how much good or bad this might be doing, because DCC seems to work just fine without it and still complains (in a non-fatal way)about stuff when you run spamassassin -D

GENERAL NOTE:

When you run spamassassin -D < some-test-email.txt note that you are doing so as root. As spamassassin does not generally run as root (it runs as popuser usually), this does not give you the full story.

So, what you need to do is a trick I learned from breun:

Code: Select all

su -s /bin/bash - popuser
This will give you a bash shell running as popuser.

You can then try spamassassin -D < some-test-email.txt (make sure some-email-txt is readable by popuser first!) which will run as popuser and may give you errors you would not normally have seen.

Note that I still don't know how one controls which user spamassassin runs as in a qmail-scanner environment. It would be handy to know, at least how to find out the correct user if it is not popuser.

EDIT: I'm doubting myself over whether spamd runs as root or not now. Somebody come to my rescue please?