Available since 1.18.0 (SE, EE)

An instance administrator can set the minimum length, required character types, and lifetime of local passwords. External providers such as LDAP govern the passwords users enter to sign in through those providers. If an account linked to an external provider also has a local password, the policy applies to that local password.

Configuring the policy

Use the general settings of the admin area to configure local passwords for the instance:

  1. Open the general settings page at /admin/application_settings/general.
  2. Expand “New user account restrictions”.
  3. Set “Minimum password length (number of characters)”. The default is 8, and the allowed range is 8–128.
  4. Under “Password character requirements”, select the applicable checkboxes among “Require numbers”, “Require lowercase letters”, “Require uppercase letters”, and “Require symbols”. All checkboxes are cleared by default.
  5. In “Password lifetime in days”, enter a whole number from 1 to 365 to enable expiration. Set it to 0 to disable expiration. The default is 0.
  6. Select “Save changes”.

Example of password settings in the admin area: minimum length, character requirements, and password lifetime

Requirements for new passwords

Each selected character type must appear at least once in the new password. The checks use Unicode character classes. For example, ١ counts as a number, and whitespace counts as a symbol.

Deckhouse Code checks the requirements when a local password is set during registration, changed, reset, or set by an administrator, including through the API. A change to the length or character requirements takes effect the next time a password is set. With password expiration enabled, the new password must also differ from the current one.

How the expiration date is calculated

Deckhouse Code counts the lifetime from the last time the local password was set or changed. Each day is 24 hours. For existing user-set passwords with no recorded change date, the count starts when password expiration was first enabled on the instance. If Deckhouse Code set the password automatically, the count starts when the user sets their own local password.

When you enable expiration or shorten the lifetime, existing passwords can expire as soon as you save the settings. For example, if Deckhouse Code recorded a password change 45 days ago and you set the lifetime to 30 days, that password expires immediately. If you enable expiration for the first time with the same 30-day lifetime, an existing user-set password with no recorded change date expires 30 days after you save the setting.

If you set the lifetime to 0 and later re-enable expiration, Deckhouse Code keeps the same rules for choosing the start date, including the original enablement date.

Expiration notices

During the last seven days before expiration, Deckhouse Code shows the expiration date and a link to change the password. Users can dismiss this notice for the current session. After expiration, the notice indicates that the password has expired.

Notices appear for users who can use a local password to sign in to the web interface or authenticate to Git.

When email delivery is available, Deckhouse Code checks passwords hourly. It sends a reminder if the password is still valid and expires within seven days. It sends the expiration email the first time it detects that the password has expired. Emails go to the notification address or, if none is set, the primary address.

Signing in after expiration

An active browser session continues after the password expires. At the next sign-in with the expired local password, enter the current password, enter and confirm a new password, and select “Update password”. Then sign in again with the new password.

If a client such as Git over HTTPS or Git Large File Storage (Git LFS) rejects an expired local password, follow the password reset link in the error message. If password recovery by email is unavailable, contact the instance administrator.

The expiration check applies when Deckhouse Code authenticates the local password. Sign-in through an external provider or with a passkey, and Git access with a valid token or SSH key, follow the rules for those authentication methods.

Configuring the policy through the REST API

Read the settings with GET /api/v4/application/settings and update them with PUT /api/v4/application/settings as an instance administrator.

This example sets a minimum length of 12 characters, requires all four character types, and sets a 90-day password lifetime.

Replace code.example.com with your instance address. Set the ADMIN_TOKEN environment variable to an instance administrator’s personal access token with the api scope. If Admin Mode is enabled, use a token that also has the admin_mode scope.

To update the settings, run the request:

curl --request PUT \
  --header "PRIVATE-TOKEN: ${ADMIN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data '{
    "minimum_password_length": 12,
    "password_number_required": true,
    "password_lowercase_required": true,
    "password_uppercase_required": true,
    "password_symbol_required": true,
    "password_lifetime_days": 90
  }' \
  "https://code.example.com/api/v4/application/settings"

Password policy parameters:

ParameterValue
minimum_password_lengthMinimum length of a new local password. Integer from 8 to 128. The default is 8
password_number_requiredRequirement for at least one number. Boolean, false by default
password_lowercase_requiredRequirement for at least one lowercase letter. Boolean, false by default
password_uppercase_requiredRequirement for at least one uppercase letter. Boolean, false by default
password_symbol_requiredRequirement for at least one symbol. Boolean, false by default
password_lifetime_daysMaximum lifetime of a local password in days. Integer from 0 to 365. The default is 0, which disables expiration

The request updates only the fields you include. You can send them all directly in the JSON body, as in the example.