Rotate that exposed GitHub RSA key via chezmoi #2904
Replies: 4 comments 5 replies
-
Ooh, that's really neat! Thank you! |
Beta Was this translation helpful? Give feedback.
-
Beautiful! Thanks for sharing both the solution and the link to the issue. This is now in my team's shared config 🤓 :
|
Beta Was this translation helpful? Give feedback.
-
Unfortunately, there’s a bug in the regex as written because the base64 encoding of the key includes
|
Beta Was this translation helpful? Give feedback.
-
A, and as you have discovered, I did not properly test this on a user profile that still had the vulnerability. Updated syntax: {{- /* chezmoi:modify-template */ -}}
{{/* Replace exposed GitHub RSA key */}}
{{- .chezmoi.stdin | replace
"AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="
"AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk="
-}} |
Beta Was this translation helpful? Give feedback.
-
I wrote this little template today, after much consternation about how to go about systematically assuring that I know longer trust GitHub's exposed RSA key.
File path:
private_dot_ssh/modify_private_known_hosts
{EDITED: As others pointed out, my original syntax didn't work with the particular key because plus symbols were not being treated literally, but as regex special characters. Switching the templating function to just plain 'ol
replace
fixed it.}This solution is idempotent and will not stage any changes after being applied. Love this project.
Beta Was this translation helpful? Give feedback.
All reactions