🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
8 messages
8 total messages Started by Pepi Sat, 23 Apr 2011 14:48
[newspost] and stunnel
#245353
Author: Pepi
Date: Sat, 23 Apr 2011 14:48
27 lines
2567 bytes
Hello,
This  is a bit of a mystery.  Using Pan the combination of the setting
host = localhost (plus USR/PWD, of course), seems to do the trick.   I
can download/upload using Pan through stunnel with no problems.

Using  the same setting for newspost (the binary poster) and it  fails
with a "Failed to resolve the server name" message.

If  I instead set it up using my "real" host, i.e., I skip stunnel  in
the  settings, it works with  no  problem.   It's  as  if  it  doesn't
understand the keyword "localhost", oh, and I've tried with 127.0.0.1,
as  well as trying the port number attached at the end of  host  name.
Nothing.

I've  tried to google for a solution, but couldn't  find  anything  to
solve my problem.

Anybody got any input on what might be going on, or a suggestion as to
where I might start looking?


TIA
-- 
  ___      _
-(o o)----/_/_--_--.---------------------------
-/ v \---/--/_'/_//-------------Enhance-Usenet:
-\V V/--------/-------Killfile-a-google-grouper
Re: [newspost] and stunnel
#245354
Author: Bill
Date: Sat, 23 Apr 2011 23:35
17 lines
1315 bytes
Pepi <pepi@egg.nog> wrote:

[...]
>If  I instead set it up using my "real" host, i.e., I skip stunnel  in
>the  settings, it works with  no  problem.   It's  as  if  it  doesn't
>understand the keyword "localhost", oh, and I've tried with 127.0.0.1,
>as  well as trying the port number attached at the end of  host  name.
>Nothing.
[...]

Try using a server name with a HOSTS file entry.
For example, use news.fictious.net and make a HOSTS entry

127.0.0.1	news.fictious.net

The OS checks the HOSTS file before attempting to check
the DNS server.
Re: [newspost] and stunnel
#245355
Author: Pepi
Date: Sun, 24 Apr 2011 12:20
29 lines
2762 bytes
On Sat, 23 Apr 2011 23:35:55 +0000, Bill wrote:

> [...]
> Try using a server name with a HOSTS file entry. For example, use
> news.fictious.net and make a HOSTS entry
> 
> 127.0.0.1	news.fictious.net
> 
> The OS checks the HOSTS file before attempting to check the DNS server.

Thanks for your response. Appreciated!

Just  one thing, if I make such an entry into the HOSTS file, wouldn't
newspost try to contact the  news  host  directly,  instead  of  going
through stunnel?  I mean, the HOSTS file will translate 127.0.0.1 into
my news host's server name, right?

I suspect it isn't stunnel that don't understand.  It's  probably  the
newspost program that has a problem.  Sure, I have the source, but I'm
lousy at C/C++.

Trying  your suggestion made the  program  come  back  with  the  same
response, however, i.e., a failure. Perhaps I'm asking too much of the
program.
-- 
  ___      _
-(o o)----/_/_--_--.---------------------------
-/ v \---/--/_'/_//-------------Enhance-Usenet:
-\V V/--------/-------Killfile-a-google-grouper
Re: [newspost] and stunnel
#245356
Author: Bill
Date: Sun, 24 Apr 2011 13:47
35 lines
2088 bytes
Pepi <pepi@egg.nog> wrote:

>On Sat, 23 Apr 2011 23:35:55 +0000, Bill wrote:
>
>> [...]
>> Try using a server name with a HOSTS file entry. For example, use
>> news.fictious.net and make a HOSTS entry
>> 
>> 127.0.0.1	news.fictious.net
>> 
>> The OS checks the HOSTS file before attempting to check the DNS server.
>
>Thanks for your response. Appreciated!
>
>Just  one thing, if I make such an entry into the HOSTS file, wouldn't
>newspost try to contact the  news  host  directly,  instead  of  going
>through stunnel?  I mean, the HOSTS file will translate 127.0.0.1 into
>my news host's server name, right?

The OS checks the HOSTS file first, the DNS server second. It cannot
contact the server until it has the numeric address.

>I suspect it isn't stunnel that don't understand.  It's  probably  the
>newspost program that has a problem.  Sure, I have the source, but I'm
>lousy at C/C++.

What's the URL of the source? I've done enough coding that I can
probably figure it out.

