๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #76103

Re: SSL support in INN 2.5

#76103
From: Kachun Lee
Date: Thu, 03 May 2007 23:06
70 lines
3801 bytes
"Iulius" <iulius@nom-de-mon-site.com.invalid> wrote in message 
news:f0g32k$83v$1@guepard.ecp.fr...
> Hi,
>
> Everything seems to work fine, except the use of SSL.
> I cannot find how to make it work with INN 2.5.
> With the 2.4.3 version, I use ยซ nnrpd-ssl ยป and everything
> works well but there is something I must be missing with the
> 2.5 version.
> [snip]

Hi,

This may not be exactly the same issue started this thread... I think there 
is a dead lock issue with the current SSL code in NNRPD. I meant to bring 
this up several times, but always missed the opportunity.

Basically, the SSL_read cannot be mixed with select(...) as in the current 
code. SSL communicates in its own data blocks and hand shaking. The 
do_readline using SSL_read could return, but still with a partial line in 
the SSL_read buffer. Then the server SSL routine would sit there waiting for 
completion of that data block while NNRPD sat at the select(...) routine 
waiting for more data from the server.

OE as NNTP client caused easy dead locks with multiple return lines commands 
such as XOV. Agent seemed OK... they probably coordinated their lines with 
the SSL blocks. And, using any SSL wrappers should definitely has problem, 
since they would not know to align their data blocks with line breaks.

The correct fix probably was to make sure the full SSL block was read from 
SSL_read before going into the select(...) wait. Nevertheless, for general 
release, it would be very hard to guarantee the interaction between the SSL 
IO code and the raw select IO, especially with so many different platforms.

I took the short route of just bypass the select(...) wait (see patch 
below). Unlike INND with multiple threads, the select on NNRPD just waiting 
on a single file descriptor, so it is not really essential with blocked read 
like SSL_read. Using an alarm signal around SSL_read for non active timeout, 
we has been running a patched version of NNRPD in SSL without the dead lock 
condition for quite many months. Of course, without the select(...) wait, 
the IDLE timer stat won't be collected..

Kachun

*** line.c.orig Thu May  3 02:07:33 2007
--- line.c      Thu May  3 15:01:39 2007
***************
*** 141,146 ****
--- 141,150 ----
                    line->allocated = newsize;
                }
            }
+
+ #ifdef HAVE_SSL
+       if (tls_conn == NULL) {
+ #endif
            /* wait for activity on stdin, updating timer stats as we
             * go */
            do {
***************
*** 157,162 ****
--- 161,169 ----
                    syswarn("%s can't select", ClientHost);
                    return RTtimeout;
                }
+ #ifdef HAVE_SSL
+             }
+ #endif 

Technical Details
Message-ID: <f1dptn05nb@news5.newsguy.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!elnk-atl-nf1!newsfeed.earthlink.net!out03a.usenetserver.com!news.usenetserver.com!in01.usenetserver.com!news.usenetserver.com!spln!extra.newsguy.com!newsp.newsguy.com!news5
References: <f0g32k$83v$1@guepard.ecp.fr>

Show Full Headers
Complete Article Headers
Message-ID: <f1dptn05nb@news5.newsguy.com>
Subject: Re: SSL support in INN 2.5
Date: Thu, 3 May 2007 16:06:49 -0700
From: "Kachun Lee" <kachun@newsguy.com>
References: <f0g32k$83v$1@guepard.ecp.fr>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!elnk-atl-nf1!newsfeed.earthlink.net!out03a.usenetserver.com!news.usenetserver.com!in01.usenetserver.com!news.usenetserver.com!spln!extra.newsguy.com!newsp.newsguy.com!news5
Newsgroups: news.software.nntp
Organization: NewsGuy - Unlimited Usenet $19.95
Lines: 70
NNTP-Posting-Host: p04d1bfbfff00000099f69af6eb8ddbbd269b456dc270c8ff.newsdawg.com
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028