9front - general discussion about 9front
 help / color / mirror / Atom feed
From: sirjofri+ml-9front@sirjofri.de
To: 9front@9front.org
Subject: Re: [9front] patch smtp: ignore unrecognized certificates
Date: Wed, 29 Jul 2020 09:32:23 +0200	[thread overview]
Message-ID: <0965A403D8215D7555FCEB93BA4ECE3A@sirjofri.de> (raw)
In-Reply-To: <20200721134657.QBBgD%steffen@sdaoden.eu>

[-- Attachment #1: Type: text/plain, Size: 219 bytes --]

Hey all,

I prepared a better patch, this time including a line in the man page and an adjusted usage line. Also this time I don't do the certificate checks, all certs are ignored. This also changes -c to -C.

sirjofri

[-- Attachment #2: Type: text/plain, Size: 1699 bytes --]

diff -r 639ad985a75b sys/man/8/smtp
--- a/sys/man/8/smtp	Mon Jul 20 18:58:52 2020 -0700
+++ b/sys/man/8/smtp	Wed Jul 29 09:24:42 2020 +0200
@@ -6,7 +6,7 @@
 .ti -0.5i
 .B upas/smtp
 [
-.B -aAdfipst
+.B -aACdfipst
 ] [
 .B -b
 .I busted-mx
@@ -81,6 +81,9 @@
 when trying MX hosts.
 May be repeated.
 .TP
+.B -C
+ignore bad thumbprints for TLS connections.
+.TP
 .B -d
 turn on debugging to standard error.
 .TP
diff -r 639ad985a75b sys/src/cmd/upas/smtp/smtp.c
--- a/sys/src/cmd/upas/smtp/smtp.c	Mon Jul 20 18:58:52 2020 -0700
+++ b/sys/src/cmd/upas/smtp/smtp.c	Wed Jul 29 09:24:42 2020 +0200
@@ -46,6 +46,7 @@
 int	quitting;	/* when error occurs in quit */
 int	tryauth;	/* Try to authenticate, if supported */
 int	trysecure;	/* Try to use TLS if the other side supports it */
+int	nocertcheck; /* ignore unrecognized certs. Still logged */
 
 char	*quitrv;	/* deferred return value when in quit */
 char	ddomain[1024];	/* domain name of destination machine */
@@ -85,7 +86,7 @@
 void
 usage(void)
 {
-	fprint(2, "usage: smtp [-aAdfipst] [-b busted-mx] [-g gw] [-h host] "
+	fprint(2, "usage: smtp [-aACdfipst] [-b busted-mx] [-g gw] [-h host] "
 		"[-u user] [.domain] net!host[!service] sender rcpt-list\n");
 	exits(Giveup);
 }
@@ -185,6 +186,9 @@
 	case 'u':
 		user = EARGF(usage());
 		break;
+	case 'C':
+		nocertcheck = 1;
+		break;
 	default:
 		usage();
 		break;
@@ -413,6 +417,12 @@
 	Bterm(&bin);
 	Binit(&bin, fd, OREAD);
 
+	if (nocertcheck) {
+		syslog(0, "smtp", "ignoring cert for %s", ddomain);
+		err = nil;
+		goto Out;
+	}
+
 	goodcerts = initThumbprints(smtpthumbs, smtpexclthumbs, "x509");
 	if (goodcerts == nil) {
 		syslog(0, "smtp", "bad thumbprints in %s", smtpthumbs);

  reply	other threads:[~2020-07-29  7:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <aee5c8d2-ef2b-4ef2-8594-e6786cbd6e2e@sirjofri.de>
2020-07-19  9:43 ` Joel Fridolin Meyer
2020-07-20 14:05   ` [9front] " ori
2020-07-20 14:20     ` hiro
2020-07-20 14:26       ` ori
2020-07-20 14:46         ` tlaronde
2020-07-20 14:52           ` ori
2020-07-20 15:05             ` tlaronde
2020-07-20 15:09               ` ori
2020-07-20 15:32                 ` hiro
2020-07-21  6:55           ` cinap_lenrek
2020-07-20 16:18     ` cinap_lenrek
2020-07-20 17:16       ` Joel Fridolin Meyer
2020-07-20 22:00       ` Steffen Nurpmeso
2020-07-20 22:05         ` ori
2020-07-20 22:19           ` Kurt H Maier
2020-07-21 13:02             ` Steffen Nurpmeso
2020-07-20 22:07         ` ori
2020-07-21 13:46           ` Steffen Nurpmeso
2020-07-29  7:32             ` sirjofri+ml-9front [this message]
2020-07-29  8:04               ` hiro
2020-08-01 10:01               ` cinap_lenrek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0965A403D8215D7555FCEB93BA4ECE3A@sirjofri.de \
    --to=sirjofri+ml-9front@sirjofri.de \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).