From estartu at augusta.de Tue Nov 8 07:19:10 2016 From: estartu at augusta.de (Gerhard Schmidt) Date: Tue, 8 Nov 2016 13:19:10 +0100 Subject: [Pymilter] Small bug in py-milter on FreeBSD Message-ID: Hi i wrote a message this morning about py-milter dying silently when an ipv6 host connects to the Mailserver. Did some debugging since then and found a small error in miltermodul.c that causes the module to crash when handling IPv6 addresses. The Problem is that on FreeBSD didn't get includes because the condition for FreeBSD seams to be wrong. The attached patch fixes the issue. I will try to include the patch in the FreeBSD Port to fix the actual version. But please include the fix in future releases. Regards Estartu From estartu at augusta.de Tue Nov 8 07:37:20 2016 From: estartu at augusta.de (Gerhard Schmidt) Date: Tue, 8 Nov 2016 13:37:20 +0100 Subject: [Pymilter] Small bug in py-milter on FreeBSD In-Reply-To: References: Message-ID: Am 08.11.2016 um 13:19 schrieb Gerhard Schmidt: > Hi > > i wrote a message this morning about py-milter dying silently when an > ipv6 host connects to the Mailserver. Did some debugging since then and > found a small error in miltermodul.c that causes the module to crash > when handling IPv6 addresses. > > The Problem is that on FreeBSD didn't get includes because > the condition for FreeBSD seams to be wrong. > > The attached patch fixes the issue. > > I will try to include the patch in the FreeBSD Port to fix the actual > version. But please include the fix in future releases. Ups forgot to add the attachment. Regards Estartu -------------- next part -------------- A non-text attachment was scrubbed... Name: patch-miltermodul.c Type: text/x-csrc Size: 404 bytes Desc: not available URL: From stuart at gathman.org Tue Nov 8 08:19:53 2016 From: stuart at gathman.org (Stuart D. Gathman) Date: Tue, 8 Nov 2016 08:19:53 -0500 (EST) Subject: [Pymilter] Small bug in py-milter on FreeBSD In-Reply-To: References: Message-ID: On Tue, 8 Nov 2016, Gerhard Schmidt wrote: >> I will try to include the patch in the FreeBSD Port to fix the actual >> version. But please include the fix in future releases. I've pushed that to master. BUT, surely there is a reliable way to test that the necessary definitions have been included, and give a compile error? Where exactly did it crash without arpa/inet? We could target whatever was missing. -- Stuart D. Gathman "Confutatis maledictis, flamis acribus addictis" - background song for a Microsoft sponsored "Where do you want to go from here?" commercial. From estartu at augusta.de Tue Nov 8 02:00:22 2016 From: estartu at augusta.de (Gerhard Schmidt) Date: Tue, 8 Nov 2016 08:00:22 +0100 Subject: [Pymilter] py-milter dies silently on ipv6 connect Message-ID: <3f5af365-4c5f-f5f7-a032-9001a7d98ae7@augusta.de> Hi im just starting a project with py-milter. So there is nothing but the init code in my project right now. But me python script dies silently (no traceback etc) when there is a connect via ipv6 to my mailserver. I'm using py-milter 1.0 with python2.7 on a freebsd10.3 machine. Both python and py-milter are installed via ports. Regards Estartu From estartu at augusta.de Tue Nov 8 08:39:26 2016 From: estartu at augusta.de (Gerhard Schmidt) Date: Tue, 8 Nov 2016 14:39:26 +0100 Subject: [Pymilter] Small bug in py-milter on FreeBSD In-Reply-To: References: Message-ID: <31ff532e-fe29-f506-ae87-8a58667006eb@augusta.de> Am 08.11.2016 um 14:19 schrieb Stuart D. Gathman: > On Tue, 8 Nov 2016, Gerhard Schmidt wrote: > >>> I will try to include the patch in the FreeBSD Port to fix the actual >>> version. But please include the fix in future releases. > > I've pushed that to master. BUT, surely there is a reliable way to > test that the necessary definitions have been included, and give > a compile error? Where exactly did it crash without arpa/inet? We > could target whatever was missing. > If the file isn't included the following warnings are generated. miltermodule.c:745:18: warning: implicit declaration of function 'inet_ntop' is invalid in C99 [-Wimplicit-function-declaration] const char *s = inet_ntop(AF_INET6, &addr->sin6_addr, buf, sizeof buf); ^ miltermodule.c:745:14: warning: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion] const char *s = inet_ntop(AF_INET6, &addr->sin6_addr, buf, sizeof buf); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. The crash is in the following line while trying to convert s to a python string. Regards Estartu From lists at alexandervowinkel.de Fri Nov 18 11:52:18 2016 From: lists at alexandervowinkel.de (Alexander Vowinkel) Date: Fri, 18 Nov 2016 17:52:18 +0100 Subject: [Pymilter] getting started with milter-template.py Message-ID: <58c88ec9-7f22-bb92-b990-d36da9804c6f@alexandervowinkel.de> Hi, I am trying to create a milter with this library and postfix. First I used the milter-template.py for testing. It is running an up: > # python milter-template.py > 2016Nov18 17:34:13 milter startup Postfix is configured to talk to the milter on the socket: > milter_protocol = 6 > milter_default_action = accept > smtpd_milters = unix:/home/avowinkel/pythonsock unix:/var/run/opendkim/opendkim.sock > non_smtpd_milters = unix:/home/avowinkel/pythonsock unix:/var/run/opendkim/opendkim.sock Where /home/avowinkel/pythonsock is the socket, as defined in the milter-template.py > # ll ~avowinkel/pythonsock > srwxr-xr-x 1 root root 0 Nov 18 17:34 /home/avowinkel/pythonsock However, when sending an email via the server, I don't get any output from the milter process or any log entry in the mail.log Any suggestions how I can get this to run? Thanks, Alexander From tom at whyscream.net Fri Nov 18 12:57:14 2016 From: tom at whyscream.net (Tom Hendrikx) Date: Fri, 18 Nov 2016 18:57:14 +0100 Subject: [Pymilter] getting started with milter-template.py In-Reply-To: <58c88ec9-7f22-bb92-b990-d36da9804c6f@alexandervowinkel.de> References: <58c88ec9-7f22-bb92-b990-d36da9804c6f@alexandervowinkel.de> Message-ID: <43104326-cef5-abf0-b738-d0949e644e8c@whyscream.net> On 18-11-16 17:52, Alexander Vowinkel wrote: > Hi, > > > I am trying to create a milter with this library and postfix. > > First I used the milter-template.py for testing. > It is running an up: > >> # python milter-template.py >> 2016Nov18 17:34:13 milter startup > > Postfix is configured to talk to the milter on the socket: > >> milter_protocol = 6 >> milter_default_action = accept >> smtpd_milters = unix:/home/avowinkel/pythonsock >> unix:/var/run/opendkim/opendkim.sock >> non_smtpd_milters = unix:/home/avowinkel/pythonsock >> unix:/var/run/opendkim/opendkim.sock > > Where /home/avowinkel/pythonsock is the socket, as defined in > the milter-template.py > >> # ll ~avowinkel/pythonsock >> srwxr-xr-x 1 root root 0 Nov 18 17:34 /home/avowinkel/pythonsock > > However, when sending an email via the server, > I don't get any output from the milter process > or any log entry in the mail.log > Did you reload postfix after the config change? You should see messages when postfix can't connect to your milter. Placing the socket under /home/ seems a good reason to check whether postfix actually has access. Try placing the socket in /tmp while testing stuff (and in /run/ when you go in production). Also, are you running the milter process in the foreground, or is it already managed by some systemd/upstart/init script. Maybe the milter produces a traceback on stderr which is caught (hidden in some unexpected logfile) by the init script? Try running the milter from the commandline, so you see the traceback immediately. Kind regards, Tom > > Any suggestions how I can get this to run? > > > Thanks, > Alexander > _______________________________________________ > Pymilter mailing list > Pymilter at gathman.org > https://gathman.org/mailman/listinfo/pymilter -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: From lists at alexandervowinkel.de Fri Nov 18 13:11:44 2016 From: lists at alexandervowinkel.de (Alexander Vowinkel) Date: Fri, 18 Nov 2016 19:11:44 +0100 Subject: [Pymilter] getting started with milter-template.py In-Reply-To: <43104326-cef5-abf0-b738-d0949e644e8c@whyscream.net> References: <58c88ec9-7f22-bb92-b990-d36da9804c6f@alexandervowinkel.de> <43104326-cef5-abf0-b738-d0949e644e8c@whyscream.net> Message-ID: Yes, I did reload postfix. I just overlooked the " No such file or directory" warning. However, your message opened my eyes. Postfix runs in a chroot, so I put the socket in /var/spool/postfix/var/run/ and set the permissions correctly. Now it works and I can write my milter :D Thanks! Am 18.11.2016 um 18:57 schrieb Tom Hendrikx: > On 18-11-16 17:52, Alexander Vowinkel wrote: >> Hi, >> >> >> I am trying to create a milter with this library and postfix. >> >> First I used the milter-template.py for testing. >> It is running an up: >> >>> # python milter-template.py >>> 2016Nov18 17:34:13 milter startup >> Postfix is configured to talk to the milter on the socket: >> >>> milter_protocol = 6 >>> milter_default_action = accept >>> smtpd_milters = unix:/home/avowinkel/pythonsock >>> unix:/var/run/opendkim/opendkim.sock >>> non_smtpd_milters = unix:/home/avowinkel/pythonsock >>> unix:/var/run/opendkim/opendkim.sock >> Where /home/avowinkel/pythonsock is the socket, as defined in >> the milter-template.py >> >>> # ll ~avowinkel/pythonsock >>> srwxr-xr-x 1 root root 0 Nov 18 17:34 /home/avowinkel/pythonsock >> However, when sending an email via the server, >> I don't get any output from the milter process >> or any log entry in the mail.log >> > Did you reload postfix after the config change? You should see messages > when postfix can't connect to your milter. Placing the socket under > /home/ seems a good reason to check whether postfix actually has access. > Try placing the socket in /tmp while testing stuff (and in /run/ when > you go in production). > > Also, are you running the milter process in the foreground, or is it > already managed by some systemd/upstart/init script. Maybe the milter > produces a traceback on stderr which is caught (hidden in some > unexpected logfile) by the init script? Try running the milter from the > commandline, so you see the traceback immediately. > > Kind regards, > Tom > >> Any suggestions how I can get this to run? >> >> >> Thanks, >> Alexander >> _______________________________________________ >> Pymilter mailing list >> Pymilter at gathman.org >> https://gathman.org/mailman/listinfo/pymilter > > > > _______________________________________________ > Pymilter mailing list > Pymilter at gathman.org > https://gathman.org/mailman/listinfo/pymilter