r/linuxadmin • u/Hakky54 • Jun 04 '22
Certificate Ripper released - tool to extract server certificates
24
u/Hakky54 Jun 04 '22 edited Jun 04 '22
Hello everyone. Last year I have been working on the certificate ripper application. It is an easy to use cli tool to extract the full chain of any server/website. The end user can inspect any sub fields and details easily on the command line. Next to that it can also print it in pem format and also export to a truststore container. I have made it available for Mac OS X through homebrew, and also published debian, arm and windows binaries. I would love to hear your opinion and any feedback is welcome :) See here for the github repo: GitHub - Certificate Ripper
0
-8
u/Sigg3net Jun 04 '22
This must be nice with Wireshark for https. (I've only ever used the SSHKEYFILE 'hack" to get the key.)
Cheers;)
2
u/SecuredStealth Jun 05 '22
Wow! This is a very helpful contribution, and you should be proud of this!
1
47
u/-_Scarecrow_-_ Jun 04 '22
Sheesh. Remind me to never make a tool for Linux admins 😂
Tough crowd.
Cool tool
1
0
u/michaelpaoli Jun 04 '22
One can also, "of course", use, e.g., openssl, or nmap. But, maybe if one wants additional built-in capabilities/features or whatever ...
E.g.:
(servername=www.reddit.com; port=443; IPv4=$(dig +short "$servername". A | grep '^[.0-9]\{1,\}$' | sort -R | head -n 1); [ -n "$IPv4" ] && </dev/null openssl s_client -servername "$servername" -connect "$IPv4:$port" 2>>/dev/null | sed -ne '/^-----BEGIN CERTIFICATE-----$/,/^-----END CERTIFICATE-----$/p')
nmap -n -Pn -p 443 -r -sT --script=ssl-cert -v www.reddit.com | sed -ne '/^| -----BEGIN CERTIFICATE-----$/,/^|_-----END CERTIFICATE-----$/{s/^|[ _]//;p;/^-----END CERTIFICATE-----$/q}'23
u/linuxliaison Jun 04 '22
You kind of showed exactly why this guy’s tool is useful.
It does one thing and does it well, and makes it easy to remember how to do
4
u/darkguy2008 Jun 05 '22
Yeah, I'd rather remember to type "crip url=blah" than that long line of gibberish. Imagine missing an hyphen, or making a script to do just what this tool does.
6
u/1esproc Jun 05 '22
or making a script to do just what this tool does.
Why do you need a java app to do this which is going to require a JRE/JDK and environment variable setup apparently, when the script could have literally been a bash wrapper around
openssl5
u/linuxliaison Jun 05 '22
If it's a java app, I didn't realize that and think it's likely overkill.
1
u/Hakky54 Jun 05 '22
Although this app is written in java it does not require java to run it. Native binaries for windows, linux and Mac are present in the release section here: https://github.com/Hakky54/certificate-ripper/releases
1
u/Hakky54 Jun 05 '22
Although this app is written in java it does not require java to run it. Native binaries for windows, linux and Mac are present in the release section here: https://github.com/Hakky54/certificate-ripper/releases
3
u/darkguy2008 Jun 05 '22
I agree Java is a bad option for a script, but it's still appreciated. Everything is a wrapper anyways, why to have distros if we can use Gentoo instead?
Some people just don't have time or will to become shell script hackers. If this app is an apt-get away, that'd make some happy, and that's always good. Doesn't Linux always boasts itself on variety and different ways to do things? This is another valid one, and I like it.
2
u/rmzy Jun 05 '22
Most devs would script it honestly. Then it’s just a simple command and variable like you were saying
2
u/Ziferius Jun 06 '22
His tool also grabs the root cert. OpenSSL doesn't because the server doesn't serve it. It assumes you already have it in your trust store. In my use cases, that assumption wasn't accurate.
1
u/rmzy Jun 05 '22
Awesome tool. Was thinkin of working on a better way to use website certificates to verify webpage content while also being able to filter unverified/unwanted content out. Would probably go great built into a search engine or web browser.
What are other people using them for?
1
u/graysky311 Jun 04 '22
For a second I thought “oh shit did someone make a tool that can extract the private key?” That would be earth-shattering.
-3
u/seidler2547 Jun 04 '22
What's wrong with using Firefox for it? I know that I can also use openssl, but I'm lazy so I just use the Firefox certificate viewer and save it from there. It's basically two clicks away from any HTTPS website.
4
0
Jun 04 '22
[deleted]
5
u/linuxliaison Jun 04 '22
Cool, so I’ll make sure to write a script that sets up a squid instance automagically just so I can use this tool.
60
u/ykc87 Jun 04 '22
How is this different to / better than OpenSSL?