🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #251864

[Leafnode] using with stunnel

#251864
From: 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 
-- ~~~~~~~~~~
Technical Details
Message-ID: <slrnk8ln89.5p1.catwheezel@ID-107770.user.individual.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!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!10no11849288wis.0!news-out.google.com!ha8ni33521wib.1!nntp.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <slrnk8ln89.5p1.catwheezel@ID-107770.user.individual.net>
Subject: [Leafnode] using with stunnel
Date: Fri, 26 Oct 2012 19:57:13 +0100
From: Whiskers <catwheezel@operamail.com>
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!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!10no11849288wis.0!news-out.google.com!ha8ni33521wib.1!nntp.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
Received: by 10.181.13.75 with SMTP id ew11mr715691wid.0.1351278021870;
MIME-Version: 1.0
Newsgroups: news.software.readers
Organization: is an alien concept
Lines: 144
Reply-To: Whiskers <catwheezel@gmx.co.uk>
X-Trace: individual.net
 CB6KG7+QKhBbv+UnDlrYDg4ZTm93NkKm4jyiZ3Bg5kGAw1Dd9dhEccMqsQjGJo2bl2
X-Orig-Path: tavy.mobile.private!not-for-mail
Cancel-Lock: sha1:nx8FKHpLxEOgWZDN2CiG6BJQUA0=
X-Face: (8UIp\C%, 7b>N'Aa}l7v*-4z\fb2ab=[r*LKrwTU]>W\E]YS3Cb3mZo1Ty.t2%6_KsTV_
 "Pmt)1xC~QW%bU/xrlDuux";
 aJOH0|Ka^MEDf"9Ck?FcYcR)aI~e[\"NW,mpyK}Q6dU[\BmvwRD00
 xYer]; 5mR_!\-haGb/=!*bDWCm0~!G7ewqq7*|#g2#uEBhnKk60qLJ":i_#zfZ'cH`2a^!q_lzxh@
 p&  g^8<z5>HA
User-Agent: slrn/pre1.0.0-40 (Linux)
X-Received-Bytes: 5547