[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [courier-users] whoson support in pop3d and imapd
Well, no one answered, but I think it might be interesting adding this
since it's just a couple of lines in 5 files (including configuration
files).
We modified yesterday's courier-imap 1.3.8 tarball so as to be current.
Credit should go to Edgardo Szulsztein <edgardosz@yahoo.com> who
implemented it at my request, and not to me (blames are mine, of course,
and flames should also be directed to me).
The modified files are:
imap/imapd.c
imap/pop3dserver.c
imap/Makefile.am
imap/acconfig.h
imap/configure.in
I'm attaching the corresponding "diff -u"s
For the changes to take effect and new configuration files be generated,
you have to run:
automake
autoheader
autoconf
After doing this, whoson is OPTIONAL, that is, to enable it you have to
add the follwing option:
--enable-whoson=PATH
where PATH is the path where whoson is installed (if you don't add
"=PATH" it will default to /usr/local/whoson)
whoson itself may be found inside zmailer's tarball at:
ftp://ftp.funet.fi/pub/unix/mail/zmailer/src/zmailer-2.99.55.tar.gz
you will find whoson in the contrib subdirectory... there is a little
document (RFC like) explaining the whoson protocol.
El 20 Apr 2001, a las 19:22, Mariano Absatz escribió:
> Hi,
>
> we are using Courier-IMAP with ZMailer.
>
> To implement POP before SMTP we are using a small contributed-to-zmailer
> protocol called "whoson".
>
> This protocol allows remote "login", "logout" and "verify" of IP
> addressess with username information to a small "on line users database"
> indexed by IP address with username and timestamp info in it.
>
> It can be used from, say, a radius server, to allow to asociate smtp
> messages coming from an IP address with a radius user.
>
> In our case, as we only provide e-mail (and, in fact, we don't have
> trustable IP addresses), we use it to asociate smtp messages coming from
> an IP address with a POP or IMAP user.
>
> Since, in the case of POP the user is not logged into de POP server while
> he/she is sending the mail, and rather, logs to POP, downloads, exits POP
> and THEN he/she connects to SMTP, we only use the "login" and our SMTP
> server verifies using a predefined timeout.
>
> That is, the SMTP does the following (simplified):
>
> -if the message is inbound, allow it.
> -if the message is oubound:
> -verify the IP of the client in the whoson database
> -if you don't find it, reject it.
> -if you find it:
> -if the time elapsed since the timestamp is greater
> than your predefined timeout, reject it.
> -else, allow the realying and put the username in the
> Received: header generated.
>
> For this to work, and taking into account that we could have relatively
> short timeouts and maybe long POP download times, we do a "whoson login"
> with the user authentication AND with the user's POP logout.
>
> So, in POP, we do this "whoson login" right after the authentication and
> right after the client send the QUIT (obviously, having had a correct
> authentication :-)
>
> In IMAP we do the same but, considering that the user might be logged
> into the server for a relatively long period, we also do a "whoson login"
> in every CHECK.
>
> If you are interested, we can send to the list the modified sources.
>
--
Mariano Absatz - El Baby
mailto:baby@baby.com.ar
http://www.baby.com.ar/
PGP KEYS: http://www.baby.com.ar/datos/personales.html#claves_pgp
|\ _
_\\/'> Powered by Pegasus Mail
/|__) http://www.pmail.com
) )\
-----------------------------------------------------------
I.R.S.: We've got what it takes to take what you've got!
--- pop3dserver.c.ORI Thu Apr 12 23:28:27 2001
+++ pop3dserver.c Fri May 4 15:52:07 2001
@@ -53,6 +53,9 @@
#include "maildir/maildirmisc.h"
#include "maildir/maildirquota.h"
#include "maildir/maildirgetquota.h"
+#ifdef WHOSON
+#include "whoson.h"
+#endif
extern void pop3dcapa();
@@ -495,6 +498,13 @@
mkupper(p);
if (strcmp(p, "QUIT") == 0)
{
+#ifdef WHOSON
+ /* The user has logged out, notify whoson server */
+ if (wso_login(remoteip,authaddr,buf,sizeof(buf)) < 0) {
+ fprintf(stderr, "Error notifying whoson server with host %s, user %s: %s\n", remoteip, authaddr, buf);
+ fflush(stderr);
+ }
+#endif
printf("+OK Bye-bye.\r\n");
fflush(stdout);
cleanup();
@@ -648,6 +658,9 @@
int main(int argc, char **argv)
{
char *p;
+#ifdef WHOSON
+char buf[BUFSIZ];
+#endif
authmodclient();
if ((p=getenv("MAILDIR")) != 0 && *p)
@@ -675,6 +688,14 @@
authaddr,
remoteip);
fflush(stderr);
+
+#ifdef WHOSON
+ /* The user logged in, notify whoson server */
+ if (wso_login(remoteip,authaddr,buf,sizeof(buf)) < 0) {
+ fprintf(stderr, "Error notifying whoson server with host %s, user %s: %s\n", remoteip, authaddr, buf);
+ fflush(stderr);
+ }
+#endif
msglist_cnt=0;
msglist_l=0;
--- configure.in.ORI Mon Apr 30 21:29:01 2001
+++ configure.in Fri May 4 15:52:17 2001
@@ -173,6 +173,21 @@
saveLIBS="$LIBS"
NETLIBS=""
+AC_ARG_ENABLE(whoson, [ --enable-whoson=DIR Enable whoson support in pop3d and imapd], WHOSON="$enableval", WHOSON="no")
+
+if test "$WHOSON" != "no" ; then
+ AC_MSG_RESULT(WHOSON is enabled.)
+ AC_DEFINE_UNQUOTED(WHOSON,1)
+ LIBWHOSON="-lwhoson $LIBS"
+ if test "$WHOSON" != "yes" ; then
+ CFLAGS="-I$WHOSON/include $CFLAGS"
+ else
+ CFLAGS="-I/usr/local/whoson/include $CFLAGS"
+ fi
+fi
+
+AC_SUBST(LIBWHOSON)
+
AC_MSG_CHECKING(whether -lnsl is needed for inet_addr)
AC_TRY_LINK_FUNC(inet_addr,
AC_MSG_RESULT(no),
imapd.c.DIFF
--- Makefile.am.ORI Sat Mar 24 02:23:39 2001
+++ Makefile.am Fri May 4 15:52:53 2001
@@ -49,7 +49,7 @@
imapd_LDADD=libimapd.a ../rfc2045/librfc2045.a ../rfc822/librfc822.a \
../unicode/libunicode.a ../authlib/libauthmod.a ../authlib/libauth.a \
../maildir/libmaildir.a ../liblock/liblock.a ../numlib/libnumlib.a \
- @dblibrary@ @LIBDB@ @LIBGDBM@ @DEBUGLIB@
+ @dblibrary@ @LIBDB@ @LIBGDBM@ @DEBUGLIB@ @LIBWHOSON@
pop3login_SOURCES=pop3login.c pop3dcapa.c
pop3login_DEPENDENCIES=../authlib/libauthmod.a ../authlib/libauth.a \
@@ -61,7 +61,7 @@
pop3d_SOURCES=pop3dserver.c pop3dcapa.c
pop3d_DEPENDENCIES=../authlib/libauthmod.a ../authlib/libauth.a ../maildir/libmaildir.a ../numlib/libnumlib.a
-pop3d_LDADD=../authlib/libauthmod.a ../authlib/libauth.a ../maildir/libmaildir.a ../numlib/libnumlib.a
+pop3d_LDADD=../authlib/libauthmod.a ../authlib/libauth.a ../maildir/libmaildir.a ../numlib/libnumlib.a @LIBWHOSON@
README: README.html
lynx -dump -nolist README.html >README
--- acconfig.h.ORI Mon Feb 7 01:04:40 2000
+++ acconfig.h Fri May 4 15:52:47 2001
@@ -22,3 +22,6 @@
/* Compile IMAP client bug fixes */
#undef IMAP_CLIENT_BUGS
+
+/* Include whoson support */
+#undef WHOSON