🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
4 messages
4 total messages Started by Steffie Sun, 08 Jul 2001 18:44
maxconnections question in inn.conf
#53158
Author: Steffie
Date: Sun, 08 Jul 2001 18:44
27 lines
1595 bytes
Hi,
A question about the maxconnection command in inn.conf

If i set it for example to 1
than there can still a lot of people post and read to my newsserver
but programs as suck or feed are coming into deep  trouble connecting.

I guess it is because readers are handed off to the nnrpd by innd

now my question is, how can i limit the number of people
actually connecting and reading and posting to nnrpd ?

The only thing i could find was the maxconnections, but apparently
that was not ment for this sort of limitation.

anyone any ideas ?


Steffie



-- 
If bankers can count, how come they have eight windows and only four
tellers?
Re: maxconnections question in inn.conf
#53168
Author: those who know me have no need o...
Date: Mon, 09 Jul 2001 01:08
75 lines
3607 bytes
<slrn9khafj.kuj.steffie@wodan.balpol.tudelft.nl> divulged:

>now my question is, how can i limit the number of people
>actually connecting and reading and posting to nnrpd ?

depends on the version of inn.  first look at the -H, -T, and -X command
line options, and if those are missing then consider another way.  the
easiest is probably to integrate the decision into your authentication,
which requires using authentication (this can be a problem for some) and
you have to use an external method since the internal one doesn't have any
provisions for doing this.  or, you could add some code, e.g., near the
loadlimit stuff -- you could even add the code that newer innd's use.

note: doing this might open an avenue to a dos, or change the character of
the existing possibilities.  in fact the code i'm about to post certainly
will, it's really just an example.

note2: only innd supports the -H, -T, and -X switches, which is okay as far
as it goes, but when nnrpd is run in daemon mode this functionality is
lost.  integrating the innd code into nnrpd would be much better than the
quickie i'm showing you.

warning: untested.  patch is against 2.3.2.

--- nnrpd.c.old	Thu May  3 13:27:32 2001
+++ nnrpd.c	Sun Jul  8 17:56:31 2001
@@ -727,6 +727,7 @@
 #if	NNRP_LOADLIMIT > 0
     int			load;
 #endif	/* NNRP_LOADLIMIT > 0 */
+	int			numconnections=0;
     CMDENT		*cp;
     char		buff[NNTP_STRLEN];
     char		**av;
@@ -780,9 +781,9 @@
     if (ReadInnConf() < 0) exit(1);
 
 #ifdef HAVE_SSL
-    while ((i = getopt(argc, argv, "b:Di:g:op:Rr:s:tS")) != EOF)
+    while ((i = getopt(argc, argv, "b:Di:I:g:op:Rr:s:tS")) != EOF)
 #else
-    while ((i = getopt(argc, argv, "b:Di:g:op:Rr:s:t")) != EOF)
+    while ((i = getopt(argc, argv, "b:Di:I:g:op:Rr:s:t")) != EOF)
 #endif /* HAVE_SSL */
 	switch (i) {
 	default:
@@ -805,6 +806,9 @@
 	case 'i':			/* Initial command */
 	    PushedBack = COPY(optarg);
 	    break;
+	case 'I':			/* connection limit.  can't use -i as innd does */
+	    innconf->maxconnections = atoi(optarg);
+	    break;
 	case 'o':
 	    Offlinepost = TRUE;		/* Offline posting only */
 	    break;
@@ -1050,6 +1054,15 @@
 	ExitWithStats(1, TRUE);
     }
 #endif	/* NNRP_LOADLIMIT > 0 */
+
+	/* drop new connections when there are too many already connected */
+	if (numconnections < innconf->maxconnections) {
+		numconnections++;
+	} else {
+		syslog(L_NOTICE, "connection limit (%d) reached", innconf->maxconnections);
+		Reply("connection limit (%d) reached, try later\r\n", NNTP_GOODBYE_VAL, innconf->maxconnections);
+		ExitWithStats(1, TRUE);
+	}
 
     strcpy (LogName, "?");

-- 
okay, have a sig then
Re: maxconnections question in inn.conf
#53170
Author: Russ Allbery
Date: Mon, 09 Jul 2001 02:40
27 lines
1952 bytes
Steffie <steffie@wodan.balpol.tudelft.nl> writes:

> A question about the maxconnection command in inn.conf

> If i set it for example to 1 than there can still a lot of people post
> and read to my newsserver but programs as suck or feed are coming into
> deep trouble connecting.

> I guess it is because readers are handed off to the nnrpd by innd

Right.

> now my question is, how can i limit the number of people actually
> connecting and reading and posting to nnrpd ?

The best way is to not have innd handle incoming reader connections.  Move
innd to a different port (433 is preferred) and have your peers feed you
on that port instead.  Then set up nnrpd to run on port 119 via some
mechanism that lets you limit the maximum number of connections, such as
xinetd or tcpserver.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: maxconnections question in inn.conf
#53189
Author: bill davidsen
Date: Mon, 09 Jul 2001 18:53
29 lines
2457 bytes
In article <yl66d2j04z.fsf@windlord.stanford.edu>,
Russ Allbery  <rra@stanford.edu> wrote:

| The best way is to not have innd handle incoming reader connections.  Move
| innd to a different port (433 is preferred) and have your peers feed you
| on that port instead.  Then set up nnrpd to run on port 119 via some
| mechanism that lets you limit the maximum number of connections, such as
| xinetd or tcpserver.

  I don't know what the original issue was, but I have a problem with
the connections per user rather than the number of users. And for
performance I would like the limit to be in nnrpd in daemon mode, rather
than somewhere else with more overhead.

  You said the limit belongs in nnrpd (another post) and that's exactly
right. Other solutions are likely to be less successful and have more
overhead. Of course when we get that mythical threaded nnrpd the limits
of total users and streams per user, and rate limiting will all be
doable.

  There's a thought, a per-IP rate limit shared between threads, so
opening more sockets would not help you melt the server. They would just
all get slower.

-- 
  bill davidsen <davidsen@tmr.com>  CTO, TMR Associates, Inc
"I am lost. I am out looking for myself. If I should come back before I
return, please ask me to wait."  -seen in a doctor's office
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads