๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
6 messages
6 total messages Started by Whiskers Fri, 26 Oct 2012 18:57
[Leafnode] using with stunnel
#251864
Author: Whiskers
Date: Fri, 26 Oct 2012 18:57
144 lines
5996 bytes
Has anyone else out there managed to get Leafnode (fetchnews) working with
stunnel, on a Linux system?

System: Arch Linux (i686)
leafnode version 2.0.0.alpha20110806a
systemd 194-4  (takes the place of xinetd or inetd, among other things)
ufw 0.33-1     (wraps iptables; tcpwrappers & tcpd not in Arch repos)
stunnel 4.53-2

Server settings in /etc/leafnode/config:

## using news.individual.net via stunnel for SSL
## see /etc/stunnel.conf
server = localhost
port = 2119
#server = news.individual.net
username = *****
password = *****

## using news.datemas.de via stunnel for SSL
server = localhost
port = 3119
#server = news.datemas.de
username = *****
password = *****

$ cat /etc/systemd/leafnode.socket
[Unit]
Description=Leafnode NNTP Socket

[Socket]
ListenStream=119
Accept=yes

[Install]
WantedBy=sockets.target

$ cat /etc/systemd/system/leafnode@.service
[Unit]
Description=Leafnode NNTP service

[Service]
ExecStart=/usr/local/sbin/leafnode
StandardInput=socket
User=news

$ cat /etc/ufw/applications.d/ufw-newsserver
[Leafnode]
title=Leafnode
description=NNTP caching proxy server
ports=119/tcp

$ cat /etc/ufw/applications.d/ufw-stunnel
[stunnel]
title=stunnel
description=SSL/TLS tunnel
ports=2119,3119/tcp

$ cat /etc/stunnel/stunnel.conf
# Provide the full path to your certificate-key pair file
cert = /etc/stunnel/stunnel.pem

# lock the process into a chroot jail
chroot = /usr/local/var/run/stunnel/
# and create the PID file in this jail
pid = /stunnel.pid

# change the UID and GID of the process for security reasons
setuid = nobody
setgid = nobody

client = yes

[nntp]
accept = 2119
connect = news.individual.net:563

[nntp2]
accept = 3119
connect = news.datemas.de:563

$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
Anywhere                   ALLOW       127.0.0.1
newsserver                 ALLOW       127.0.0.1
127.0.0.1 119/tcp          ALLOW       127.0.0.1
Leafnode                   ALLOW       127.0.0.1
stunnel                    ALLOW       Anywhere
stunnel (v6)               ALLOW       Anywhere (v6)

(I know those settings are not all necessary, or indeed correct; I'll sort
them out ASAP - but I don't think they are firewalling me from my own
stunnel).


I think those are all the settings involved!  (I have created a self-signed
certificate and private key file for stunnel, although as I understand it
they are not strictly essential for this particular task).

When I run fetchnews from the command line, this is what I get:

$ sudo fetchnews -vvv
fetchnews mode: get articles, get headers, get bodies, post articles
found 0 articles in in.coming.
localhost: connecting to port 2119
  trying:    address ::1 port 2119...
  cannot connect: Connection refused
  trying:    address 127.0.0.1 port 2119...
  connected: address 127.0.0.1 port 2119.
localhost NNTP server disconnected or timed out while waiting for response
localhost: Server didn't want to talk to us, reply code -1
localhost: connecting to port 3119
  trying:    address ::1 port 3119...
  cannot connect: Connection refused
  trying:    address 127.0.0.1 port 3119...
  connected: address 127.0.0.1 port 3119.
localhost NNTP server disconnected or timed out while waiting for response
localhost: Server didn't want to talk to us, reply code -1
fetchnews: 0 articles and 0 headers fetched, 0 killed, 0 posted, in 2 seconds

It looks as though stunnel is refusing to accept the connections from
leafnode, but I can't work out why.  Any useful suggestions?

When connecting 'in clear' with the upstream servers, not using stunnel at
all, fetcnews works as expected.

I'm new to both systemd and stunnel (and openssl, for that matter),
although I've been using leafnode on and off for some years.  

