[Qmail-it] Rimuovere uno header Received

Fabio Busatto fabio.busatto at sikurezza.org
Tue Jan 9 00:52:14 CET 2007


Dimenticate la patch precedente, SpamAssassin se ne frega e quindi
non avrebbe molto senso.
Con questa nuova all'indirizzo ip dal quale arriva l'email viene
aggiunta ls stringa _trustedrelay, con il duplice scopo di indicare
a chi guarda che il relay e` stato garantito (questo serve a poco
in quanto c'e` anche indicata l'autenticazione fatta con tanto di
utente utilizzato nel campo remoteinfo), ma soprattutto quello di
non far fare a SpamAssassin i controlli sull'indirizzo nelle varie
blacklist (il che e` una brutta cosa, e la patch e` fatta proprio
per evitare questo comportamento.

Se utilizzate altri sistemi di antispam e potete dirmi se cosi`
e` sufficiente ad evitare il lookup sono ben felice di sentirvi :)
Altrimenti una soluzione piu` drastica e` quella di modificare in
maniera radicale l'indirizzo ip, ma vorrei evitarlo fino a che mi
e` possibile.

Esempio:

- se il relayclient non e` impostato:
Received: from workstation.example.com (HELO workstation.example.com) (1.2.3.4)
  by mail.example.com with SMTP; 9 Jan 2007 00:00:00 -0000

- se invece e` impostato
Received: from workstation.example.com (HELO workstation.example.com) (1.2.3.4_trustedrelay)
  by mail.example.com with SMTP; 9 Jan 2007 00:00:00 -0000

Ciao
Fabio
-- 
Fabio Busatto <fabio.busatto at sikurezza.org>
-------------- next part --------------
diff -uNr netqmail-1.05-orig/qmail-qmqpd.c netqmail-1.05/qmail-qmqpd.c
--- netqmail-1.05-orig/qmail-qmqpd.c	1998-06-15 12:53:16.000000000 +0200
+++ netqmail-1.05/qmail-qmqpd.c	2007-01-09 00:06:53.000000000 +0100
@@ -78,7 +78,7 @@
   if (!local) local = env_get("TCPLOCALIP");
   if (!local) local = "unknown";
  
-  received(&qq,"QMQP",local,remoteip,remotehost,remoteinfo,(char *) 0);
+  received(&qq,"QMQP",local,remoteip,remotehost,remoteinfo,(char *) 0,(char *) 0);
 }
 
 char buf[1000];
diff -uNr netqmail-1.05-orig/qmail-qmtpd.c netqmail-1.05/qmail-qmtpd.c
--- netqmail-1.05-orig/qmail-qmtpd.c	1998-06-15 12:53:16.000000000 +0200
+++ netqmail-1.05/qmail-qmtpd.c	2007-01-09 00:07:00.000000000 +0100
@@ -130,7 +130,7 @@
     else if (ch == 13) flagdos = 1;
     else badproto();
  
-    received(&qq,"QMTP",local,remoteip,remotehost,remoteinfo,(char *) 0);
+    received(&qq,"QMTP",local,remoteip,remotehost,remoteinfo,(char *) 0,(char *) 0);
  
     /* XXX: check for loops? only if len is big? */
  
diff -uNr netqmail-1.05-orig/qmail-smtpd.c netqmail-1.05/qmail-smtpd.c
--- netqmail-1.05-orig/qmail-smtpd.c	2007-01-09 00:05:01.000000000 +0100
+++ netqmail-1.05/qmail-smtpd.c	2007-01-09 00:06:20.000000000 +0100
@@ -514,7 +514,7 @@
   qp = qmail_qp(&qqt);
   out("354 go ahead\r\n");
  
-  received(&qqt,protocol,local,remoteip,remotehost,remoteinfo,fakehelo);
+  received(&qqt,protocol,local,remoteip,remotehost,remoteinfo,fakehelo,relayclient);
   blast(&hops);
   hops = (hops >= MAXHOPS);
   if (hops) qmail_fail(&qqt);
diff -uNr netqmail-1.05-orig/received.c netqmail-1.05/received.c
--- netqmail-1.05-orig/received.c	1998-06-15 12:53:16.000000000 +0200
+++ netqmail-1.05/received.c	2007-01-09 00:06:08.000000000 +0100
@@ -37,7 +37,7 @@
 /* "Received: from relay1.uu.net (HELO uunet.uu.net) (7 at 192.48.96.5)\n" */
 /* "  by silverton.berkeley.edu with SMTP; 26 Sep 1995 04:46:54 -0000\n" */
 
-void received(qqt,protocol,local,remoteip,remotehost,remoteinfo,helo)
+void received(qqt,protocol,local,remoteip,remotehost,remoteinfo,helo,relayclient)
 struct qmail *qqt;
 char *protocol;
 char *local;
@@ -45,6 +45,7 @@
 char *remotehost;
 char *remoteinfo;
 char *helo;
+char *relayclient;
 {
   struct datetime dt;
 
@@ -61,6 +62,9 @@
     qmail_puts(qqt,"@");
   }
   safeput(qqt,remoteip);
+  if (relayclient) {
+    qmail_puts(qqt,"_trustedrelay");
+  }
   qmail_puts(qqt,")\n  by ");
   safeput(qqt,local);
   qmail_puts(qqt," with ");


More information about the Qmail-it mailing list