Interview Prep/Linux/Security, hardening and incident response

A developer accidentally committed a private SSH key used on production servers to a public GitHub repo. What do you do?

IntermediateScenarioSecurity, hardening and incident response
Answer

Situation read → Treat the key as compromised immediately; deleting the commit isn't enough.

What I'd do →

  1. Remove the public key from every authorized_keys now (Ansible authorized_key state=absent).
  2. Issue a new key pair for the legitimate use.
  3. Check auth logs for that key's fingerprint from unknown IPs (ssh-keygen -lf key.pub, then grep the fingerprint in logs with LogLevel VERBOSE).
  4. Purge from git history (git filter-repo) and enable secret scanning / push protection.

Why → Bots scrape GitHub for keys within minutes.

Interview tip → "Revoke first, clean up history second."

All Linux questions Roadmap: Linux

More on Security, hardening and incident response