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 →
- Remove the public key from every
authorized_keysnow (Ansibleauthorized_key state=absent). - Issue a new key pair for the legitimate use.
- Check auth logs for that key's fingerprint from unknown IPs (
ssh-keygen -lf key.pub, then grep the fingerprint in logs withLogLevel VERBOSE). - 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."
More on Security, hardening and incident response
Monitoring shows a web server making outbound connections to an unknown IP on port 4444 at 2 AM. You suspect it is compromised. What do you do?AdvancedAfter the compromise you need to find how the attacker got in. Where do you look?AdvancedYour CISO asks you to harden a fresh Linux server baseline. What's on your list?IntermediateA developer says "SELinux keeps breaking my app, can we just disable it?" How do you respond and what do you do?IntermediateYou need to know when anyone modifies `/etc/sudoers`, `/etc/passwd` or SSH config. How?IntermediateA critical OpenSSL CVE is announced. How do you find and patch affected servers quickly?Intermediate