From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: [PATCH RFC] GnuTLS: Support TOFU certificate checking. Date: Wed, 08 Oct 2014 11:45:02 -0400 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: References: <1412716565-7786-1-git-send-email-toke@toke.dk> <87tx3emvwv.fsf@alrua-karlstad.karlstad.toke.dk> Reply-To: emacs-devel@gnu.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1412783164 7961 80.91.229.3 (8 Oct 2014 15:46:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 Oct 2014 15:46:04 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 08 17:45:57 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XbtR5-0002Qz-Gt for ged-emacs-devel@m.gmane.org; Wed, 08 Oct 2014 17:45:56 +0200 Original-Received: from localhost ([::1]:36982 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbtR5-0005bW-28 for ged-emacs-devel@m.gmane.org; Wed, 08 Oct 2014 11:45:55 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbtQZ-0005aH-6I for emacs-devel@gnu.org; Wed, 08 Oct 2014 11:45:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XbtQR-0000v4-51 for emacs-devel@gnu.org; Wed, 08 Oct 2014 11:45:23 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:37687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbtQQ-0000up-Us for emacs-devel@gnu.org; Wed, 08 Oct 2014 11:45:15 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XbtQP-00023L-Ep for emacs-devel@gnu.org; Wed, 08 Oct 2014 17:45:13 +0200 Original-Received: from 198.0.146.153 ([198.0.146.153]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Oct 2014 17:45:13 +0200 Original-Received: from tzz by 198.0.146.153 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Oct 2014 17:45:13 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 67 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 198.0.146.153 X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Copies-To: never User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4.50 (darwin) Cancel-Lock: sha1:srywMAQMIegjUOYt1SwKj051QDY= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:175143 Archived-At: On Wed, 08 Oct 2014 17:19:12 +0200 Toke Høiland-Jørgensen wrote: TH> Ted Zlatanov writes: >> I like the simplicity of it. It would be nice to do this inside Emacs >> itself (it's OK if it requires some kind of `emacs --batch' call, >> doesn't have to be immediate). Either way, the errors should tell us >> specifically what to run from the command line in these two cases: TH> I have an updated version where I split out the parameters into TH> :tofu-strict and :tofu-auto, where the latter will automatically add a TH> certificate that hasn't been seen before (and fail on mismatch only). TH> This might be more suitable to have turned out by default. That's very good. TH> Removing things from the key store has to be done manually, though; but TH> that goes for gnutls-cli as well (and even for ssh). The certificate management UI will take care of that. >> I think so. But Emacs creates a Emacs-specific homedir for the GnuPG >> keychain, for verification of the package archives, in >> `~/.emacs.d/gnupg' which is an equally valid approach. So I don't have >> a strong opinion. >> >> What's the drawback of having a dedicated Emacs store? Do any other >> programs besides `gnutls-cli` use the global GnuTLS store? TH> Well, any programs that use gnutls and pass NULL as the trust store will TH> share the site default. Using this also has the nice side effect of not TH> having to come up with a portable way to find a suitable file name (I'm TH> sure this is solved elsewhere in the emacs code but it saved me from TH> going looking ;)). Emacs has this function already, e.g. `(locate-user-emacs-file "certs")' I think it's better to make the store private than shared by default, so I'd just give the user the choice to use nil (translated to NULL in C). >> I think that's pretty tricky with GnuTLS because it expects all the >> validations to be C callbacks and just hands off the connection at the >> end. You're not supposed to interact with the session during the >> validation, IIUC. So it will probably require two attempts. TH> Noted. I checked what gnutls-cli does (by way of packet dumps), and it TH> seems to keep the connection open, presumably in the middle of the TH> handshake, while waiting for the user to decide whether to trust it. So TH> presumably something similar could be done by Emacs, and I think it's TH> more a matter of whether or not it's possible to call back up into lisp TH> from this part of the code. That would be great, please see how far you get with the exploration. Your contribution is already very useful so I am excited to see it evolve. >> Yes, that would be nice and clean. They can simply be attached as >> symbol properties to the error. Maybe you can adjust >> `gnutls_make_error'? TH> I will look into it. I'm out of time to hack on this for a while, so for TH> now I'll just resubmit the patch with the changes noted above, and then TH> return to this at a later date (heh, famous last words). OK; Lars and I will probably work on it as well as time allows in order to get something into trunk. Ted