>Trying  your suggestion made the  program  come  back  with  the  same
>response, however, i.e., a failure. Perhaps I'm asking too much of the
>program.

Some programs do check to make sure they aren't connecting to
the localhost. That's probably the case here.
Re: [newspost] and stunnel
#245357
Author: John F. Morse
Date: Sun, 24 Apr 2011 16:08
127 lines
6452 bytes
Pepi wrote:
> On Sat, 23 Apr 2011 23:35:55 +0000, Bill wrote:
>> [...]
>> Try using a server name with a HOSTS file entry. For example, use
>> news.fictious.net and make a HOSTS entry
>>
>> 127.0.0.1	news.fictious.net
>>
>> The OS checks the HOSTS file before attempting to check the DNS server.
>>     
>
> Thanks for your response. Appreciated!
>
> Just  one thing, if I make such an entry into the HOSTS file, wouldn't
> newspost try to contact the  news  host  directly,  instead  of  going
> through stunnel?  I mean, the HOSTS file will translate 127.0.0.1 into
> my news host's server name, right?
>   


No. It will show Stunnel's location as "localhost" if you plan on 
running Stunnel on the same computer.

Stunnel's configuration will then have your news host's name or IP, and 
the converted port number.


> I suspect it isn't stunnel that don't understand.  It's  probably  the
> newspost program that has a problem.  Sure, I have the source, but I'm
> lousy at C/C++.
>
> Trying  your suggestion made the  program  come  back  with  the  same
> response, however, i.e., a failure. Perhaps I'm asking too much of the
> program.
>   

You can run Stunnel on the localhost, or on another computer on your LAN.

How you connect to it -- how you "find" it -- depends on your network 
design.

For instance, I go "full throttle" and run a BIND9 DNS name server, so I 
connect using the hostname "stunnel" which I have configured in the 
BIND9 zone file, to go to a specific computer that is running Stunnel.

It can be any computer that the zone file describes, but in my case, 
"stunnel" is simply an alias (a CNAME) for the same computer that is 
running BIND9. IOW, they (BIND9 DNS server and Stunnel) are both running 
on the same computer (along with a Stratum2 ntpd and Fetchmail).

If you do not run a DNS server, then you can use your hosts file to do 
the name resolving. Or you can use "localhost" or "127.0.0.1" (any of 
these "should" work).

The hosts file is simple if you have only one or two computers that need 
to resolve names. More than that number of computers begins to become 
quite a job if something changes. That is where a DNS server fits in. 
Have all your computers look toward it, and make any changes in one 
place (or two, should you run a slave DNS server for backup).

My BIND9 computer is running Stunnel version 3.something, which is quite 
old. I originally started Stunnel by using a terminal command instead of 
using an init.d startup script. The computer is never shut down (it's 
been running solid since November 11, 2006, over four years without 
rebooting!), so a BASH command is what started Stunnel. From a processes 
listing:

john@ns:~$ ps aux
...
root     12236  0.0  0.5  6780  344 ?        Ss   Nov11   0:00 
/usr/sbin/stunnel -c -d nntp -r n102:563
...

The command I entered was "stunnel -c -d nntp -r n102:563" using TTY6.

This command runs Stunnel and tells Stunnel to run in the client mode 
("-c") and to listen in the daemon mode ("-d") and to "[host:]port" but 
since "host" is not provided, it listens to localhost" (the same 
computer on which it is running). I suspect my above command using both 
modes -c and -d is in error, but it works so why fix it? ;-)

The port to which it listens is "nntp" which is equivalent to "Port 119" 
and the "-r [host:]port" tells it to connect to the remote service at 
"n102" using Port 563 (my local news reader server -- that's why the 
hostname has no FQDN because it is local). If the remote host were not 
given, it would default to listening to localhost, for a service running 
on Port 563. That would be a case where you ran something like Leafnode 
for a news server.

I could have used "nntps" instead of "563" for the port number, and the 
computer would have looked up the "563" using the /etc/services database 
just like it does for the "nntp" port lookup to "119" earlier in the 
command.

I suspect you may have overlooked your need for three pieces of 
information to get your newsreader, Stunnel, and a news server to 
communicate: incoming protocol/port, and remote host, and its protocol/port.

If you are using the newer Stunnel4, then you can configure 
/etc/stunnel/stunnel.conf for the listening port/protocol and the remote 
server host, port/protocol. You would add an entry stanza like:

[nntps]
accept  = 119
connect = news.remote.server:563

