🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #246014

Re: [tin] Automatic Authentication with Stunnel

#246014
From: John F. Morse
Date: Fri, 24 Jun 2011 21:40
154 lines
8880 bytes
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.


-- 
John

When a person has -- whether they knew it or not -- already rejected the Truth, by what means do they discern a lie?
Technical Details
Message-ID: <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!news.bnb-lp.com!news.glorb.com!v102.xanadu-bbs.net!n102.xanadu-bbs.net!.POSTED!not-for-mail
References: <iu2hn0$bvk$1@n102.xanadu-bbs.net> <iu2q4p$5vh$1@news.albasani.net>

Show Full Headers
Complete Article Headers
Message-ID: <iu3096$fpq$1@n102.xanadu-bbs.net>
Subject: Re: [tin] Automatic Authentication with Stunnel
Date: Fri, 24 Jun 2011 16:40:54 -0500
From: "John F. Morse" <john@example.invalid>
References: <iu2hn0$bvk$1@n102.xanadu-bbs.net> <iu2q4p$5vh$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!news.bnb-lp.com!news.glorb.com!v102.xanadu-bbs.net!n102.xanadu-bbs.net!.POSTED!not-for-mail
Newsgroups: news.software.readers
Organization: Xanadu BBS
Lines: 154
Reply-To: dont.bother
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: n102.xanadu-bbs.net 1308951654 16186 192.168.89.210 (24 Jun 2011
X-Complaints-To: newsmaster@xanadu-bbs.net
NNTP-Posting-Date: Fri, 24 Jun 2011 21:40:54 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.24 (X11/20101027)
In-Reply-To: <iu2q4p$5vh$1@news.albasani.net>
X-Enigmail-Version: 0.96.0