Skip to main content

Triage and Remediation

Remediation

Using Console

Sure, here are the step-by-step instructions to remediate the misconfiguration “Kibana Port Should Not Be Open” for GCP using GCP console:
  1. Log in to the GCP console (https://console.cloud.google.com/).
  2. Go to the Navigation menu and select “Compute Engine”.
  3. Select the VM instance that has Kibana installed and running.
  4. Click on “Edit” at the top of the page.
  5. Scroll down to the “Firewall” section and click on “Management, security, disks, networking, sole tenancy”.
  6. Under “Network interfaces”, click on the network interface that has the external IP address.
  7. Scroll down to the “Firewall rules” section and click on “Allow HTTP traffic” and “Allow HTTPS traffic” rules.
  8. Click on the “X” icon to delete both rules.
  9. Click on “Save” to apply the changes.
This will remediate the misconfiguration by removing the rules that allow HTTP and HTTPS traffic to the Kibana port.

To remediate the Kibana Port Should Not Be Open misconfiguration on GCP using GCP CLI, you can follow these steps:
  1. Open the GCP Console and go to the Cloud Shell.
  2. Run the following command to get the list of firewall rules:
  3. Identify the firewall rule that allows traffic to port 5601 (Kibana port). Note down the name of the firewall rule.
  4. Run the following command to delete the firewall rule:
    Replace [FIREWALL_RULE_NAME] with the name of the firewall rule identified in step 3.
  5. Confirm the deletion of the firewall rule by typing “y” when prompted.
  6. Verify that the firewall rule has been deleted by running the following command:
    The output should not include the firewall rule that allowed traffic to port 5601.
  7. Once you have confirmed that the firewall rule has been deleted, the Kibana port will no longer be open and the misconfiguration will be remediated.
Note: Before deleting the firewall rule, make sure that it is not required for any other services or applications running on your GCP project.
To remediate the Kibana port being open on a GCP instance, you can follow these steps using the Python programming language:
  1. Use the google-cloud-compute library to get a list of all instances in the project.
  1. Iterate over the list of instances and check if Kibana is running on any of them.
  1. If Kibana is running on an instance, use the google-cloud-compute library to delete the firewall rule that allows traffic to the Kibana port.
Note: This assumes that there is a firewall rule named kibana that allows traffic to the Kibana port. If the firewall rule has a different name, you will need to modify the code accordingly.
Update any existing google_compute_firewall rule that currently has allow { protocol = "tcp" ports = ["5601"] } and source_ranges = ["0.0.0.0/0"] so that source_ranges only contains the known IP CIDR blocks instead of 0.0.0.0/0; this change is in-place and does not force replacement of the firewall rule.For verification, terraform plan should show the existing firewall rule’s source_ranges changing from ["0.0.0.0/0"] (or other broad ranges) to the specified restricted CIDR blocks, with no other unrelated changes.