* [PATCH 7/8] xt/lei-onion-convert: test TLS + SOCKS
2023-10-03 6:43 7% [PATCH 0/8] IMAP/NNTP client improvements Eric Wong
@ 2023-10-03 6:43 6% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-10-03 6:43 UTC (permalink / raw)
To: meta
While .onion URLs don't commonly use TLS, using Tor to access
non-.onion URLs is possible and TLS is advisable in that case.
TLS + SOCKS support is also useful for non-Tor SOCKS proxies
(e.g. "ssh -D"), but 127.0.0.1:9050 (Tor) is probably the most
standardized address.
While we're in the area: switch to v5.12, use autodie, and
ensure all necessary modules are present.
---
xt/lei-onion-convert.t | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/xt/lei-onion-convert.t b/xt/lei-onion-convert.t
index 6dd17065..d3afbbb9 100644
--- a/xt/lei-onion-convert.t
+++ b/xt/lei-onion-convert.t
@@ -1,10 +1,12 @@
#!perl -w
-# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-use strict; use v5.10; use PublicInbox::TestCommon;
+use v5.12; use PublicInbox::TestCommon;
use PublicInbox::MboxReader;
+use autodie qw(pipe close);
my $test_tor = $ENV{TEST_TOR};
plan skip_all => "TEST_TOR unset" unless $test_tor;
+require_mods qw(IO::Socket::Socks IO::Socket::SSL Mail::IMAPClient Net::NNTP);
unless ($test_tor =~ m!\Asocks5h://!i) {
my $default = 'socks5h://127.0.0.1:9050';
diag "using $default (set TEST_TOR=socks5h://ADDR:PORT to override)";
@@ -19,11 +21,24 @@ my @cnv = qw(lei convert -o mboxrd:/dev/stdout);
my @proxy_cli = ("--proxy=$test_tor");
my $proxy_cfg = "proxy=$test_tor";
test_lei(sub {
+ # ensure TLS + SOCKS works
+ ok !lei(qw(ls-mail-source imaps://mews.public-inbox.org/
+ -c), "imap.$proxy_cfg"),
+ 'imaps fails on wrong hostname w/ Tor';
+ ok !lei(qw(ls-mail-source nntps://mews.public-inbox.org/
+ -c), "nntp.$proxy_cfg"),
+ 'nntps fails on wrong hostname w/ Tor';
+
+ lei_ok qw(ls-mail-source imaps://news.public-inbox.org/
+ -c), "imap.$proxy_cfg";
+ lei_ok qw(ls-mail-source nntps://news.public-inbox.org/
+ -c), "nntp.$proxy_cfg";
+
my $run = {};
for my $args ([$nntp_url, @proxy_cli], [$imap_url, @proxy_cli],
[ $nntp_url, '-c', "nntp.$proxy_cfg" ],
[ $imap_url, '-c', "imap.$proxy_cfg" ]) {
- pipe(my ($r, $w)) or xbail "pipe: $!";
+ pipe(my $r, my $w);
my $cmd = [@cnv, @$args];
my $td = start_script($cmd, undef, { 1 => $w, run_mode => 0 });
$args->[0] =~ s!\A(.+?://).*!$1...!;
^ permalink raw reply related [relevance 6%]
* [PATCH 0/8] IMAP/NNTP client improvements
@ 2023-10-03 6:43 7% Eric Wong
2023-10-03 6:43 6% ` [PATCH 7/8] xt/lei-onion-convert: test TLS + SOCKS Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-10-03 6:43 UTC (permalink / raw)
To: meta
These affect both lei and -watch
Eric Wong (8):
net_reader: bail out on NNTP SOCKS connection failure
net_reader: avoid IO::Socket::SSL 2.079..2.081 warning
config: fix key-only truthy values with urlmatch
net_reader: support imap.sslVerify + nntp.sslVerify
lei: workers exit after they tell lei-daemon
net_reader: process title reflects NNTP article
xt/lei-onion-convert: test TLS + SOCKS
net_reader: note glob support in .onion hint
lib/PublicInbox/Config.pm | 18 ++++---
lib/PublicInbox/LEI.pm | 1 +
lib/PublicInbox/NetNNTPSocks.pm | 10 ++--
lib/PublicInbox/NetReader.pm | 87 +++++++++++++++++++++------------
t/imapd-tls.t | 18 +++++--
t/nntpd-tls.t | 19 +++++--
xt/lei-onion-convert.t | 21 ++++++--
7 files changed, 123 insertions(+), 51 deletions(-)
^ permalink raw reply [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-10-03 6:43 7% [PATCH 0/8] IMAP/NNTP client improvements Eric Wong
2023-10-03 6:43 6% ` [PATCH 7/8] xt/lei-onion-convert: test TLS + SOCKS Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).