Custom password policies

更新时间:
复制 MD 格式

ApsaraDB for MyBase lets you set a custom password policy to enhance database security.

Prerequisites

Overview

For MySQL 5.7 instances, you can use the validate_password plugin to configure password complexity rules for database accounts:

  • Whether the password can be the same as the username.

  • Required password length.

  • Required number of uppercase and lowercase letters.

  • Required number of digits.

  • Required number of special characters.

  • Password strength level.

Step 1: Install the validate_password plugin

  1. Connect to a MyBase for MySQL instance.

    Note

    You must connect to the MySQL instance using a privileged account. For more information, see Create a database account.

  2. In your SQL client, run the following command to install the validate_password plugin.

    INSTALL PLUGIN validate_password SONAME 'validate_password.so';
  3. Run the following command to verify that the plugin is installed.

    SHOW GLOBAL VARIABLES LIKE 'validate_password%';

    After you run the command, the command returns a list of validate_password system variables and their current values. The plugin is installed successfully if the output shows default values, such as validate_password_dictionary_file being empty, validate_password_length as 8, validate_password_mixed_case_count as 1, validate_password_number_count as 1, validate_password_policy as MEDIUM, and validate_password_special_char_count as 1.

Step 2: Configure password policy parameters

  1. Log on to the ApsaraDB for MyBase console.

  2. In the upper-left corner of the page, select a region.

  3. In the left-side navigation pane, choose Instances > MySQL.

  4. Find your target instance, click Details in the Actions column, and then click Parameters in the left-side navigation pane.

  5. Configure the loose_validate_password parameters. The parameters are described as follows.

    Note

    Before you modify the following parameters, you must complete Step 1: Install the validate_password plugin. Otherwise, your changes will not take effect.

    Parameter

    Description

    loose_validate_password_check_user_name

    Determines if a password can be the same as the username. Valid values:

    • ON: Allowed.

    • OFF: Not allowed.

    Default: OFF.

    validate_password_policy

    The password strength level. Valid values:

    • 0 (LOW): Checks only the password length.

    • 1 (MEDIUM): Checks the password length, number of digits, number of uppercase and lowercase letters, and number of special characters.

    • 2 (STRONG): Checks all criteria for the MEDIUM level and also checks against a dictionary file.

      Note

      You cannot specify a dictionary file. Therefore, strength levels 1 and 2 are equivalent.

    Default: 1.

    validate_password_length

    The minimum password length. Valid values: 0 to 256.

    Default: 8.

    validate_password_number_count

    The minimum number of digits required in a password. Valid values: 0 to 256.

    Default: 1.

    validate_password_mixed_case_count

    The minimum number of uppercase and lowercase letters required in a password. Valid values: 0 to 256.

    Default: 1.

    validate_password_special_char_count

    The minimum number of special characters required in a password. Valid values: 0 to 256.

    Default: 1.

    Note