1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 07:08:01 +00:00

Add Check SSH Key Fingerprints Of Known Hosts as a Unix TIL

This commit is contained in:
jbranchaud
2023-03-27 12:57:45 -05:00
parent 54b71bbf24
commit 10554905ad
2 changed files with 33 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
_1292 TILs and counting..._
_1293 TILs and counting..._
---
@@ -1219,6 +1219,7 @@ _1292 TILs and counting..._
- [Change To That New Directory](unix/change-to-that-new-directory.md)
- [Check If A Port Is In Use](unix/check-if-a-port-is-in-use.md)
- [Check If Command Is Executable Before Using](unix/check-if-command-is-executable-before-using.md)
- [Check SSH Key Fingerprints Of Known Hosts](unix/check-ssh-key-fingerprints-of-known-hosts.md)
- [Check The Current Working Directory](unix/check-the-current-working-directory.md)
- [Clear The Screen](unix/clear-the-screen.md)
- [Command Line Length Limitations](unix/command-line-length-limitations.md)

View File

@@ -0,0 +1,31 @@
# Check SSH Key Fingerprints Of Known Hosts
The `ssh-keygen` utility can do a bunch of things related to SSH keys including
generating key pairs, removing a key, and even showing the fingerprints for a
public keys file.
After [the recent GitHub SSH key
rotation](https://github.blog/2023-03-23-we-updated-our-rsa-ssh-host-key/), I
wanted to check that the key I had added produced a fingerprint matching what
they described in the article.
The `-l` flag will list the fingerprints and the `-f` flag allows you to
specify what file it processes when doing that.
```bash
ssh-keygen -lf ~/.ssh/known_hosts
```
I have a bunch of known hosts, so I can narrow it down to just the GitHub entry
like so.
```bash
ssh-keygen -lf ~/.ssh/known_hosts | grep github.com
3072 SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s github.com (RSA)
```
And [it matches what GitHub
lists](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints),
so I'm good to go.
See `man ssh-keygen` for more details.