My ISP has started to block all attempts to fetch usenet articles between 8
AM and 8 PM (although it's happy to let me fetch headers and group lists),
so I'm hoping that stunnel will literally tunnel through their blockage.
(The ISP's tech support are as puzzled as I am as to why or how the
articles are being blocked; they've been trying to clear the blockage for
weeks now).  I can't afford the set-up charges for changing ISP just at the
moment, otherwise that would be the easy solution.

-- 
-- ^^^^^^^^^^
--  Whiskers 
-- ~~~~~~~~~~
Re: [Leafnode] using with stunnel
#251866
Author: gregor herrmann
Date: Fri, 26 Oct 2012 21:35
55 lines
4291 bytes
On Fri, 26 Oct 2012 19:57:13 +0100, Whiskers wrote:

> Has anyone else out there managed to get Leafnode (fetchnews) working with
> stunnel, on a Linux system?

Yes.

A difference I noted in my config:

> $ cat /etc/stunnel/stunnel.conf
[..]
> [nntp]
> accept = 2119
> connect = news.individual.net:563

[whatever]
connect = real.server:563
accept = localhost:563


Note the "localhost:" in the accept line. Not sure if it helps but it
might be worth a try.

> $ sudo fetchnews -vvv
> fetchnews mode: get articles, get headers, get bodies, post articles
> found 0 articles in in.coming.
> localhost: connecting to port 2119
>   trying:    address ::1 port 2119...
>   cannot connect: Connection refused
>   trying:    address 127.0.0.1 port 2119...
>   connected: address 127.0.0.1 port 2119.
> localhost NNTP server disconnected or timed out while waiting for response
> localhost: Server didn't want to talk to us, reply code -1
> localhost: connecting to port 3119
>   trying:    address ::1 port 3119...
>   cannot connect: Connection refused
>   trying:    address 127.0.0.1 port 3119...
>   connected: address 127.0.0.1 port 3119.
> localhost NNTP server disconnected or timed out while waiting for response
> localhost: Server didn't want to talk to us, reply code -1
> fetchnews: 0 articles and 0 headers fetched, 0 killed, 0 posted, in 2 seconds
>
> It looks as though stunnel is refusing to accept the connections from
> leafnode, but I can't work out why.  Any useful suggestions?

Besides the above: a plain `telnet localhost 2119' helps to check
stunnel without having fetchnews involved.


gregor
-- 
 .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Didier Squiban: Varations sur laridรฉ ร  6 temps
Re: [Leafnode] using with stunnel
#251867
Author: Whiskers
Date: Fri, 26 Oct 2012 22:54
40 lines
2489 bytes
On 2012-10-26, gregor herrmann <gregor+usenet-0601@comodo.priv.at> wrote:
> On Fri, 26 Oct 2012 19:57:13 +0100, Whiskers wrote:
>
>> Has anyone else out there managed to get Leafnode (fetchnews) working with
>> stunnel, on a Linux system?
>
> Yes.
>
> A difference I noted in my config:
>
>> $ cat /etc/stunnel/stunnel.conf
> [..]
>> [nntp]
>> accept = 2119
>> connect = news.individual.net:563
>
> [whatever]
> connect = real.server:563
> accept = localhost:563

I've tried specifying localhost, and 127.0.0.1.

[...]

> Besides the above: a plain `telnet localhost 2119' helps to check
> stunnel without having fetchnews involved.
>
>
> gregor

Interestingly, telnet gets straight through - in fact, so does fetchnews
now!  I haven't changed anything, nor have I rebooted since posting - but I
/did/ restart my router.  Wierd.

Whatever it was you did, thank you  :))

-- 
-- ^^^^^^^^^^
--  Whiskers 
-- ~~~~~~~~~~
Re: [Leafnode] using with stunnel
#251868
Author: gregor herrmann
Date: Sat, 27 Oct 2012 01:17
22 lines
3156 bytes
On Fri, 26 Oct 2012 23:54:26 +0100, Whiskers wrote:

>> Besides the above: a plain `telnet localhost 2119' helps to check
>> stunnel without having fetchnews involved.
> Interestingly, telnet gets straight through - in fact, so does fetchnews
> now!  I haven't changed anything, nor have I rebooted since posting - but I
> /did/ restart my router.  Wierd.

Weird; and good.

> Whatever it was you did, thank you  :))

Heh, I don't remember doing anything with your systems :)
Glad it works ...


gregor
-- 
 .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Janis Joplin: Half Moon
Re: [Leafnode] using with stunnel
#251869
Author: Whiskers
Date: Sat, 27 Oct 2012 16:53
42 lines
2920 bytes
On 2012-10-27, gregor herrmann <gregor+usenet-0601@comodo.priv.at> wrote:
> On Fri, 26 Oct 2012 23:54:26 +0100, Whiskers wrote:
>
>>> Besides the above: a plain `telnet localhost 2119' helps to check
>>> stunnel without having fetchnews involved.
>> Interestingly, telnet gets straight through - in fact, so does fetchnews
>> now!  I haven't changed anything, nor have I rebooted since posting - but I
>> /did/ restart my router.  Wierd.
>
> Weird; and good.
>
>> Whatever it was you did, thank you  :))
>
> Heh, I don't remember doing anything with your systems :)
> Glad it works ...
>
>
> gregor

I've been trying to narrow that down; I think it has something to do with
the sequence in which 'services' are started (something that needs to be
sorted out if systemd and parallel-start booting is going to replace the
traditional 'sequential' booting approach).

Just for the record, I've sorted out my firewall to something much simpler,
which seems to work OK:

$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
Anywhere                   ALLOW       127.0.0.1
Anywhere (v6)              ALLOW       ::1

My Arch Linux system is happily talking to itself via IPv6, although my
internet connection and router are still IPv4 only.

-- 
-- ^^^^^^^^^^
--  Whiskers 
-- ~~~~~~~~~~
Re: [Leafnode] using with stunnel
#251870
Author: gregor herrmann
Date: Sat, 27 Oct 2012 20:17
20 lines
3386 bytes
On Sat, 27 Oct 2012 17:53:52 +0100, Whiskers wrote:

>>> Whatever it was you did, thank you  :))
>> Heh, I don't remember doing anything with your systems :)
>> Glad it works ...
> I've been trying to narrow that down; I think it has something to do with
> the sequence in which 'services' are started (something that needs to be
> sorted out if systemd and parallel-start booting is going to replace the
> traditional 'sequential' booting approach).

Oh, yes, that makes sense; I have to restart my stunnel daemon after
switching networks.


gregor
-- 
 .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Elliott Sharp: Caffiend
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