01 Run iam compartment list command (Windows/macOS/Linux) with output query filters to list the ID of each compartment available in your Oracle Cloud Infrastructure (OCI) account:
oci iam compartment list
--all
--include-root
--query 'data[]."id"'
02 The command output should return the requested OCI compartment identifiers (OCIDs):
[
"ocid1.tenancy.oc1..aaaabbbbccccddddabcd1234abcd1234abcd1234abcd1234abcd1234abcd",
"ocid1.compartment.oc1..abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd"
]
03 Run network nsg list command (Windows/macOS/Linux) with the ID of the OCI compartment that you want to examine as the identifier parameter, the list the ID of each network security group (NSG) available in the selected compartment:
oci network nsg list
--compartment-id 'ocid1.tenancy.oc1..aaaabbbbccccddddabcd1234abcd1234abcd1234abcd1234abcd1234abcd'
--all
--query 'data[]."id"'
04 The command output should return the requested NSG identifiers (IDs):
[
"ocid1.networksecuritygroup.oc1.ap-sydney-1.1234bbbbccccddddabcd1234abcd1234abcd1234abcd1234abcd1234abcd",
"ocid1.networksecuritygroup.oc1.ap-sydney-1.aaaabbbbccccddddabcdabcd1234abcd1234abcd1234abcd1234abcd1234"
]
05 Run network nsg rules list command (Windows/macOS/Linux) with the ID of the OCI network security group (NSG) that you want to examine as the identifier parameter and custom output filters to describe the inbound rules that allow unrestricted network access on TCP port 3389 (RDP), configured for the selected NSG:
oci network nsg rules list
--nsg-id 'ocid1.networksecuritygroup.oc1.ap-sydney-1.1234bbbbccccddddabcd1234abcd1234abcd1234abcd1234abcd1234abcd'
--all 2>/dev/null | jq -r '.data[] | select(.source == "0.0.0.0/0" and .direction == "INGRESS" and ((."tcp-options"."destination-port-range".max >= 3389 and ."tcp-options"."destination-port-range".min <= 3389) or ."tcp-options"."destination-port-range" == null))'
06 The command output should return the inbound rules that allow unrestricted access on TCP port 3389:
{
"description": null,
"destination": null,
"destination-type": null,
"direction": "INGRESS",
"icmp-options": null,
"id": "ABC123",
"is-stateless": false,
"is-valid": true,
"protocol": "6",
"source": "0.0.0.0/0",
"source-type": "CIDR_BLOCK",
"tcp-options": {
"destination-port-range": {
"max": 3389,
"min": 3389
},
"source-port-range": null
},
"time-created": "2025-03-04T17:05:18.857000+00:00",
"udp-options": null
}
If the
network nsg rules list command does not return an output, there are no ingress rules that allow unrestricted RDP access configured for the selected NSG. If the command output returns one of more results, as shown in the example above, there are OCI network security group (NSG) that allow unrestricted inbound access on TCP port 3389. As a result, the RDP access to the target VM instances is not secured.
07 Repeat steps no. 5 and 6 for each OCI network security group available for your Virtual Cloud Network (VCN).
08 Repeat steps no. 3 - 7 for each VCN deployed within the selected Oracle Cloud Infrastructure (OCI) compartment.