Migrating to TCM 1.12
TCM 1.12 removes the built-in keys: the password encryption key and the private key for signing data. TCM no longer substitutes them by default: you must set both keys in the configuration, otherwise TCM fails to start.
In addition, in TCM 1.12, cluster configuration drafts belong to users, and shared drafts from earlier versions are deleted after the upgrade.
If you upgrade from version 1.11.1 or earlier, complete the steps from this section:
- before upgrading: Cluster configuration drafts;
- before starting TCM 1.12:
Run the console commands in the following order while TCM is stopped:
resign-data: sign the data with the new signature key.migrate-security: move the data to the new encryption key.resign-data: run it again if TCM has clusters with the integrity check enabled.
Also check the scripts that call TCM console commands: some commands now require keys. For details, see Console commands that require keys.
In TCM 1.12, a configuration draft belongs to the user who saved it. Drafts saved in earlier versions have no known author, so they are deleted on the first read of the cluster drafts after the upgrade. The deleted files are logged to the TCM log.
To avoid losing unsaved work, do the following for each cluster before upgrading TCM:
- Open the Cluster > Configuration page.
- Apply the drafts that are ready to be used in the cluster.
- Download the files you need to keep working on after the upgrade. After the upgrade, copy the edits to the editor and save them as your own draft.
To learn more about working with drafts in TCM 1.12, see Saving a configuration draft.
The built-in private key for signing data has been removed. At startup, TCM requires your own key set in the security.signature-private-key-file option.
To set the signature key:
-
Generate an RSA private key in the PEM format. Store the key outside the repository and restrict access to the file:
openssl genrsa -traditional -out /secure/path/private.pem 2048chmod 600 /secure/path/private.pem -
Set the path to the key in the TCM configuration file:
security:signature-private-key-file: /secure/path/private.pem -
If the TCM data was signed with the old built-in key, re-sign it with the new key. To do this, stop TCM and run the
resign-datacommand with the configuration where the new key is already set:tcm --config=cfg.yml resign-dataDo not start TCM until you move the data to the new encryption key (see Moving data to a new encryption key).
For details about data signing, see Integrity check.
The built-in password encryption key is no longer substituted. The security.encryption-key option and the
TCM_SECURITY_ENCRYPTION_KEY environment variable, which set the key as a string, have been removed.
Now the encryption key is set only in a file whose path is specified in the security.encryption-key-file option. The file must contain exactly 32 bytes. TCM fails to start without this option.
An example of creating a key file:
openssl rand -out /secure/path/new.key 32chmod 600 /secure/path/new.key
Cluster and LDAP passwords stored in the TCM storage are encrypted with the old key. To re-encrypt them with the new key,
use the migrate-security command. The command runs offline: stop all TCM instances before running it.
The migrate-security command:
- re-encrypts cluster and LDAP passwords with the new key using AES-GCM, including passwords that were already stored as AES-GCM under the old key;
- revokes all API tokens and web sessions. After the migration, users must log in to TCM again, and API tokens must be issued again.
Command options:
Option | Description |
|---|---|
--new-key-file | Required. The path to the file with the new 32-byte key |
--old-key-file | The path to the file with the old key. Specify it if the old key was set by you, including as a string in the security.encryption-key option. If the option is not specified, the built-in key is used as the old key |
--dry-run | Check the migration without changing data: the command verifies the keys and counts the records to be changed |
The new key must differ from the old one.
To move data to a new encryption key:
-
Stop all TCM instances.
-
Back up the TCM configuration storage (etcd or TbCS).
-
If your own key was used, prepare a file with it for the
--old-key-fileoption:-
if the key was set in the
security.encryption-key-fileoption, use this file; -
if the key was set as a string in the
security.encryption-keyoption or theTCM_SECURITY_ENCRYPTION_KEYenvironment variable, write it to a file. For example, if the configuration contained:security:encryption-key: "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6"create a file with this key:
printf '%s' 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6' > /secure/path/old.keychmod 600 /secure/path/old.keyThe
printf '%s'command does not add a trailing newline to the file. If the file contains extra characters, the key does not match the old one.
If the built-in key was used, skip this step.
-
-
Check the migration. Data is not changed, only the keys are verified.
-
If the built-in key (default) was used,
--old-key-fileis not needed:tcm --config=cfg.yml migrate-security --new-key-file new.key --dry-run -
If your own key was used, pass its file in
--old-key-file:tcm --config=cfg.yml migrate-security --old-key-file old.key --new-key-file new.key --dry-run
Here
new.keyis the file with the new 32-byte key,old.keyis the file with the old key. -
-
Run the migration — the same command without
--dry-run:-
for the built-in key:
tcm --config=cfg.yml migrate-security --new-key-file new.key -
for your own key:
tcm --config=cfg.yml migrate-security --old-key-file old.key --new-key-file new.key
-
-
Set the path to the new key in the TCM configuration file:
security:encryption-key-file: /secure/path/new.keyIf the configuration contains the
security.encryption-keyoption, delete it. -
If TCM has clusters with the integrity check enabled, re-sign the data again:
tcm --config=cfg.yml resign-data -
Start TCM:
tcm --config=cfg.yml
Since version 1.12, some TCM console commands read the encryption key, the signature key, or both. If the required key is not set in the configuration, the command fails with an error. The keys are set the same way as for starting TCM: in the security.encryption-key-file and security.signature-private-key-file options of the configuration file, environment variables, or command-line options.
Command | encryption-key-file | signature-private-key-file |
|---|---|---|
tcm (starting TCM) | Yes | Yes |
add-cluster | Yes | Yes |
delete-cluster | Yes | Yes |
user add | Yes | Yes |
user delete | Yes | Yes |
restore-admin | Yes | Yes |
config export | Yes | Yes |
resign-data | Yes* | Yes |
change-password | No | Yes |
role add | No | Yes |
role update | No | Yes |
role delete | No | Yes |
migrate-security | No** | Yes |
* The resign-data command requires the encryption key only if TCM has clusters with the integrity check enabled
whose configuration is stored in etcd or Tarantool.
** The migrate-security command gets the encryption keys from the --new-key-file and --old-key-file options.
The version, downgrade, check-config, and generate-config commands do not require keys.