Of course use the correct hostname for the remote news server.

Also read the stunnel (8) man page about generating the SSL certificate. 
Did you generate one?

Then you configure your local newsreader to access the Stunnel program, 
using Port 119, and probably on localhost.

There are many articles on how to do all of this if you check Google:

http://www.google.com/search?q=stunnel+nntps

Perhaps the first Google hit is exactly what you seek?:

http://forum.soft32.com/linux2/stunnel-NNTP-ftopict30184.html


-- 
John

When a person has -- whether they knew it or not -- already rejected the Truth, by what means do they discern a lie?
Re: [newspost] and stunnel
#245358
Author: Bill
Date: Sun, 24 Apr 2011 17:39
42 lines
2413 bytes
"John F. Morse" <john@example.invalid> wrote:

[...]
>Perhaps the first Google hit is exactly what you seek?:
>
>http://forum.soft32.com/linux2/stunnel-NNTP-ftopict30184.html

He stated he was able to connect through stunnel to his
news server using Pan, so my guess is that he has stunnel
configured properly. He is also able to connect to his
news server with newspost, but can't connect to stunnel.

I'm assuming he's using http://newspost.unixcab.org/ and
the error is coming from this section in socket.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	/* Try to convert host name as dotted decimal */
#if (defined(sun) || defined(__sun)) && (defined(__svr4) || \
defined(__SVR4) || defined(__svr4__))
	tinaddr = inet_addr(address);
	if ( tinaddr != -1 )
#else
	if ( inet_aton(address, &inaddr) != 0 ) 
#endif
	{
		memcpy(&serv_addr.sin_addr, &inaddr, sizeof(inaddr));
	}
	else	/* If that failed, then look up the host name */
	{
		if (NULL == (hp = gethostbyname(address)))
			return FAILED_TO_RESOLVE_HOST;
		memcpy(&serv_addr.sin_addr, hp->h_addr, hp->h_length);
	}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In his case, he's either not passing the numeric IP
in a recognizable format, inet_aton won't allow 127.0.01
or gethostbyname is failing.

I suggested the HOSTS file trick to bypass inet_aton

My only other suggestion is to use telnet (or even ping)
to connect to verify the HOSTS trick is working.
Re: [newspost] and stunnel
#245361
Author: grant
Date: Sun, 24 Apr 2011 20:32
36 lines
2697 bytes
On Sat, 23 Apr 2011 09:48:59 -0500, Pepi <pepi@egg.nog> wrote:

>This  is a bit of a mystery.  Using Pan the combination of the setting
>host = localhost (plus USR/PWD, of course), seems to do the trick.   I
>can download/upload using Pan through stunnel with no problems.
>
>Using  the same setting for newspost (the binary poster) and it  fails
>with a "Failed to resolve the server name" message.
>
>If  I instead set it up using my "real" host, i.e., I skip stunnel  in
>the  settings, it works with  no  problem.   It's  as  if  it  doesn't
>understand the keyword "localhost", oh, and I've tried with 127.0.0.1,
>as  well as trying the port number attached at the end of  host  name.
>Nothing.

Sounds like you're not getting the local port set correctly in newspost.

Are you using a $HOME/.newspostrc file to set the defaults?
Does it contain some lines similar to the following?
# address of news server
address=localhost

# port of news server
port=900
(set this to agree with whatever port is working for you in Pan)

Or, are you setting the port by passing an argument on the command line?
eg.
newspost -i localhost -z 900 yada yada yada

My preference is to use a $HOME/.newspostrc, which is created by 
newspost -d and edited appropriately, then passing a minimum of
arguments on the command line - typically, only the subject and
filename(s), eg. 
newspost -s 'this is a test' testfile*.jpg  
PING: All thread followers [ Re: [newspost] and stunnel ]
#245429
Author: Pepi
Date: Tue, 03 May 2011 00:59
17 lines
2217 bytes
Thanks for all the replies! Highly appreciated, indeed.

Will check everything said as soon as I can get a few minutes for myself. 
Domestic and work load(s) are quite insane at the moment, so I'm sorry it 
took so long to respond.

I will be back with a report under this thread later on, hopefully in a 
week or so.

Thanks again for all your replies. :)

Best regards,
-- 
  ___      _
-(o o)----/_/_--_--.---------------------------
-/ v \---/--/_'/_//-------------Enhance-Usenet:
-\V V/--------/-------Killfile-a-google-grouper
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