Re: [Courier-imap] PATCH: Log source port.
Adam Hasselbalch Hansen wrote: Enclosed is a patch that makes imapd log originating port number in addition to ip. This is due to new legislation in Denmark, requiring ISPs and hosting companies to log the originating port of all traffic. This has been successfully applied to 0.53.3 and 0.56.0. I forgot the pop-part. It is enclosed. /Adam --- courier-0.56.0/imap/pop3dserver.c 2007-09-20 16:04:10.0 +0200 +++ courier-0.56.0-new/imap/pop3dserver.c 2007-09-20 16:04:20.0 +0200 @@ -62,7 +62,7 @@ extern void pop3dcapa(); static void acctout(const char *disc); -static const char *authaddr, *remoteip; +static const char *authaddr, *remoteip, *remoteport; struct msglist { struct msglist *next; @@ -794,6 +794,7 @@ { static const char msg2[]=, user=; static const char msg3[]=, ip=[; + static const char msgport[]=], port=[; static const char msg4[]=], top=; static const char msg5[]=, retr=; static const char msg6[]=, time=; @@ -816,7 +817,7 @@ libmail_str_size_t(bytes_received_count, numAR); libmail_str_size_t(bytes_sent_count, numAS); - p=malloc(strlen(authaddr)+strlen(remoteip)+strlen(disc)+ + p=malloc(strlen(authaddr)+strlen(remoteip)+strlen(remoteport)+strlen(disc)+ strlen(num1)+strlen(num2)+strlen(num3)+ strlen(numAR)+strlen(numAS)+200); /* Should be enough */ @@ -825,6 +826,8 @@ strcat(p, authaddr); strcat(p, msg3); strcat(p, remoteip); + strcat(p, msgport); + strcat(p, remoteport); strcat(p, msg4); strcat(p, num1); strcat(p, msg5); @@ -1020,13 +1023,15 @@ if ((remoteip=getenv(TCPREMOTEIP)) == NULL) remoteip=127.0.0.1; + remoteport=getenv(TCPREMOTEPORT); + { struct stat buf; if ( stat(., buf) 0 || buf.st_mode S_ISVTX) { - fprintf(stderr, INFO: LOCKED, user=%s, ip=[%s]\n, -authaddr, remoteip); + fprintf(stderr, INFO: LOCKED, user=%s, ip=[%s], port=[%s]\n, + authaddr, remoteip, remoteport); printed(printf(-ERR Your account is temporarily unavailable (+t bit set on home directory).\r\n)); exit(0); } @@ -1057,9 +1062,10 @@ exit(1); } - fprintf(stderr, INFO: LOGIN, user=%s, ip=[%s]\n, + fprintf(stderr, INFO: LOGIN, user=%s, ip=[%s], port=[%s]\n, authaddr, - remoteip); + remoteip, + remoteport); fflush(stderr); msglist_cnt=0; - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Courier-imap mailing list Courier-imap@lists.sourceforge.net Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap
Re: [Courier-imap] PATCH: Log source port.
Adam Hasselbalch Hansen skrev, on 19-09-2007 12:07: Did you test it against Courier IMAP 4.1? In the past, it has been stressed that Courier imapd on the MTA and IMAP packages are completely different animals. According to courier-mta.org/imap: This is the same IMAP server that's included in the Courier mail server. Or what? I wouldn't know, my sites run Postfix. The author of them both or someone more knowledgeable than me would have to answer this for certain. --Tonni -- Tony Earnshaw Email: tonni at hetnet dot nl - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Courier-imap mailing list Courier-imap@lists.sourceforge.net Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap
Re: [Courier-imap] PATCH: Log source port.
Adam Hasselbalch Hansen skrev, on 18-09-2007 16:06: Enclosed is a patch that makes imapd log originating port number in addition to ip. This is due to new legislation in Denmark, requiring ISPs and hosting companies to log the originating port of all traffic. I've read about that in the Norwegian papers and hear the almost daily worry from Danish political party spokespeople about terrorism/integration in Denmark on the Norwegian radio. Had this been a discussion forum, I'd ask you what you think about it. This has been successfully applied to 0.53.3 and 0.56.0. What = 0.53 would that be, I'm running 4.1.3. Best, --Tonni -- Tony Earnshaw Email: tonni at hetnet dot nl - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Courier-imap mailing list Courier-imap@lists.sourceforge.net Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap
Re: [Courier-imap] PATCH: Log source port.
Adam Hasselbalch Hansen skrev, on 18-09-2007 17:05: This has been successfully applied to 0.53.3 and 0.56.0. What = 0.53 would that be, I'm running 4.1.3. Oh. Sorry. I'm patching against the entire courier-package. Those would be 4.1.1 and 4.1.3, respectively. Did you test it against Courier IMAP 4.1? In the past, it has been stressed that Courier imapd on the MTA and IMAP packages are completely different animals. --Tonni -- Tony Earnshaw Email: tonni at hetnet dot nl - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Courier-imap mailing list Courier-imap@lists.sourceforge.net Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap