Created
March 27, 2023 02:25
-
-
Save dotysan/d9005c3cfd8c3c5377941e9edd1b5d8f to your computer and use it in GitHub Desktop.
Purge your SSH known_hosts file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.