Tag Archive for 'English'

qmail multilog localtime patch for daemontools-0.76

For performance issue multilog binary in daemontools logs in TAI format like following:

@400000004a9b768834d8118c status: local 0/500 remote 4/299

You have to pipe output to tai64nlocal binary to see date in human readable format.  This is being annoying while searching in log files.

We created a small patch to enable human readable logging in multilog via localtime function. The new log lines will look like following:

Sat Dec 19 03:02:51 2009  status: local 0/500 remote 0/299

I belive that some people will not like this idea.  We found it useful and wanted to share with open source community.

The patch is located at http://files.endersys.com/patches/daemontools-0.76-localtime.patch


diff -ruN daemontools-0.76.orig/src/multilog.c daemontools-0.76/src/multilog.c
--- daemontools-0.76.orig/src/multilog.c        2001-07-12 19:49:49.000000000 +0300
+++ daemontools-0.76/src/multilog.c     2009-12-19 02:52:09.000000000 +0200
@@ -514,7 +514,8 @@
 }
 if (!linelen)
 if (flagtimestamp) {
-          timestamp(line);
+          /* timestamp(line); */
+          timestamplocal(line);
 line[25] = ' ';
 linelen = 26;
 }
diff -ruN daemontools-0.76.orig/src/timestamp.c daemontools-0.76/src/timestamp.c
--- daemontools-0.76.orig/src/timestamp.c       2001-07-12 19:49:49.000000000 +0300
+++ daemontools-0.76/src/timestamp.c    2009-12-19 02:53:02.000000000 +0200
@@ -1,7 +1,13 @@
+#include <sys/types.h>
+#include <time.h>
+#include <sys/time.h>
+#include <unistd.h>
 #include "taia.h"
 #include "timestamp.h"

 static char hex[16] = "0123456789abcdef";
+time_t lt;
+struct tm *t;

 void timestamp(char s[TIMESTAMP])
 {
@@ -18,3 +24,11 @@
 s[i * 2 + 2] = hex[nowpack[i] & 15];
 }
 }
+
+void timestamplocal(char s[TIMESTAMP])
+{
+      lt = time(NULL);
+      t = localtime(&lt);
+      asctime_r(t, s);
+      s[24] = ' ';
+}
diff -ruN daemontools-0.76.orig/src/timestamp.h daemontools-0.76/src/timestamp.h
--- daemontools-0.76.orig/src/timestamp.h       2001-07-12 19:49:49.000000000 +0300
+++ daemontools-0.76/src/timestamp.h    2009-12-19 02:52:17.000000000 +0200
@@ -4,5 +4,6 @@
 #define TIMESTAMP 25

 extern void timestamp(char *);
+extern void timestamplocal(char *);

 #endif

Endersys to attend ISS World in Dubai

Murat BALABAN, our Director of R&D Division,  will give a talk entitled “Network Level VoIP Interception with Voitap(tm)” at ISS World Middle East, on February 24, 2010 at 9:00-9:30 in Dubai.

The talk will be about voitap(tm), Endersys’ approach to VoIP LI at the network level, discussing the pros and cons of the network and service level interception as well as how voitap(tm) fits in the overall LI infrastructure of an institution to do the VoIP LI.

ISS World MEA is the world’s largest gathering of Middle East and African Law Enforcement, Intelligence and Homeland Security Analysts and Telecom Operators responsible for Lawful Interception, Electronic Investigations and Network Intelligence gathering. ISS World Programs present the methodologies and tools to bridge the chasms from lawful intercept data gathering to information creation to investigator knowledge to actionable intelligence.

issworld

qmail from address and SMTP-AUTH username check patch

qmail SMTP-AUTH control mechanism is very good way to stop spams and give flexibility user to send email from anywere in the world. But current SMTP-AUTH patches do not check whether from address and SMTP-AUTH username is same.

The following patch will simply reject the mail if the SMTP-AUTH username does not match with the from address.
To be enable use this patch SMTP-AUTH username must be in email address format (user@domain.com). This can be
possible only in qmail+vpopmail or qmail-ldap (if the uid is in email address format) installation.

This patch is based on netqmail-1.06 and Erwin Hoffmann’s qmail-authentication-0.68 patch. But I believe that you can simply integrate your qmail source.

PS:  qmail-remote-logging.patch and qmail-smtp-auth-fromcheck.patch are integrated into JMS1 combined patch and Shupp Toaster patch.

URLs:

http://files.endersys.com/patches/qmail-1.03-jms1.7.08_endersys.patch

http://files.endersys.com/patches/qmail-toaster-0.9.1_endersys.patch

INSTALLATION and CONFIGURATION

1.  Stop qmail
2. Apply this patch to your qmail toaster and compile it (don’t install!)
3. Take backup of your qmail-smtpd binary and override new qmail-smtpd binary
4. Create control/checksenderauth to enable this control
5. Start qmail

You can get the patch from here


--- qmail-smtpd.c.orig  2009-12-16 00:09:42.000000000 +0200
+++ qmail-smtpd.c       2009-12-16 00:20:34.000000000 +0200
@@ -1,3 +1,4 @@
+#include <sys/stat.h>
#include "sig.h"
#include "readwrite.h"
#include "stralloc.h"
@@ -346,6 +347,7 @@
out("250 ok\r\n");
}
void smtp_rcpt(arg) char *arg; {
+struct stat st;
if (!seenmail) { err_wantmail(); return; }
if (!addrparse(arg)) { err_syntax(); return; }
if (flagbarf) { err_bmf(); return; }
@@ -356,6 +358,22 @@
}
else
if (!addrallowed()) { err_nogateway(); return; }
+/* This small patch compare mail from value and smtp auth username.
+* if they are not identical,  the mail will not be relayed!
+* This control will be ignored, if the remote IP is defined in tcp.smtp.cdb
+* create/delete control/checksenderauth file to enable/disable this feature
+*  - Developed by Endersys Ltd R&D Team - http://www.endersys.com
+*/
+  if ((stat("control/checksenderauth",&st) == 0) && (remoteinfo)) {
+
+ /* remoteinfo:username issued during the smtp auth state
+ *   mailfrom.s: From value issued at mail from: state */
+        if (str_diff(remoteinfo, mailfrom.s))  {
+               out("535 Mail From address and SMTP-AUTH username does not match (#5.7.1)\r\n");
+                       return;
+       }
+ }
+