13 ms·
Emacs and TLS
- waynecochran 8y agoI am missing something here. Emacs is a text/programmer's editor (I know you browse the web, read email, talk to eliza, etc...), but where is TLS being used exactly? (BTW, I have been using emacs since at least the early 90's, but never did anything requiring TLS).
- __david__ 8y agoMany places. Emacs has a built-in web browser, IMAP client, etc. It also has a package manager that can download packages over https.
- sbjs 8y agoThe old joke goes, Emacs is a great OS, if only it had a decent text editor!
- eftychis 8y agoYou beat me to the punchline. Yes, you can do pretty much anything. (Edit: I guess in the spirit of the joke anything besides writing lol. Shameless plug: I use emacs.)
- NegativeLatency 8y agoHow about booting straight into emacs? https://www.informatimago.com/linux/emacs-on-user-mode-linux.html https://www.informatimago.com/linux/emacs-on-user-mode-linux...
- testcross 8y agoMost common use case for people using only the text editor part is probably the package manager downloading files in clear text.
- eftychis 8y agoThere are people running and working with emacs' shell, read the news, rss, stock market, emails, calendar etc. See the OS punchline below. Thus beyond basic operations of emacs like package management that require a secure connection you have a user's day to day activity.
- phyzome 8y agoYou answered it yourself: When you browse the web and read email.
- waynecochran 8y agoYes, but who actually does that?
- Spivak 8y agoThere are tons of people who read email in Emacs, mu4e is great. Browsing the web is probably less common.
- greglindahl 8y agoDon’t all of the package managers use the web?
- tazjin 8y agoI build my Emacs distribution, including packages, using Nix[1], which means that input hashes of all the package sources are fully pinned. This process is external to Emacs though. The Emacs internal managers all go towards the same HTTP(S) sources and I haven't seen one that pins input hashes or uses signatures, with the exception of pinning git commit hashes when using git as a package source in straight.el[2]. [1]: https://github.com/tazjin/nixos-config/blob/master/emacs.nix https://github.com/tazjin/nixos-config/blob/master/emacs.nix [2]: https://github.com/raxod502/straight.el#advantages-of-straightel-2 https://github.com/raxod502/straight.el#advantages-of-straig...
- dustfinger 8y agoI use exwm (emacs) as my windows manager, rcirc as my irc client, eww as my browser, gnus for email, magit for git, tramp for remote control. All of these tools make use of TLS. Honestly, I literally live my life on a computer. If you do it to the extreme that I do then you will find that customizing your experience becomes important. Emacs is designed from the ground up for customizability.
- akalin 8y agoDo you ever install packages from Emacs? If so, you definitely want that to be at least TLS protected. https://glyph.twistedmatrix.com/2015/11/editor-malware.html https://glyph.twistedmatrix.com/2015/11/editor-malware.html is a post describing the problem and some solutions. I haven't checked to see how many of the steps are still necessary on Emacs 26, but I bet it's still non-zero.
- simias 8y ago>Do you ever install packages from Emacs? If so, you definitely want that to be at least TLS protected. Wouldn't it make more sense to sign individual packages so that it doesn't matter if an attacker can mess with them "in flight"? That's generally how package managers work in my experience. It also means that you can let third parties create mirrors without trusting them fully. TLS doesn't really seem like the right solution for something like that.
- tialaramex 8y agoThis feels like enough, doesn't it? But it's not. You will also need to sign and timestamp all repository metadata. Otherwise when you learn of bug X and fix it with patch P to produce new package package-V+1 I also learn of bug X, but I ensure my victims don't get told about new package-V+1, they will be told package-V is the latest version and they're now safely up-to-date - but I can exploit them. If you use TLS I can't meddle with the packages, or the metadata, or anything. You absolutely can secure everything in your package management system, but it will be a bit trickier than just signing individual packages. Whereas using TLS is enough. Back in 1995 when anonymous FTP distribution was commonplace, signing packages made a whole lot more sense than trying to get all your mirrors to update to HTTPS. In 2018 this is not so true.
- wahern 8y agoThey should be doing all of that anyhow. Servers get hacked. TLS doesn't fix the metadata replay problem.
- wyuenho 8y ago
- wyuenho 8y agoI'm the new guy mentioned in the article. This article is a bit late to the party and misses a lot of details that I've discovered since June. One of the reasons prompted this giant thread on the emacs-devel mailing list is when I was updating my Emacs config to try out Gnus for email and newsgroup, I discovered that no one seems to know exactly what a good TLS Emacs config should look like and that Emacs comes with horrible defaults. In addition, I was shocked that I've been exposed to a dozen TLS vulns that might cause arbitrary code execution the whole time since package.el became a part of Emacs back in circa-2013. After stuffing myself with about a dozen RFCs and many dozen more papers and Chrome and Firefox blog posts, here's what I found very concerning: 1. The initial "a bit concerning" and "very concerning" qualifiers I originally posted aren't as clear cut anymore, most of the 2 dozen failing badssl tests are actually quite bad. 2. NSM has got half a foot in the 2010s and half a foot in the 2000s. The latest stable version of Emacs (26.1) only checks for SHA1 end-certificate, usage of SSL, DH < 1024 bits and a noop RC4 cipher check (GnuTLS actually calls it ARCFOUR). 3. The half-done pinning mechanism does Trust on First Use while the user can't even see the entire cert chain or the end cert. 4. Only one fingerprint per host for TOFU, where Google low balances at least between 2 end-certs AFAIK. 5. Excessive and theatrical prompts for any URL that has not been visited on a security level called 'paranoid. 6. Multiple prompts for different problems found for the same TLS handshake. 7. Setting one option in a configuration group called GnuTLS to true bypasses NSM entirely. i.e. no cipher suite checks and happily accepts any 256-bit DH key exchange attempts. 8. No attempt to do any OCSP or Certificate Transparency revocation checking. 9. 4 packages intermingled with each other all securing some network connections badly with no documented relationships between them. 10. Virtually no one who has commit access to the Emacs repo understands TLS. 11. RMS prefixes every one of his email with: [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] while Emacs's network security settings is basically saying please come fuck me. The good news is, a few of these problems are already fixed on master and I've pushed a branch called "netsec" to the Emacs repo last week that fixes most of the rest. OCSP is coming this weekend. CT is going to wait quite a bit longer as GnuTLS has no plan to support it anytime soon. I have hope to make at least some of these security fixes to Emacs 26.2 or 26.3 in the short term. Medium term plan is to lobby for requiring TLS for all email protocols because RFC 8314. The long plan is obviously support TLS 1.3 for Emacs 27, and possibly HTTP2.
- jancsika 8y ago> It isn't the Emacs way to second-guess our users' needs, definitely not to decide for them what is and what isn't a matter of life and death for them. We provide options with some reasonable defaults, and then let users make informed decisions which defaults are not good enough for them. > It is IMO unreasonable to make our defaults match what happens in dictatorships that you describe, because that would unnecessarily inconvenience the majority of the users. Let's not follow the bad example of the TSA (whose rationale is, unsurprisingly, also matters of life and death). Here's that same response in an alternate Gnuniverse where software development is... different...: "Thanks, Jimmy. Security is outside my wheelhouse, so let me run your ideas by a security researcher I already know and trust. Then we'll figure out the most effective way to improve TLS in Emacs without creating a maintenance burden for the project. Best, A sensible developer who knows what they don't know"
- wyuenho 8y agoLOL, if only. It'll certainly save me a lot of work. //edit BTW, those aren't my words, those are Eli's responding to Perry
- jancsika 8y agoIt is funny, but I didn't mean it as a joke. It should generally be possible to predict the range of responses when submitting a patch to a free software project, or when posting to a free software list. If the input is "TLS" and the output is "TSA," it puts a strain on everyone and free software development suffers as a result.
- kqr 8y ago> We provide options with some reasonable defaults, and then let users make informed decisions which defaults are not good enough for them. This is fine for things that are apparent to the user, such as "I don't like this popup window, so I'll configure it to not show", or "I want a better command to split a quoted email, so I'll create that function". But in this case it's about something that happens behind the scenes, which users may not know needs changing. Now that I've had the relevant comment out of the way, let me be a little more general. > It isn't the Emacs way to second-guess our users' needs This is an odd statement to make. Or rather, let me say, Emacs has an approach to this that I haven't been able to explain to myself yet. It is absolutely true that Emacs tends to ship with so-so defaults, and that this is not a big deal because most users will want to change the defaults anyway. It is also the case that Emacs is very customizeable, so changing any defaults whatsoever has never been a problem. However, the term DWIM, meaning "do what I mean", originated in Emacs circles. It still flourishes there. I create dwim forms of commands all the time. There is often a simple contextual, environmental indicator as to whether I want one variant of a command or another. Not encapsulating that check and dispatching into a new command would be silly. That's a core part of Emacs and Lisp culture, in my opinion. So yes, it is also in fact the Emacs way to guess the users' needs. But transparently.
- mappu 8y agoWhy is a tradeoff between convenience-and-security being considered? It's a false dichotomy - Firefox and Chrome are secure-by-default and I do not find them inconvenient at all. Can emacs adopt their settings wholesale?
- wyuenho 8y agoI agree. Many of the checks in my "netsec" branch does take inspirations from Firefox and Chrome. However, there's a fundamental distinction - Emacs currently has 4 security levels (hopefully soon reduced to 3), whereas browsers only have one. There are also a few RFCs that demand terminating your connection say when you've negotiated SSLv3. Emacs doesn't terminate and won't terminate before asking the user first (with caveats). Another difference is Emacs is used for all kinds of comms including email and Jabber, so browser practices may present compatibility problems with protocols other than HTTP. This is something that needs to be tested when my branch is merged into master, but this is difficult, as the current strategy seems to be just wait for a while and see if anybody complains. There's also a tendency for some people to avoid the emacs mailing lists, so the signal, or lack there of, may not be representative.
- gsnedders 8y ago> There are also a few RFCs that demand terminating your connection say when you've negotiated SSLv3. Emacs doesn't terminate and won't terminate before asking the user first (with caveats). That seems bad. There's plenty of evidence that if you ask the user "hey, do you want to continue but be insecure?" they'll blindly click "yes". While non-browser focused protocols may still rely on clients not forbidding insecure protocols, we should absolutely be trying to move away from blindly allowing insecure protocols (or effectively allowing them, given users typically click "yes"). I'd strongly suggest failing hard, and allowing per (host, port) exceptions in the config file, rather than asking every time.
- wyuenho 8y agoA number of people on emacs-devel, and IIRC, RMS too, suggests that we should not be over-protective parents of Emacs users, and on most levels, I agree. While this might seem like a strange philosophical position to take when it comes to security, I don't think it is (or will be) the case for Emacs. An Emacs user can override pretty much everything Emacs does, and there are well-defined options where you can force a cipher suite or bypass NSM completely. This might sound dangerous, but it's necessary in the event of a new TLS attack was discovered, and that Emacs' default is vulnerable, the user can easily override Emacs' and GnuTLS' default outside of both of these project's release cycles. Given how infrequent Emacs releases, I think this is the right approach.
- vemv 8y agoKinda on-topic, I still don't know how to setup Emacs 26 (which is a relatively recent release) on macOS - as opposed to all prior versions. Installation of packages will fail due to the TLS changes. This seems the best-informed solution but it's not working for me: https://blog.vifortech.com/posts/emacs-tls-fix/ https://blog.vifortech.com/posts/emacs-tls-fix/
- wyuenho 8y agoI don't know exactly why this solution won't work for you, there could be a number of issues at play here. In short, try this: 1. Reset all your 'tls 'nsm and 'gnutls customize options to their defaults. 2. $ rm -rf ~/.emacs.d/network-security.data 3. Install https://github.com/antifuchs/safe-tls-defaults-mode/blob/master/safe-tls-defaults.el https://github.com/antifuchs/safe-tls-defaults-mode/blob/mas... This nice gentlement packaged up the settings I suggested on a Reddit thread. It should work most of the time, if not, you can adjust the CLI string.
- vemv 8y agoTried out, no luck unfortunately. With that setup, both E25 and E26 get stuck forever while trying to fill the `~/.emacs/d/elpa` directory (with an actual freeze and no feedback)
- wyuenho 8y agoWhat about emacs -q ? Does the same issue still happen? If it doesn't, that sounds like a different package is locking up your emacs.
- vemv 8y agoFinally identified the issue - I was adding Marmalade as a repo, which cert is legitimately wrong (Chrome will warn over https://marmalade-repo.org/ https://marmalade-repo.org/). I just removed the repo - I'd say that Melpa won in recent years?
- move-on-by 8y ago> Pinning is what is done by sites like gmail to prevent third world dictatorships from using stolen certificate credentials to spy on their citizens. People who have been victims of this have had their email read, been arrested by state security forces for dissent, and have been tortured to death for lack of certificate pinning working in their browsers. Well, this is awkward - Chrome has deprecated HPKP in favor of a new header: 'Expect-CT' [1]. The new header requires any cert to have a valid certificate transparency log entry and has reporting features as well [2]. This is slightly different - the scenario above would be allowed to happen and would be be valid, but that it would be logged publicly. Whatever CA (dictatorships) had issued the cert would lose their trusted status. But then again, if you have a dictatorship, then you can require that your CA remains trusted and the burden of removing trust to your dictatorship CA would be on individual users. [1]: https://www.zdnet.com/article/google-chrome-is-backing-away-from-public-key-pinning-and-heres-why/ https://www.zdnet.com/article/google-chrome-is-backing-away-... [2]: https://scotthelme.co.uk/a-new-security-header-expect-ct/ https://scotthelme.co.uk/a-new-security-header-expect-ct/
- wyuenho 8y agoYeeeeeep. You are correct. That subthread was too contentious for me to intervene with this information, but I think I subsequently correctly him.
- Ajedi32 8y ago> if you have a dictatorship, you can require that your CA remains trusted How? I mean, I suppose you could mandate that all computers sold in your country come preinstalled with state-approved monitoring software. But barring that, what's going to stop users from downloading the latest version of Firefox which includes code marking your CA as untrusted?
- pecg 8y agoI know that from a technical point of view, Emacs is not just a text editor; I think it is a complete lisp virtual machine with a text-based interface that happens to be prepared for editing text by default, and thus it should be treated as such, instead of running it over as a userland program maybe one day it works as a standalone operating system, with its own kernel and JIT compiled lisp dialect. I'm saying this, because when I first started using Unix-like operating systems Emacs was one of the things that attracted me the most, but after actively using it for almost a year I saw how it moved away from the expected operation mode of a typical Unix environment, and I didn't like that. I came to appreciate the phylosophy of "One program to do one thing and do it well... make programs that work together", I consider it an elegant way to design and implement software, thus I don't see where Emacs fits on a Unix-like system. In the end, I ditched it in favor of something much more simple, fast and adecuate, this is where vis does an outstanding job, having the unique plus of using a structural regular expressions engine, and extensible using Lua. vis is small (source code and binary) and I don't have to think about what SSL implementation it should use, because there is a system library that does it for me, since vis is just a text editor, and succeeds at it.
- lispm 8y agoEmacs is a wide family of text editors. GNU Emacs is just one. Originally Emacs was implemented as a set of TECO macros. The second Emacs was then EINE (Eine is not Emacs). EINE was implemented in Lisp Machine Lisp on top of the Lisp Machine OS. One of the next Emacs editors was Multics Emacs, an Emacs implemented in Maclisp for the Multics mainframe computer. Both Maclisp and Lisp Machine Lisp were full-featured Lisp implementations and thus their Emacs was a Lisp-only implementation. From then on zillions of Emacs variants were implemented. This provides a list of Emacs implementations: http://www.finseth.com/emacs.html http://www.finseth.com/emacs.html GNU Emacs was developed as a text editor. Its implementation language are C and Elisp - not only the VM is coded in C, but there are other parts written in C. See for example: https://github.com/emacs-mirror/emacs/blob/master/src/frame.c https://github.com/emacs-mirror/emacs/blob/master/src/frame.... Then Elisp is the extension language for writing extensions (like minor or major modes) and applications using a text-editor user interface. These applications are using the programmable editor buffer as their user interface building block. General enhanced Lisp implementations which run as a standalone operating system, but which are not special purpose for editor implementation and which are not providing an editor-based user interface exist(ed) several: MIT Lisp Machine OS (and derived), Interlisp-D, ... Mezzano ( https://github.com/froggey/Mezzano https://github.com/froggey/Mezzano ). Since Elisp was an uncomplete and smaller Lisp - and not a systems programming dialect like Lisp Machine Lisp - its code base is mostly like that: no lexical binding, no real multithreading, no really scalable language constructs, ... moving this language forward is a) not easy and b) not really in the core interest (the core task is being a language for editor extensions). Also it is questionable whether its editor user interface is a good model for a general UI...
- dreamcompiler 8y agoI haven't been able to load a Melpa library with https for many months. I had assumed it was just because MacOS is weird about TLS since it doesn't use OpenSSL (getting freaking curl to work for https in MacOS sometimes takes hours of futzing around with libraries). But maybe it's Emacs' fault?