MySQL instance should have the 'skip_show_database' flag set to 'on'
Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel,
n'hésitez pas à nous contacter.
Description
It is recommended that for Cloud SQL Instances, you set the skip_show_database
database flag to ON
.
Rationale
The skip_show_database
database flag prevents people from using the SHOW DATABASES
statement if they do not have the SHOW DATABASES
privilege. This can improve security if
you have concerns about users being able to see databases belonging to other users. The skip_show_database
flag’s effect depends on the SHOW DATABASES
privilege: If the variable value is ON
, the SHOW DATABASES
statement is permitted only for users who have the SHOW DATABASES
privilege, and the statement displays all database names. If the value is OFF
, SHOW DATABASES
is permitted for all users, but displays the names of only those databases for
which the user has SHOW DATABASES
or other privilege. This recommendation is
applicable to MySQL database instances.
Using console
- Go to the Cloud SQL Instances page in the Google Cloud Console.
- Select the MySQL instance for which you want to enable the database flag.
- Click Edit.
- Scroll down to the Flags section.
- To set a flag that has not been set on the instance before, click Add item, choose the flag
skip_show_database
from the drop-down menu, and set its value to ON
. - Click Save to save your changes.
- Confirm your changes under Flags on the Overview page.
Using command line:
To list all Cloud SQL database Instances, run:
gcloud sql instances list
Configure the skip_show_database
database flag for every Cloud SQL MySQL database instance using the following command:
gcloud sql instances patch INSTANCE_NAME --database-flags
skip_show_database=on
Note: This command overwrites all database flags previously set. To keep the previously set flags and add new ones, include the values for all flags you want set on the instance; any flag not specifically included is set to its default value. For flags that do not take a value, specify the flag name followed by an equals sign (=
).
References
- https://cloud.google.com/sql/docs/mysql/flags
- https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_skip_show_database
Warning: This patch modifies database flag values, which may require your instance to be restarted. Check the list of supported flags to see if your instance will be restarted when this patch is submitted.
Note: Some database flag settings can affect instance availability or stability, and remove the instance from the Cloud SQL SLA. For information about these flags, see Operational Guidelines.
Note: Configuring the above flag restarts the Cloud SQL instance.
CIS controls
Version 8, 3.3 - Configure Data Access Control Lists
Configure data access control lists based on a user’s need to know. Apply data
access control lists, also known as access permissions, to local and remote file systems,
databases, and applications.