Start a conversation

How to Configure a Custom Minimum Password Length in Kerio Connect

Overview

Kerio Connect allows administrators to enforce password complexity requirements for local user accounts.

By default, the minimum password length is 8 characters. Although the administration interface does not provide an option to modify this minimum, administrators can configure a custom password length using:

  1. The Kerio Connect Administration API (recommended).

  2. The mailserver.cfg configuration file.

The Administration API method was tested successfully on Kerio Connect 10.0.9 Patch 2 (Linux).

Method 1: Using the Kerio Connect Administration API (Recommended)

This method does not require server downtime. The commands below are written for a Linux or macOS terminal on a machine that can reach the administration port 4040.

Step 1: Authenticate with the Administration API

Run the following command, replacing the placeholders with the appropriate values:

curl -k -c cookies.txt -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"Session.login","params":{"userName":"<admin-username>","password":"<admin-password>","application":{"name":"Password policy","vendor":"Admin","version":"1.0"}}}' https://<server>:4040/admin/api/jsonrpc/

Copy the token value returned in the response.

Step 2: Retrieve the Domain ID and Current Password Settings

Run:

curl -k -b cookies.txt -H 'Content-Type: application/json' -H 'X-Token: <token>' -d '{"jsonrpc":"2.0","id":2,"method":"Domains.get","params":{"query":{"fields":["id","name","passwordComplexityEnabled","passwordMinimumLength"]}}}' https://<server>:4040/admin/api/jsonrpc/

Identify the domain you want to modify and copy its full id value (for example, keriodb://domain/035c09b2-7a51-4481-9218-13a026664f90).

Step 3: Set the Minimum Password Length

The following example sets the minimum password length to 12 characters.

curl -k -b cookies.txt -H 'Content-Type: application/json' -H 'X-Token: <token>' -d '{"jsonrpc":"2.0","id":3,"method":"Domains.set","params":{"domainIds":["<domain-id>"],"pattern":{"passwordMinimumLength":12}}}' https://<server>:4040/admin/api/jsonrpc/

Replace <domain-id> with the domain ID from Step 2. Use a value between 3 and 119 (see Important Considerations).

A response containing "errors":[] indicates that the change was saved.

Step 4: Verify the Configuration

Run the Domains.get command from Step 2 again to confirm the updated passwordMinimumLength value.

Step 5: Log Out

curl -k -b cookies.txt -H 'Content-Type: application/json' -H 'X-Token: <token>' -d '{"jsonrpc":"2.0","id":4,"method":"Session.logout"}' https://<server>:4040/admin/api/jsonrpc/

Important notes:

  • Every API request after authentication requires the session cookie (cookies.txt) and authentication token.

  • If either is missing, the server returns Session expired.

  • The -k option disables certificate verification. Omit it if the administration interface uses a trusted certificate.

Method 2: Modifying mailserver.cfg (Alternative)

Kerio Connect stores the minimum password length in the mailserver.cfg configuration file.

This method requires stopping the Kerio Connect service.

Note: Manual editing of the configuration file was not tested end to end. The Administration API method is therefore recommended. On Linux and macOS, edit the file as the root user, and use a value between 3 and 119.

Step 1: Stop Kerio Connect and Back Up the Configuration

Stop Kerio Connect and create a backup copy of mailserver.cfg.

The default directories are:

Operating system Directory
Windows C:\Program Files\Kerio\MailServer
Linux /opt/kerio/mailserver
macOS /usr/local/kerio/mailserver

Step 2: Modify the Password Length

Open mailserver.cfg and locate the <list name="Domain"> section.

Find the entry corresponding to the required domain by checking its Domain variable.

Locate:

<variable name="UserPasswordComplexityMinimumLength">8</variable>

Change the value to the required minimum, for example:

<variable name="UserPasswordComplexityMinimumLength">12</variable>

Step 3: Save and Restart

Save the configuration file and start Kerio Connect again.

For more information, see Modifying the mailserver.cfg.

Important Considerations

  • Password complexity must be enabled. The custom minimum only applies when User passwords must meet complexity requirements when creating or changing the password is enabled under Configuration > Domains > Edit > Security. With this option disabled, shorter passwords are accepted.

  • The setting is per domain. Each domain must be configured individually. New domains start with a minimum of 8 characters.

  • Use a value between 3 and 119. The API rejects values below 3 but does not check an upper limit. Passwords can be at most 119 characters, so a higher minimum would prevent users from setting any password. A value between 12 and 16 is typical.

  • Saving the domain does not reset the value. The administration interface only sends the settings you change, and it has no field for the minimum length.

  • Existing passwords remain valid. Previously configured passwords continue working until they are changed.

  • Password expiration: Administrators can enable User must change password every: [n] days under the domain's Security tab to require password changes.

Password policies for users authenticated through external directory services, such as Active Directory, are managed through those directory services.

References

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Alexandr Oliynyk

  2. Posted
  3. Updated

Comments