Skip to main content

More Info:

Ensure basic authentication is set to disabled on Kubernetes clusters.

Risk Level

High

Address

Security, Reliability

Compliance Standards

CISGKE

Triage and Remediation

Remediation

Using Console

To remediate the “Basic Authentication Should Be Disabled” misconfiguration in GCP using the GCP console, you can follow these steps:
  1. Open the GCP console and select the project that you want to work on.
  2. Go to the Cloud Run service that you want to remediate.
  3. Click on the “Edit and deploy new revision” button.
  4. Scroll down to the “Container” section and click on the “Show advanced settings” link.
  5. In the “Container” section, locate the “Environment variables” field.
  6. Click on the “Add item” button to add a new environment variable.
  7. In the “Name” field, enter “DISABLE_BASIC_AUTH”.
  8. In the “Value” field, enter “true”.
  9. Click on the “Save” button to save the changes.
  10. Redeploy the service to apply the changes.
Once you have completed these steps, Basic Authentication will be disabled for the Cloud Run service in GCP.

To remediate the “Basic Authentication Should Be Disabled” misconfiguration for GCP using GCP CLI, follow these steps:
  1. Open the Cloud Shell in your GCP console.
  2. Run the following command to list all the Cloud SQL instances in your project:
  1. Choose the instance for which you want to disable basic authentication and run the following command to update the instance:
Replace INSTANCE_NAME with the name of your Cloud SQL instance.
  1. After running the above command, you will see the updated instance information. Verify that the skip_enable_binlog_mysql flag is set to ON.
  2. Run the following command to verify that basic authentication is disabled:
If the output shows requireSsl: true, then basic authentication is disabled.Note: Disabling basic authentication may affect your application’s functionality, so make sure to test your application after making this change.
To remediate the “Basic Authentication Should Be Disabled” misconfiguration in GCP using Python, you can follow these steps:
  1. Import the necessary libraries:
  1. Set up the credentials to authenticate with the GCP API:
  1. Create a function to check if basic authentication is enabled:
  1. Create a function to disable basic authentication:
  1. Call the check_basic_auth function to check if basic authentication is enabled:
This code will check if basic authentication is enabled for any instances in the specified project and disable it if it is enabled. You can run this code periodically to ensure that basic authentication remains disabled.

Additional Reading: