🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #246013

Re: [tin] Automatic Authentication with Stunnel

#246013
From: VanguardLH
Date: Fri, 24 Jun 2011 23:30
152 lines
9441 bytes
John F. Morse wrote:

> VanguardLH wrote:
> 
>> It's been a long time since I last use sTunnel (and that was on Windows
>> to give me SSL access to Gmail because SpamPal doesn't support SSL - I
>> quit using SpamPal so didn't need sTunnel).  I think it was about 2
>> years, or more, since I last used it.  As I recall, you configure your
>> client so the server it specifies is the sTunnel proxy but you also give
>> your login credentials.  That way, your client connects to the proxy and
>> gives it the login username and password.  You configure sTunnel to
>> where it connects.  So it connects there and then passes on the login
>> credentials.
>>
>> http://spampal.sourceforge.net/usermanual/servers/stunnel/stunnel.htm
>>
>> In stunnel.conf, you configure it to accept inbound connects on a port.
>> If you have multiple email servers to which it will connect, you have to
>> define a different inbound port for each server.  So if you have 5 email
>> accounts that you want to poll, each using SSL, then you have to define
>> 5 inbound ports in sTunnel.  That's because each inbound port defines
>> one e-mail server to which sTunnel will connect.  You have to specify
>> the correct protocol for the inbound port on sTunnel (POP, IMAP, SMTP)
>> so you match it up with the protocol you specify in your client.
>>
>> In your client (tin), you would define the server as the local proxy for
>> sTunnel.  If you are running sTunnel, you use localhost or 127.0.0.1 to
>> identify the server (which is now the local proxy).  In your client for
>> the username and password fields, you specify in the user/account field
>> both your username (for login) and the local proxy and its port, as in:
>>
>>   <acctUsername>@127.0.0.1:<stunnelInPort>
>>
>> If you configured sTunnel to accept inbound connect on port 1109 (that
>> then goes to a specific email server) and if your username was JohnM and
>> your password was 123456 then you configure your client would use:
>>
>>   Account/User: johnm@127.0.0.1:1109
>>   Password:     123456 (shown as asterisks)
>>
>> The password field in your client contains the login password.  Your
>> client connects to 127.0.0.1 (sTunnel proxy).  The account in your
>> client specifies in the User/Account field what is your login username,
>> the server again but along with its port.  So the client connects to
>> 127.0.0.1 on port 1109 which is sTunnel and gives it the username.  The
>> client passes the password to the same proxy (sTunnel).  Since the
>> inbound port on sTunnel is associated with a particular protocol, the
>> proper handshaking is performed for sTunnel to grab the username and
>> password from the client's connect.  sTunnel then connects to the server
>> that you specified in its config file for that inbound port and passes
>> on the username and password using the same protocol as was defined for
>> that inbound port (so the protocol defined on the inbound port has to
>> match the protocol used at the email server).
>>
>> sTunnel knows to where its outbound connect (the email server) by what
>> you define for an inbound port in its config file.  What protocol is
>> used by the inbound port (to the client and then to the email server) is
>> defined by under what section in the config file you put the definition.
>> Since the inbound port on sTunnel defines to where it connects, you
>> change the Server fields (POP, IMAP, SMTP) in your client to point at
>> the sTunnel proxy (127.0.0.1 or localhost).  You modify the User field
>> in your client to specify your username, ampersand, sTunnel proxy, and
>> its inbound port.  You leave the Password field in your client the same.
>>
>> The instuctions above were for getting and sending emails through
>> sTunnel so you could use SSL with a client that doesn't support it.
>> There is no mention of an "[NNTP]" section in sTunnel.  It wasn't clear
>> from your post if you were looking to use SSL connects for e-mail
>> sending and receiving or for NNTP posting and reading.  Although not
>> that clear, the service types you can define are defined at:
>>
>> http://www.stunnel.org/static/stunnel.html#configuration_file
>>
>> nntp is listed as a supported protocol; however, there appears a
>> difference between version 4 (in the SpamPal version of using sTunnel)
>> and the version 8 manual.  In the past, you use "[imaps]" to specify a
>> block of parameters used for an inbound IMAP port in sTunnel (that then
>> used IMAPS to connect to the email server).  Their examples suck.
>> Notice they don't even tell you the name of the configuration file until
>> almost at the end of the documentation in where you are going to specify
>> all those parameters previously defined.  Their documentation is written
>> more like an Engineering Spec than a Functional Spec.
>>
>> In version 4, you'd define a block in stunnel.conf for IMAPS like:
>>
>> imaps]
>> accept = 127.0.0.1:8143
>> delay = yes
>> connect = imaps.myisp.com:993
>>
>> Now it looks like you have to use something like:
>>
>> [stunnel.imap]
>> protocol = imap
>> accept = 127.0.0.1:8143
>> delay = yes
>> connect = imaps.myisp.com:993
>>
>> I had thought "[imaps]" was the protocol used by the block but instead
>> it's just the name for that block of parameters.  The parameter block
>> defined a "service name" in sTunnel.  So you could have:
>>
>> [myisp-imaps]
>> accept = 127.0.0.1:8143
>> delay = yes
>> connect = imaps.myisp.com:993
>>
>> I suspect the protocol parameter wasn't needed in my prior use of
>> sTunnel becaue I used a common outbound port (between sTunnel and the
>> email server).  That is, if I used a common port (which is what the
>> email server is likely to also use) then that port identified the
>> protocol to be used, as mentioned at:
>>
>> http://www.stunnel.org/?page=faq
>> under "What are the offical SSL ports?" section
>>
>> Since I see "nntps" in this list and also as a protocol mentioned in
>> their documentation then you should be able to use sTunnel for both
>> email and newsgroups; however, under protocol=nntp, it says "This
>> protocol is only supported in client mode."  I don't know what that
>> means versus "server mode".  To me, the proxy is always the server to
>> your email/nntp client but it is the client to the email/nntp server to
>> which it connects.
>>   
> 
> Appreciate the info, but I have Stunnel3 and Stunnel4 already working on 
> several servers.
> 
> One is Stunnel3, which provides a tunnel to a NNRPD news server. It is 
> handy to use for access from any client on the LAN,. It is not a very 
> fast PC, and it runs BIND9, ntpd, and Fetchmail as well. This Stunnel3 
> was previously used for accessing POP3, SMTP and NNRPD over a secure 
> connection to a former ISP.
> 
> I installed Stunnel4 on this workstation for a gmail IMAPS account. Then 
> I added a configuration for nnrpd to a newer reader news server.
> 
> I have another Stunnel4 server that receives encrypted incoming 
> connections from the WAN on various ports, and sends them to various 
> inhouse servers (POP3, IMAP, NNRPD, HTTP, SSH, etc.).
> 
> My problem was overlooking a variable path to tin's authentication file. 
> I had the correct file but in one directory too deep, while the old file 
> was in the proper place, but the configuration was for a different 
> hostname. I should buy higher powered diopter reading glasses, or junk 
> it all and go fishing. ;-)
> 
> Again, thanks for taking the time to write this info. It will be here if 
> I should need it in the future.

That's the problem with tired eyes: they tend to see what you think you
should be seeing.
Technical Details
Message-ID: <iu36ga$v3v$1@news.albasani.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!num2.nntp.dca.giganews.com!num1.nntp.dca.giganews.com!number.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin3!goblin.stu.neva.ru!news.tu-darmstadt.de!news.internetdienste.de!feeder.erje.net!news.albasani.net!.POSTED!not-for-mail
References: <iu2hn0$bvk$1@n102.xanadu-bbs.net> <iu2q4p$5vh$1@news.albasani.net> <iu3096$fpq$1@n102.xanadu-bbs.net>

Show Full Headers
Complete Article Headers
Message-ID: <iu36ga$v3v$1@news.albasani.net>
Subject: Re: [tin] Automatic Authentication with Stunnel
Date: Fri, 24 Jun 2011 18:30:39 -0500
From: VanguardLH <V@nguard.LH>
References: <iu2hn0$bvk$1@n102.xanadu-bbs.net> <iu2q4p$5vh$1@news.albasani.net> <iu3096$fpq$1@n102.xanadu-bbs.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!num2.nntp.dca.giganews.com!num1.nntp.dca.giganews.com!number.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin3!goblin.stu.neva.ru!news.tu-darmstadt.de!news.internetdienste.de!feeder.erje.net!news.albasani.net!.POSTED!not-for-mail
Newsgroups: news.software.readers
Organization: 0.35MOA sniper at loose in Usenet
Lines: 152
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.albasani.net
 HiP0zE5GTXuqjBQ+oWnbwbBEm1Z2M+Aql37Dc8QTOa+GD5h+GvP1G/IwC7x2pdw8DWruvWc0KQ6aqRWjqYVt4QGlK628vG1O3D6f/Wddkkui4nzxFxBh7XP80nj01YJ2
NNTP-Posting-Date: Fri, 24 Jun 2011 23:27:06 +0000 (UTC)
Injection-Info: news.albasani.net;
 logging-data="1cECpWJIfWgX+GrCbsHxQboaZEq6WQoTH7RmmvOYzj3T6T01U7b67pOEt7gGMr2dv1b+lqSZE92zQ4CCZO6D+H7DvZF/C0+rgupNbVbkN9VZth5Sh1HjeS9C3pSPCLIV";
 mail-complaints-to="abuse@albasani.net"
Keywords: VanguardLH VLH811
User-Agent: 40tude_Dialog/2.0.15.84
Cancel-Lock: sha1:lNHyv1Yr2oYaDE3iRGd8NBT/FSo=
X-MOTD: It is wiser to remain silent and let others ponder your ignorance than
 to speak and remove all doubt