Interview Prep/DevSecOps/Container and IaC Security

A security group allows `0.0.0.0/0` on port 22. How do you fix it properly?

BeginnerScenarioContainer and IaC Security
Answer

Situation read → Internet-exposed SSH is scanned and brute-forced constantly.

What I'd do →

  1. Remove the rule: aws ec2 revoke-security-group-ingress --group-id sg-... --protocol tcp --port 22 --cidr 0.0.0.0/0.
  2. Replace admin access with AWS Systems Manager Session Manager (no inbound port, IAM-authenticated, logged).
  3. If SSH is unavoidable, restrict to a bastion or VPN CIDR.
  4. Add a Config rule restricted-ssh and a Checkov check to prevent regressions.

Why → No open port means nothing to scan.

Interview tip → Session Manager is the answer most interviewers want.

All DevSecOps questions Roadmap: Policy as code

More on Container and IaC Security