Setting up a password policy
Note
This feature is at the Preview stage.
To set up a password policy:
-
Log in to Yandex Identity Hub
using an administrator or organization owner account. -
In the left-hand panel, click
User pools and select the user pool. -
Click Password policy
and select Set password policy. -
Under Password complexity, specify the character class settings for the password:
-
Custom: Configure the minimum length depending on the number of character classes used in the password:
- One class (
abc) - Two classes (
aBc) - Three classes (
aBc1) - Four classes (
aB#c1)
This is the preferred option because it does not require particular characters and allows users to create more memorable yet strong passwords.
- One class (
-
Required: Select the character types for the password by activating the following options:
- Lowercase Latin letters
- Uppercase Latin letters
- Digits
- Special characters, e.g.,
!@#$%^&*
In the Minimum length field, specify the minimum number of characters in the password but not less than seven.
-
-
Under Password lifetime, set the minimum and maximum password lifetime (up to 730 days) or select Unlimited.
-
Under Brute force protection, specify:
- Number of failed password attempts before lockout: From 1 to 100.
- Failed attempt interval in minutes or seconds.
- Lockout duration in minutes or seconds.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
-
View the description of the CLI command for updating a user pool:
yc organization-manager idp userpool update --help -
Getting a list of user pools in the organization:
yc organization-manager idp userpool list \ --organization-id <organization_ID> -
Set up a password policy for the user pool:
yc organization-manager idp userpool update <pool_ID> \ --password-smart-one-class <minimum_length_for_1_class> \ --password-smart-two-classes <minimum_length_for_2_classes> \ --password-smart-three-classes <minimum_length_for_3_classes> \ --password-smart-four-classes <minimum_length_for_4_classes> \ --password-allow-similar \ --password-match-length <match_substring_length> \ --password-max-length <maximum_password_length> \ --password-min-days <minimum_lifetime_in_days> \ --password-max-days <maximum_lifetime_in_days> \ --bruteforce-attempts <number_of_attempts> \ --bruteforce-window <count_interval> \ --bruteforce-block <lockout_duration>Where:
-
To configure custom character types (smart policy):
--password-smart-one-class: Minimum password length if using one character class (e.g., lowercase letters only).--password-smart-two-classes: Minimum password length if using two character classes (e.g., lowercase and uppercase letters).--password-smart-three-classes: Minimum password length if using three character classes (e.g., letters and numbers).--password-smart-four-classes: Minimum password length if using four character classes (letters, numbers, and special characters).
-
To configure required character types (fixed policy):
--password-fixed-min-length: Minimum password length (at least 7 characters).--password-fixed-lowers-required: Require lowercase letters.--password-fixed-uppers-required: Require uppercase letters.--password-fixed-digits-required: Require numbers.--password-fixed-specials-required: Require special characters.
-
--password-allow-similar: Allow passwords similar to those used earlier. If the flag is not specified, using similar passwords is forbidden. -
--password-match-length: Minimum substring length for a similarity check with vulnerable sequences. -
--password-max-length: Maximum password length. If0, there is no limit. -
--password-min-days: Minimum number of days before the password should be changed. -
--password-max-days: Maximum number of days the password remains valid (up to 730 days). If0, passwords do not expire. -
--bruteforce-attempts: Number of wrong password entries before lockout (1 to 100). -
--bruteforce-window: Interval for counting wrong entries (e.g.,10mfor 10 minutes or600sfor 600 seconds). -
--bruteforce-block: Lockout duration after exceeding the wrong entry limit (e.g.,10mor600s).
Example of a command for setting up a password policy:
With custom character typesWith required character typesyc organization-manager idp userpool update fpd9mu9gqq12******** \ --password-smart-one-class 24 \ --password-smart-two-classes 14 \ --password-smart-three-classes 11 \ --password-smart-four-classes 10 \ --password-max-length 128 \ --password-max-days 365 \ --bruteforce-attempts 15 \ --bruteforce-window 10m \ --bruteforce-block 10myc organization-manager idp userpool update fpd9mu9gqq12******** \ --password-fixed-min-length 8 \ --password-fixed-lowers-required \ --password-fixed-uppers-required \ --password-fixed-digits-required \ --password-max-length 128 \ --password-max-days 365 \ --bruteforce-attempts 15 \ --bruteforce-window 10m \ --bruteforce-block 10m -
For more information about the yc organization-manager idp userpool update command, see the CLI reference.
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the relevant documentation on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
For more information about Terraform, see this guide.
-
Create a configuration file with the user pool and password policy settings:
resource "yandex_organizationmanager_idp_userpool" "my_userpool" { name = "<pool_name>" organization_id = "<organization_ID>" default_subdomain = "<subdomain>" description = "<pool_description>" password_quality_policy = { allow_similar = true max_length = 128 match_length = 4 # Use either `smart` or `fixed` # Configuring custom character types smart = { one_class = 24 two_classes = 14 three_classes = 11 four_classes = 10 } # Configuring required character types fixed = { min_length = 8 lowers_required = true uppers_required = true digits_required = true specials_required = false } } password_lifetime_policy = { min_days_count = 0 max_days_count = 365 } bruteforce_protection_policy = { attempts = 15 window = "10m" block = "10m" } }Where:
-
name: User pool name. -
organization_id: Organization ID. -
default_subdomain: Default subdomain for the pool. -
description: User pool description. -
password_quality_policy: Password complexity settings:allow_similar: Allow passwords similar to those used earlier.max_length: Maximum password length. If0, there is no limit.match_length: Minimum substring length for a similarity check with vulnerable sequences.
Use either
smartorfixed.-
smart: Configuring custom character types (minimum length depends on how many classes are used).one_class: Minimum password length if using one character class (e.g., lowercase letters only).two_classes: Minimum length of a password with two character classes (e.g., lowercase and uppercase letters).three_classes: Minimum password length if using three character classes (e.g., letters and numbers).four_classes: Minimum password length if using four character classes (letters, numbers, and special characters).
-
fixed: Configuring required character types (use instead ofsmart).min_length: Minimum password length (at least 7 characters).lowers_required: Require lowercase letters.uppers_required: Require uppercase letters.digits_required: Require numbers.specials_required: Require special characters.
-
password_lifetime_policy: Password lifetime settings.min_days_count: Minimum number of days before the password should be changed.max_days_count: Maximum number of days the password remains valid (up to 730 days). If0, passwords do not expire.
-
bruteforce_protection_policy: Settings for protection against password guessing.attempts: Number of wrong password entries before lockout (1 to 100).window: Interval for counting wrong entries (e.g.,10mfor 10 minutes or600sfor 600 seconds).block: Lockout duration after exceeding the wrong entry limit (e.g.,10mor600s).
For more information about
yandex_organizationmanager_idp_userpoolproperties, see this provider guide. -
-
Create the resources:
-
In the terminal, go to the directory where you edited the configuration file.
-
Make sure the configuration file is correct using this command:
terraform validateIf the configuration is correct, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.
-
Apply the changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
-
This will create a user pool subject to your password policy in the specified organization. You can check the new pool and its settings using the Cloud Center UI
yc organization-manager idp userpool get <pool_ID>
Use the update REST API method for the Userpool resource or the UserpoolService/Update gRPC API call.