user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH v2 5/5] pop3: advertise STLS in CAPA if appropriate
  2022-07-20  9:24  6% ` [PATCH v2 0/5] public-inbox " Eric Wong
@ 2022-07-20  9:24  7%   ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2022-07-20  9:24 UTC (permalink / raw)
  To: meta

This is documented in RFC 2595, and POP3 clients may rely on
seeing "STLS" in CAPA output to initiate TLS negotiation.
---
 Documentation/standards.perl | 1 +
 lib/PublicInbox/POP3.pm      | 6 ++++--
 t/pop3d.t                    | 7 +++++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Documentation/standards.perl b/Documentation/standards.perl
index 835de3a2..c36afb5d 100755
--- a/Documentation/standards.perl
+++ b/Documentation/standards.perl
@@ -69,6 +69,7 @@ my $rfcs = [
 	1081 => 'Post Office Protocol – Version 3',
 	1939 => 'Post Office Protocol – Version 3 (STD 53)',
 	2449 => 'POP3 extension mechanism',
+	2595 => 'STARTTLS for IMAP and POP3',
 	2384 => 'POP URL Scheme',
 
 	# TODO: flesh this out
diff --git a/lib/PublicInbox/POP3.pm b/lib/PublicInbox/POP3.pm
index 2c20c84b..ec73893c 100644
--- a/lib/PublicInbox/POP3.pm
+++ b/lib/PublicInbox/POP3.pm
@@ -343,15 +343,17 @@ sub cmd_dele {
 # RFC 2449
 sub cmd_capa {
 	my ($self) = @_;
+	my $STLS = !$self->{ibx} && !$self->{sock}->can('stop_SSL') &&
+			$self->{pop3d}->{accept_tls} ? "\nSTLS\r" : '';
 	$self->{expire} = ''; # "EXPIRE 0" allows clients to avoid DELE commands
-	\<<EOM;
+	<<EOM;
 +OK Capability list follows\r
 TOP\r
 USER\r
 PIPELINING\r
 UIDL\r
 EXPIRE 0\r
-RESP-CODES\r
+RESP-CODES\r$STLS
 .\r
 EOM
 }
diff --git a/t/pop3d.t b/t/pop3d.t
index 3d70935f..9eb110d6 100644
--- a/t/pop3d.t
+++ b/t/pop3d.t
@@ -106,6 +106,8 @@ for my $args (
 	my @p3s_args = ($pop3s->sockhost,
 			Port => $pop3s->sockport, SSL => 1, %o);
 	my $p3s = Net::POP3->new(@p3s_args);
+	my $capa = $p3s->capa;
+	ok(!exists $capa->{STLS}, 'no STLS CAPA for POP3S');
 	ok($p3s->quit, 'QUIT works w/POP3S');
 	{
 		$p3s = Net::POP3->new(@p3s_args);
@@ -127,7 +129,11 @@ for my $args (
 	my $np3 = Net::POP3->new(@np3_args);
 	ok($np3->quit, 'plain QUIT works');
 	$np3 = Net::POP3->new(@np3_args, %o);
+	$capa = $np3->capa;
+	ok(exists $capa->{STLS}, 'STLS CAPA advertised before STLS');
 	ok($np3->starttls, 'STLS works');
+	$capa = $np3->capa;
+	ok(!exists $capa->{STLS}, 'STLS CAPA not advertised after STLS');
 	ok($np3->quit, 'QUIT works after STLS');
 
 	for my $mailbox (('x'x32)."\@$group", $group, ('a'x32)."\@z.$group") {
@@ -239,6 +245,7 @@ EOF
 	my $capa = $oldc->capa;
 	ok(defined($capa->{PIPELINING}), 'pipelining supported by CAPA');
 	is($capa->{EXPIRE}, 0, 'EXPIRE 0 set');
+	ok(!exists $capa->{STLS}, 'STLS unset w/o daemon certs');
 
 	# ensure TOP doesn't trigger "EXPIRE 0" like RETR does (cf. RFC2449)
 	my $list = $oldc->list;

^ permalink raw reply related	[relevance 7%]

* [PATCH v2 0/5] public-inbox POP3 daemon
  @ 2022-07-20  9:24  6% ` Eric Wong
  2022-07-20  9:24  7%   ` [PATCH v2 5/5] pop3: advertise STLS in CAPA if appropriate Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2022-07-20  9:24 UTC (permalink / raw)
  To: meta

Deletes seem working, and some more bugs with well-known ports.

Mainly tested with public-inbox-netd, but it's live and running
on public-inbox.org (sharing the same process with NNTP and
IMAP).

username: $(uuidgen)@inbox.comp.mail.public-inbox.meta
password: anonymous
ports 110 (POP3 w/ STARTTLS) and 995 (POP3S)

7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion:110
should also work for Tor users.

Eric Wong (5):
  public-inbox-pop3d - a mostly read-only POP3 server
  pop3: implement IN-USE from RESP-CODES (RFC 2449)
  pop3: TOP requests do not expire messages
  netd: setup TLS bits for well-known STARTTLS ports
  pop3: advertise STLS in CAPA if appropriate

 Documentation/public-inbox-config.pod |  12 +-
 Documentation/public-inbox-pop3d.pod  | 122 +++++++
 Documentation/standards.perl          |  13 +-
 MANIFEST                              |   5 +
 lib/PublicInbox/Config.pm             |   5 +-
 lib/PublicInbox/Daemon.pm             |  10 +-
 lib/PublicInbox/Inbox.pm              |  10 +-
 lib/PublicInbox/POP3.pm               | 447 ++++++++++++++++++++++++++
 lib/PublicInbox/POP3D.pm              | 231 +++++++++++++
 script/public-inbox-pop3d             |   8 +
 t/pop3d.t                             | 303 +++++++++++++++++
 11 files changed, 1148 insertions(+), 18 deletions(-)
 create mode 100644 Documentation/public-inbox-pop3d.pod
 create mode 100644 lib/PublicInbox/POP3.pm
 create mode 100644 lib/PublicInbox/POP3D.pm
 create mode 100755 script/public-inbox-pop3d
 create mode 100644 t/pop3d.t

^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2022-07-19  2:49     [PATCH 0/2] preliminary POP3 daemon Eric Wong
2022-07-20  9:24  6% ` [PATCH v2 0/5] public-inbox " Eric Wong
2022-07-20  9:24  7%   ` [PATCH v2 5/5] pop3: advertise STLS in CAPA if appropriate 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).