popa3d - разрешение smtp сессий только после успешной pop3 сессии (mail pop3 aaa patch whoson)
Ключевые слова: mail, pop3, aaa, patch, whoson, (найти похожие документы)
- BEST_PEOPLE (2:5077/15.22) -------------------------- BEST_PEOPLE (RU.UNIX) -
From : Eugene Crosser 2:5020/400 22 Dec 00 12:07:30
Subj : popa3d - разрешение smtp сессий только после успешной pop3 сессии
-------------------------------------------------------------------------------
* Forwarded from area 'RU.UNIX'
From: crosser@average.org (Eugene Crosser)
In article <591759752%m3puiptn76.fsf@olli.digger.org.ru>,
Olli Artemjev <Olli.Artemjev@f1354.n5020.z2.fidonet.org> writes:
> Собственно хочется позволить клиентам с email'ами на стервере посылать
> через него почту из любого места в любое, при этом не хочется становиться
> открытым релеем длявсех. Сооьветственно вопрос - а нет ли тут людей уже
> реализовавших соответствующую схему (разрешение smtp сессий только после
> успешной pop3 сессии) и могущих поделиться своими успехами?
Про postfix ничего не могу сказать, а пэтч к popa3d чтобы он
регистрировался через whoson мне недавно прислали.
http://www.average.org/whoson/
http://www.rzad.com/personal/projects.html
PROJECTS
Popa3d patch
Patch to use whoson (WHO iS ONline) protocol with Solar Designer's
tiny POP3 daemon - popa3d v0.4. You must have libwhoson library
instaled (see below). In this version of patch popa3d must be set as
standalone (required changes are included).
popa3d-0.4-whoson_0.1.patch
Usage:
tar zxpf popa3d-0.4.tar.gz
patch -p0 < popa3d-whoson.0.1.patch
edit params.h and Makefile for your own needs and compile it.
Note: Check out the followin settings in params.h used in standalone
mode:
MAX_SESSIONS 50
MAX_SESSIONS_PER_SOURCE 5
MAX_BACKLOG 5
MIN_DELAY
If you have clients behind firewall (for example with IP Masquerade)
you should change at least MAX_SESSION_PER_SOURCE.
-------------------------------------------------------------------------------
diff -uNr ./Makefile ../popa3d-0.4.trzad/Makefile
--- ./Makefile Tue Feb 1 04:56:46 2000
+++ ../popa3d-0.4.trzad/Makefile Thu Nov 9 14:30:35 2000
@@ -4,6 +4,7 @@
CFLAGS = -c -Wall -O2 -fomit-frame-pointer
LDFLAGS = -s
#LDFLAGS = -s -lcrypt
+LDFLAGS += -lwhoson
PROJ = popa3d
OBJS = md5/md5.o \
diff -uNr ./params.h ../popa3d-0.4.trzad/params.h
--- ./params.h Tue Feb 1 07:16:24 2000
+++ ../popa3d-0.4.trzad/params.h Wed Nov 8 13:21:06 2000
@@ -8,7 +8,7 @@
/*
* Are we going to be a standalone server, or start via an inetd clone?
*/
-#define POP_STANDALONE 0
+#define POP_STANDALONE 1
#if POP_STANDALONE
diff -uNr ./pop_auth.c ../popa3d-0.4.trzad/pop_auth.c
--- ./pop_auth.c Thu Mar 25 05:25:55 1999
+++ ../popa3d-0.4.trzad/pop_auth.c Wed Nov 8 13:51:55 2000
@@ -11,6 +11,7 @@
#include "params.h"
#include "protocol.h"
#include "pop_auth.h"
+#include <whoson.h>
static char *pop_user, *pop_pass;
@@ -61,7 +62,7 @@
return 0;
}
-void log_pop_auth(int result, char *mailbox)
+void log_pop_auth(int result, char *mailbox,char *whoson_addr)
{
if (result == AUTH_NONE) {
syslog(SYSLOG_PRIORITY, "Didn't attempt authentication");
@@ -71,4 +72,8 @@
syslog(SYSLOG_PRIORITY, "Authentication %s for %s",
result == AUTH_OK ? "passed" : "failed",
mailbox ? mailbox : "UNKNOWN");
+ if (result == AUTH_OK) {
+ wso_login(whoson_addr,mailbox,0,0);
+ return;
+ }
}
diff -uNr ./pop_auth.h ../popa3d-0.4.trzad/pop_auth.h
--- ./pop_auth.h Thu Mar 25 05:25:55 1999
+++ ../popa3d-0.4.trzad/pop_auth.h Wed Nov 8 13:38:48 2000
@@ -22,6 +22,6 @@
* Logs an authentication attempt for mailbox (or NULL if the requested
* mailbox doesn't exist).
*/
-extern void log_pop_auth(int result, char *mailbox);
+extern void log_pop_auth(int result, char *mailbox, char *whoson_addr);
#endif
diff -uNr ./pop_root.c ../popa3d-0.4.trzad/pop_root.c
--- ./pop_root.c Tue Feb 1 07:18:12 2000
+++ ../popa3d-0.4.trzad/pop_root.c Wed Nov 8 13:17:55 2000
@@ -214,7 +214,7 @@
return 0;
}
-int do_pop_session()
+int do_pop_session(char *whoson_addr)
{
int channel[2];
int result, status;
@@ -248,12 +248,12 @@
if (result == AUTH_OK) {
if (close(channel[0])) return log_error("close");
- log_pop_auth(result, mailbox);
+ log_pop_auth(result, mailbox,whoson_addr);
return do_pop_trans(mailbox);
}
if (set_user(&pop_pw)) return 1;
- log_pop_auth(result, mailbox);
+ log_pop_auth(result, mailbox,whoson_addr);
#ifdef AUTH_FAILED_MESSAGE
if (result == AUTH_FAILED) pop_reply("-ERR %s", AUTH_FAILED_MESSAGE);
diff -uNr ./standalone.c ../popa3d-0.4.trzad/standalone.c
--- ./standalone.c Tue Feb 1 05:20:16 2000
+++ ../popa3d-0.4.trzad/standalone.c Wed Nov 8 13:32:23 2000
@@ -20,7 +20,6 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-
/*
* These are defined in pop_root.c.
*/
@@ -70,6 +69,7 @@
int main()
{
+
int true = 1;
int sock, new;
struct sockaddr_in addr;
@@ -179,15 +179,18 @@
break;
case 0:
+ {
+ char buf[80];
+ strncpy(buf, inet_ntoa(addr.sin_addr), 80);
syslog(SYSLOG_PRIORITY, "Session from %s",
- inet_ntoa(addr.sin_addr));
+ buf);
if (close(sock)) return log_error("close");
if (dup2(new, 0) < 0) return log_error("dup2");
if (dup2(new, 1) < 0) return log_error("dup2");
if (dup2(new, 2) < 0) return log_error("dup2");
if (close(new)) return log_error("close");
- return do_pop_session();
-
+ return do_pop_session(buf);
+ }
default:
sessions[j].addr = addr.sin_addr;
(volatile int)sessions[j].pid = pid;