As SurGATE Labs team, we created a small patch to hide ip address of authenticated user for qmail.
For easy configuration we defined HIDECLIENTIP environment variable to enable/disable this feature without re-compiling qmail source code.
Usage:
- Copy the following patch lines into a file called qmail-hideip.patch Apply the following patch to netqmail
# cd netqmail-version
# patch < qmail-hideip.patch
#make - Stop qmail, take backup of qmail-smtpd and copy new qmail-smtpd binary to /var/qmail/bin
- Add HIDECLIENTIP variable into tcp.smtp(or any other tcprules file to create cdb file defined in qmail-smtpd/run) and run create new tcp.smtp.cdb file
Example:
Before:
:allow
After:
:allow,HIDECLIENTIP=”"
# diff -ruN received.c.orig received.c
--- received.c.orig 2011-09-12 23:24:56.222336786 +0300
+++ received.c 2011-09-12 23:28:01.807343584 +0300
@@ -21,6 +21,9 @@
return 0;
}
+char *relayclient;
+char *hideip;
+
void safeput(qqt,s)
struct qmail *qqt;
char *s;
@@ -60,7 +63,17 @@
safeput(qqt,remoteinfo);
qmail_puts(qqt,"@");
}
+ hideip = env_get("HIDECLIENTIP");
+ if(hideip) {
+ relayclient = env_get("RELAYCLIENT");
+ if (relayclient)
+ qmail_puts(qqt,"Authenticated User");
+ else
+ safeput(qqt,remoteip);
+}
+ else
safeput(qqt,remoteip);

