Skip to content

Instantly share code, notes, and snippets.

@dotysan
Created March 27, 2023 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dotysan/d9005c3cfd8c3c5377941e9edd1b5d8f to your computer and use it in GitHub Desktop.
Save dotysan/d9005c3cfd8c3c5377941e9edd1b5d8f to your computer and use it in GitHub Desktop.
Purge your SSH known_hosts file
# was reading https://github.blog/2023-03-23-we-updated-our-rsa-ssh-host-key/
# and decided to perform a simple purge...
awk '/^#/||$2=="ssh-rsa"&&length($3)<544 {print}' ~/.ssh/known_hosts >~/.ssh/known_hosts.buh-bye.`date -Im` && \
awk '/^#/||$2=="ssh-rsa"&&length($3)<544{next}{print}' ~/.ssh/known_hosts >~/.ssh/known_hosts.new && \
mv ~/.ssh/known_hosts.new ~/.ssh/known_hosts
@dotysan
Copy link
Author

dotysan commented Mar 27, 2023

I suppose there are other aged pubkeys that we should remove...but that's all I had on this test box.

If you see other short or insecure key patterns to remove, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment