A server holds secrets in `/etc/app/config.yml` readable by everyone. How do you fix and prevent this?
BeginnerScenarioSecurity, hardening and incident response
Answer
Situation read → Tighten permissions now, move secrets out long term.
What I'd do →
sudo chown root:app /etc/app/config.yml
sudo chmod 640 /etc/app/config.yml
sudo find /etc -type f -perm -o+r -name '*.yml' -exec grep -l -i 'password' {} +
Rotate the exposed secrets, then move them to Vault or a cloud secret manager and enforce modes in config management.
Why → Any local user or exploited service could read world-readable secrets.
Interview tip → Always rotate after exposure; fixing permissions doesn't un-leak a secret.
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