Triage and Remediation
Remediation
Using Console
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:
- Log in to the GCP console (https://console.cloud.google.com/).
- Go to the Navigation menu and select “Compute Engine”.
- Select the VM instance that has Kibana installed and running.
- Click on “Edit” at the top of the page.
- Scroll down to the “Firewall” section and click on “Management, security, disks, networking, sole tenancy”.
- Under “Network interfaces”, click on the network interface that has the external IP address.
- Scroll down to the “Firewall rules” section and click on “Allow HTTP traffic” and “Allow HTTPS traffic” rules.
- Click on the “X” icon to delete both rules.
- Click on “Save” to apply the changes.
Using CLI
Using CLI
To remediate the Kibana Port Should Not Be Open misconfiguration on GCP using GCP CLI, you can follow these steps:
- Open the GCP Console and go to the Cloud Shell.
-
Run the following command to get the list of firewall rules:
- Identify the firewall rule that allows traffic to port 5601 (Kibana port). Note down the name of the firewall rule.
-
Run the following command to delete the firewall rule:
Replace [FIREWALL_RULE_NAME] with the name of the firewall rule identified in step 3.
- Confirm the deletion of the firewall rule by typing “y” when prompted.
-
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.
- 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.
Using Python
Using Python
To remediate the Kibana port being open on a GCP instance, you can follow these steps using the Python programming language:Note: This assumes that there is a firewall rule named
- Use the
google-cloud-compute
library to get a list of all instances in the project.
- Iterate over the list of instances and check if Kibana is running on any of them.
- 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.
kibana
that allows traffic to the Kibana port. If the firewall rule has a different name, you will need to modify the code accordingly.