brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: openssl errstr turns an error code into a readable message

Openssl
~/tips/tip-openssl-errstr-decode

openssl errstr 0A000086

Decode the hex error codes that OpenSSL based programs print in logs.

Logs from software that uses OpenSSL sometimes show only a hex code, like error:0A000086. openssl errstr translates it.

Pass the hex part of the code:

openssl errstr 0A000086

That prints error:0A000086:SSL routines::certificate verify failed. Now you know it is a trust problem, not a network or protocol one: the other side’s certificate could not be verified against the CA store.

The text before the double colon names the part of OpenSSL that raised the error, here the SSL routines, and the text after it is the reason. You can pass several codes in one command, like openssl errstr 0A000086 1C80007A, to decode a whole log line at once.

I find this useful with logs from mail servers, database clients or Python, where the full text was cut off or never printed at all.

Codes changed between major versions. OpenSSL 3 uses a new layout, so a code from an OpenSSL 1.1 log may decode to something unrelated, or to reason(...) without text, on a newer system. Run errstr with the same major version as the program that wrote the log; openssl version tells you what you have. It also only explains the message. To find out which certificate failed, you still need s_client or the program’s own debug output.

Further reading: OpenSSL: openssl-errstr

More Openssl tips openssl s_client -connect 203.0.113.10:443 -servername example.com </dev/null | openssl x509 -noout -subject openssl x509 -in cert.pem -days 365 -signkey key.pem -out cert-new.pem printf %s hello | openssl dgst -sha256 -hmac secret openssl pkcs12 -legacy -in old.pfx -nokeys echo 'aGVsbG8gd29ybGQ=' | openssl base64 -d All Openssl tips (34) All topics

Link