The sorry state of OpenSSL usability (2017)
jameshfisher.com
jameshfisher.com
This is untrue. The front page contains links to the documentation inline, OpenBSD/LibreSSL converted all of OpenSSL's awful perlpod documentation to semantic mdoc(5) markup, and even wrote new man pages for functions completely undocumented by OpenSSL.
See Ingo Schwarze' EuroBSDCon 2018 talk "Better documentation - on the web and for LibreSSL"
https://www.openbsd.org/papers/eurobsdcon2018-mandoc.pdf
And earlier writeups from 2016.
https://undeadly.org/cgi?action=article;sid=20161215221715
It's been a long road to improve the documentation, and it's substantially better than OpenSSL.
LibreSSL releases contain several parts:
libcrypto: a library of cryptography fundamentals
libssl: a TLS library
libtls: a new TLS library, designed to make it easier to write foolproof applications
Various utilities such as openssl(1), nc(1), and ocspcheck(8).
With libcrypto, libssl, libtls, openssl, nc, and ocspcheck all links pointing to man.openbsd.org/x does not scream documentation. The words 'documentation' or 'manual' appear nowhere on the libressl home page.They are undoubtedly present, but unless you click around assuming those aren't links to individual components, you wouldn't think so at a glance.
Sounds like a fair request. Perhaps someone should send them an email to let them know.
That being said, you put a finger on the main issue most security and privacy tool have: user friendliness.
Remember Sony, a 60 billion dollar company, completely fubared the DRM on the Playstation 2 because a developer didn't understand what an IV is. And you go through the OpenSSL docs and it will tell you where to supply your IV without ever explaining what it is. All it needs is a single paragraph explaining the best practices, probably 5 or 10 lines in the manual.
That was the first thing I looked for, and it took me a while to realize that the links "libcrypto", "libssl", etc on the main page were links to the documentation for each command. In fact, the only reason I found them was the fact that your post said "It _is_ linked to in their front page.", so I went back to find them.
Yeah, if I'd needed it right now, I would have figured it out eventually, but I think making it a bit more explicit (for lack of a better term) would be a good thing.
So they don't have to search, just read and click on links until they hit one that looks like a man page.
For experienced Unix users this is likely to be true. It's something that one just learns. For novice users, it is less likely.
Namely
https://man.openbsd.org/openssl.1
Which the author was complaining about needing to use google for. Specifically the https://man.openbsd.org/openssl.1#GENRSA seems well document.
Forks are just the way open source works and if documentation could be better then we are all free to contribute to it.
https://news.ycombinator.com/item?id=16025063
It would be nice if the author revised that remark.
Yeah no. OpenBSD developers did a really good job by improving the codebase of OpenSSL. See also some of their presentations: https://www.libressl.org/papers.html
Just to clarify: LibreSSL forked OpenSSL [1]. By definition they did not improve the codebase of OpenSSL.
I wrote a steaming data encryptor a little while back using openssl, just in C, it works fine now but the majority of my reading was existing implementations on the web and some out-of-date blogs coupled with some, sometimes-correct documentation and just pain trial-and-error paired with my good old friend Valgrind.
Unfortunately, in some industries it's go-FIPS-or-go-home, so we don't even have the choice of using a fork or an alternative at times.
If this is true outside of LibreSSL, that definitely sounds like Apple is NOT the problem in this case (though certainly not helping)
The commands aren't meaningless, but OpenSSL approaches the problem from a perspective that isn't what any ordinary user will want. Imagine you want to post a package to Brazil. You see a shop selling postage stamps - perfect. But of course such a shop is for stamp collectors.
They've got lots of Brazilian stamps (you don't need those at all). They've got stamps from every decade (you need current stamps). They have rare stamps (you don't want to pay extra!) and they have lots of used stamps (no longer valid).
Until relatively recently OpenSSL would default to creating CSRs by urging you to fill out largely irrelevant X.500 Distinguished Name and not even mention SAN dnsNames even though most users who want a CSR want it for a TLS server (e.g. web server) where the former is unimportant and the latter is vital.
When it comes to writing TLS client software you probably know the name of the server you want to talk to. A sane API would let you tell the library this once and do all the rest for you. But OpenSSL reflects the interesting (to stamp collectors) half dozen different places that server names are involved in different versions of the protocols, not this sane but boring API.
If you are a student of cryptographic history OpenSSL is great. If you are a application developer it's... poor. If you're a regular end user it's awful.
That is a fantastic analogy and I'm stealing it for my own uses!
Thanks for the great breakdown.
If you want to use OpenSSL on macOS, I suggest using the OpenSSL provided either in Brew or in MacPorts. That will give you a fully-functional setup (including help and man pages).
1. Apple is not usability testing this 3 year old version of a fork of openssl, because they're not supporting it at all.
2. help text not available because its an apple supplied fork. openssl does tell you to use 'help'
3. man pages do exist. Just not installed by apple like author expected
4. and stop forking OpenSSL; BSD project forked it and Apple wants BSD over anything else because they can put the software in their closed platforms. Even if libressl were on the up and up, Apple's still got a version from 2016 installed.
Those are all Apple problems, not openssl problems.
2. The issue the author complained about was `openssl --help` not working, and it doesn't work on any platform (because he got the command wrong). `openssl help` does work on OSX (I literally just tested it).
3. Yeah, that's the one issue we agree is an Apple issue.
4. Apple didn't make LibreSSL. Other systems besides Apple use LibreSSL, and the authors complaints about their lack of documentation are relevant regardless of what Apple does.
For anyone else interested, I just tested it as well. It appears that it prints a listing of all the commands offered by openssl (split into sections "Standard commands", "Message Digest commands", and "Cipher commands"), with no other descriptions or usage instructions. I tried `openssl help bf` to get more information, and it prints the options available to that command and their descriptions. I did not see any way to actually figure out what a command does, but it is possible I missed it.
No, this is specifically Apple's fuck up. The documentation is right there on OpenBSD! It pretty much always was. I have a live system running OpenBSD older than this rant, and the man pages are there. The default modulus is 2048 too.
That's pretty hilarious if Apple changed the default from 2048 to 512!
Other systems probably upgrade their copy of BSD userland more than once a decade... especially if they are the richest company on Earth.
There are probably 100 other user rants to accompany this for all the other massively out of date bits of BSD on MacOS.
Apple would actually very much like you to not use their OpenSSL: it is deprecated and you are not supposed to rely on it in your own applications.
OPENSSL(1) General Commands Manual OPENSSL(1)
NAME
openssl ? OpenSSL command line tool
SYNOPSIS
openssl command [command_opts] [command_args]
openssl list-standard-commands | list-message-digest-commands |
list-cipher-commands | list-cipher-algorithms |
list-message-digest-algorithms | list-public-key-algorithms
openssl no-command
DESCRIPTION
OpenSSL is a cryptography toolkit implementing the Transport Layer
Security (TLS v1) network protocol, as well as related cryptography
standards.
[...]I predict a popular tool favored by the HN community will break, leading to a highly-upvoted front page post that instructs everyone on how to reinstall the shim wrapper using an unsigned tarball from an unsafe non-Apple source and zero patches to that tool from us to make it use the modern macOS-provided library instead.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 19.04
Release: 19.04
Codename: disco
$ openssl --help
Invalid command '--help'; type "help" for a list.
$ openssl help 2>&1 | head -n 3
Standard commands
asn1parse ca ciphers cms
crl crl2pkcs7 dgst dhparam
$ openssl help asn1parse
Usage: asn1parse [options]
Valid options are:
-help Display this summary
-inform PEM|DER input format - one of DER PEM
-in infile input file
-out outfile output file (output format is always DER)
-i indents the output
$ openssl genrsa -out foo.pem
Generating RSA private key, 2048 bit long modulus (2 primes)
......................................................+++++
.......................+++++
e is 65537 (0x010001) openssl genrsa -out private_key.pem
Generating RSA private key, 2048 bit long modulus (2 primes)
These are all either MacOS or LibreSSL problems.This may not even be a LibreSSL problem since the version the author is using is 3 years old [1] MacOS userland is always so ancient, the other bits of BSD userland are even worse as far as I remember.
Just MacOS.
> If you want documented examples, everyone should know this is where man pages suck in general, they are usually just reference manuals.
OpenBSD is generally pretty good about providing some useful examples in man pages. The libressl man page has examples too, for genpkey at least.
RE man pages, I am speaking generally (as i said), i know nothing of OpenBSDs man pages, and it doesn't matter, my point was not that LibreSSL or OpenSSL man pages suck for examples, but that it's a bad premise for an argument against Open/LibreSSL.
$ openssl genrsa -out private_key.pem
Generating RSA private key, 2048 bit long modulus
.................+++
........................................+++
e is 65537 (0x10001)Checking the OpenBSD man page for the LibreSSL genrsa, it does seem to generate 2048-bit RSA keys by default[1].
Perhaps Apple just stuck with an older default (for backwards compat) or perhaps this wasn't changed yet in the old version of LibreSSL that Apple uses?
* https://github.com/libressl-portable/openbsd/commit/30eb68d7...
yes, i know even critical open source projects are extremely underfunded. perversely, the lack of funding meant that there weren't enough people to review code, which meant contributing was difficult - at least according to this article from 2014 shortly after heartbleed: https://arstechnica.com/information-technology/2014/04/tech-...
* https://marc.info/?l=openbsd-misc&m=139819485423701&w=2
"Note that FIPS mode isn't just worthless, it's actively harmful."
https://marc.info/?l=openbsd-misc&m=139819485423701&w=2
No one that cares enough to use LibreSSL over OpenSSL would want FIPS as reintroducing it would make LibreSSL demonstrably worse. Anyone that requires FIPS doesn't know or care enough about security to have a dog in the fight.
This is news to me! All I can say is, "Godspeed, Ted Unangst."
I'm constantly thankful that I'm able to work somewhere that I don't have to worry about other people's bogus security checkboxes.
openssl genrsa Generating RSA private key, 2048 bit long modulus
openssl version LibreSSL 2.6.5
So maybe install Mac updates?
* https://github.com/jameshfisher/jameshfisher.com/commits/mas...
See http://stackoverflow.com/questions/7406946/why-is-apple-depr... for more info and links
It's 2019! I can't think of anyone who seriously recommends RSA anymore. Switch to elliptic curve cryptography, where footbullets like a 512-bit RSA key offer aren't even on the table.
Probably because you have to use something, and it's not obvious which things have footbullets and which don't.
https://paragonie.com/blog/2017/06/libsodium-quick-reference...
https://libsodium.gitbook.io/doc/bindings_for_other_language...
It's a lot easier in 2019 than it was years ago.