Hello, Here's a naive implementation for NNTP over TLS using GnuTLS. This is still very much a work in progress (I mostly only tested batch mode), but I wanted to reach out early for feedback. Specifically, how do you feel about two codepaths for the I/O code (e.g. s_gets vs gnutls_record_recv)? Notes: * To enable the feature, use the new --enable-gnutls configure flag at build time. * Use the new -k runtime flag to force TLS. * I didn't submit the configure script changes, as I'm running a different toolchain (GNU Autoconf 2.69). -- Pierre-Alexandre Meyer
On Sat, Dec 05, 2020 at 04:26:02PM +0000, Pierre-Alexandre Meyer wrote: First of all, thanks for showing interest in that point :)
This is still very much a work in progress (I mostly only tested batch mode), but I wanted
interactive connection looks ok (snipped a bit of the data as it's not my server): <<< [18:47:11.883317] (TLS1.2)-(ECDHE-RSA-SECP256R1)-(AES-256-GCM) <<< [18:47:16.962407] 200 news[...]
[18:47:16.962640] CAPABILITIES <<< [18:47:17.025975] 101 Capability list: [...] <<< [18:47:17.081551] SASL SCRAM-SHA-1 GS2-IAKERB GS2-KRB5 GSSAPI GSS-SPNEGO DIGEST-MD5 OTP NTLM CRAM-MD5 LOGIN PLAIN [18:47:17.082016] LIST MOTD <<< [18:47:17.145823] 480 Authentication required for command [18:47:17.147620] AUTHINFO SASL PLAIN AFVycwAgdGVzdCA= <<< [18:47:17.212225] 481 generic failure
(AFVycwAgdGVzdCA= is base64("\0username\0password") incl. the (leading/tailing) spaces the password has, might be an issue on the servers side.)
[18:47:19.213218] AUTHINFO USER [...] <<< [18:47:19.274362] 381 Enter password [18:47:19.274666] AUTHINFO PASS [...] <<< [18:47:19.346595] 281 Authentication succeeded [18:47:21.347515] CAPABILITIES [...]
but once you enter a group it get stuck in
[19:05:30.440199] LISTGROUP [...].test <<< [19:05:30.518678] 211 total low high [...].test [19:05:30.542676] OVER low-high <<< [19:05:30.623157] 224 Overview information for low-high follows [... overview data ...] . ^ that lone extra dot after the last overview record is unecpcted
#5 0x000000000044af07 in get_server (string=string@entry=0x7f9f2c92b010 "", size=size@entry=1634048) at ./nntplib.c:1036 #6 0x0000000000466a4b in tin_read (buffer=0x7f9f2c92b010 "", len=1634048, fp=fp@entry=0x270f, header=header@entry=0) at ./read.c:219 #7 0x0000000000466757 in tin_fgets (fp=0x270f, header=0) at ./read.c:347 #8 0x000000000040a572 in read_overview (group=0x5, group@entry=0x7f9f348b8990, min=35900032, min@entry=1, max=5, max@entry=14170, top=0x7f9f3302747d <__libc_recv+29>, top@entry=0x7ffd9bd74b10, local=local@entry=0, rebuild_cache=0x0, rebuild_cache@entry=0x7ffd9bd74b0c) at ./art.c:1946 #9 0x000000000040d708 in index_group (group=group@entry=0x7f9f348b8990) at ./art.c:482 #10 0x000000000042b5bc in group_page (group=0x7f9f348b8990) at ./group.c:171 #11 0x00000000004755b9 in read_groups () at ./select.c:1216 #12 0x00000000004756d1 in select_read_group () at ./select.c:1422 #13 0x0000000000476df5 in selection_page ( start_groupnum=start_groupnum@entry=0, num_cmd_line_groups=num_cmd_line_groups@entry=0) at ./select.c:231 #14 0x0000000000405772 in main (argc=<optimized out>, argv=<optimized out>) at ./main.c:436
to reach out early for feedback. Specifically, how do you feel about two codepaths for the I/O code (e.g. s_gets vs gnutls_record_recv)?
I have no objection to that
Notes:
* To enable the feature, use the new --enable-gnutls configure flag at build time. * Use the new -k runtime flag to force TLS.
which should probably also change the default port to 563 as long as no -p flag is present (and/or optionally take a port).
* I didn't submit the configure script changes, as I'm running a different toolchain (GNU Autoconf 2.69).
JFTR: I use Thomas E. Dickey's version: <https://invisible-island.net/autoconf/> <https://invisible-island.net/datafiles/release/autoconf.tar.gz>
On Sat, Dec 5, 2020 at 10:07 PM Urs Janßen <urs@tin.org> wrote:
First of all, thanks for showing interest in that point :)
And thank you for providing quick feedback :-)
<<< [18:47:17.145823] 480 Authentication required for command
[18:47:17.147620] AUTHINFO SASL PLAIN AFVycwAgdGVzdCA= <<< [18:47:17.212225] 481 generic failure
(AFVycwAgdGVzdCA= is base64("\0username\0password") incl. the (leading/tailing) spaces the password has, might be an issue on the servers side.)
Interesting, I'll try to reproduce it. I've been using AUTHINFO (no SASL), and it seems to be working indeed.
but once you enter a group it get stuck in
I see the issue: the data returned by gnutls_record_recv for commands like `OVER range' spans multiple lines, which is incompatible with how the get_server code is written today. I'll look into adding a layer of buffered I/O. The doc/TODO hints at either using BIO_*() or rewriting the code to use normal read+write now make sense to me :-)
which should probably also change the default port to 563 as long as no -p flag is present (and/or optionally take a port).
ack, will do.
JFTR: I use Thomas E. Dickey's version: <https://invisible-island.net/autoconf/> <https://invisible-island.net/datafiles/release/autoconf.tar.gz>
ack, I'll try to set it up. Thanks! -- Pierre-Alexandre Meyer
participants (2)
-
Pierre-Alexandre Meyer -
Urs Janßen