turbot/oci_compliance

Control: 2.1 Ensure no security lists allow ingress from 0.0.0.0/0 to port 22

Description

Security lists provide stateful or stateless filtering of ingress/egress network traffic to OCI resources on a subnet level. It is recommended that no security group allows unrestricted ingress access to port 22.

Remediation

From Console

  1. Login to OCI Console.
  2. Click in the search bar, top of the screen.
  3. Type Advanced Resource Query and hit enter.
  4. Click the Advanced Resource Query button in the upper right of the screen.
  5. Enter the following query in the query box:
query SecurityList resources where (IngressSecurityRules.source = '0.0.0.0/0' && IngressSecurityRules.protocol = 6 && IngressSecurityRules.tcpOptions.destinationPortRange.max = 22 && IngressSecurityRules.tcpOptions.destinationPortRange.min = 22)
  1. For each security list in the returned results, click the security list name.
  2. Either edit the ingress rule to be more restrictive, delete the ingress rule or click on the VCN and terminate the security list as appropriate.

From Command Line

  1. Execute the following command:
oci search resource structured-search --query-text "query SecurityList resources where (IngressSecurityRules.source = '0.0.0.0/0' && IngressSecurityRules.protocol = 6 && IngressSecurityRules.tcpOptions.destinationPortRange.max = 22 && IngressSecurityRules.tcpOptions.destinationPortRange.min = 22)"
  1. For each of the security lists identified get the its details.
oci network security-list get --security-list-id <security list id>
  1. Then either:
  • Update the security list, copy the ingress-security-rules element from the JSON returned by the above get call, edit it appropriately and use it in the following command
oci network security-list update --security-list-id <security-list-id> -- ingress-security-rules '<ingress security rules JSON>'

or

  • Delete the security list
oci network security-list delete --security-list-id <security list id>

Usage

Run the control in your terminal:

powerpipe control run oci_compliance.control.cis_v110_2_1

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run oci_compliance.control.cis_v110_2_1 --share

SQL

This control uses a named query:

core_security_list_restrict_ingress_ssh_all

Tags