EncryptionService
import { EncryptionService } from "@skipcheck/tm1-client"; Encryption at rest (schema 11.8.35, except where a method says): the model's files
encrypted with a data encryption key, itself protected by a key from a key management
service. The provider settings are a KeyProtectSettingsPatch (IBM Key Protect),
VaultSettingsPatch (HashiCorp Vault) or
LocalKeyFileProviderSettingsPatch (a key file made with the local GSKit).
What TM1 (11.8) does here that you might not expect:
- The local key file provider needs GSKit's
gsk9capicmd_64, which a TM1 install may lack (the Docker image used in this project's tests does): validation then reports "Could not generate a new key using the local GSKit installation". - On a server that isn't encrypted, the changing actions fail with a bare 400 and an
error code's name for a message:
DataModelConversion(configure, disable),DataFileConversion(encrypt or decrypt a file),DataEncryptionKeyRotationFailedandRotateDataModelKey. - Each must be run by a full administrator.
Encrypt the model with a key from IBM Key Protect, checking the settings first:
// Check the settings first: the report says what's wrong, without secrets
const keyProtect = KeyProtectSettingsPatch.builder()
.serviceEndpoint("https://us-south.kms.cloud.ibm.com")
.instanceID("8f2c1d6e-0000-4000-8000-000000000000")
.authRef("/run/secrets/key-protect-api-key")
.keyRef("planning-root-key")
.build();
const report = await tm1.encryption.validate(keyProtect);
if (report.IsValid !== true) throw new Error("Can't encrypt: " + JSON.stringify(report.Issues));
await tm1.encryption.configure(keyProtect);
Rotate the data encryption key:
// A new data encryption key; TM1 re-encrypts the whole model with it
return tm1.encryption.rotateDataEncryptionKey();
Members
validate | Checks the provider settings would work now (the key service is reachable and allows it, and the key exists), changing nothing. |
configure | Validates the provider settings, then applies them; a server not yet encrypted is encrypted. |
disable | Decrypts the model and stops encrypting it. |
rotateDataEncryptionKey | Makes a new data encryption key and re-encrypts the whole model with it. |
rotateDataModelKey | Rotates the model key. |
encryptFile | EncryptDataFile (schema 11.3.0). |
decryptFile | DecryptDataFile (schema 11.3.0). |
encryptModel | EncryptDataModel (schema 11.3.0). |
decryptModel | DecryptDataModel (schema 11.3.0). |
validate
validate(settings: EncryptionAtRestProviderSettingsPatch, options?: Tm1CallOptions): Promise<EncryptionAtRestValidationReport>ValidateEncryptionAtRestSettings: checks the provider settings would work now (the key service is reachable and allows it, and the key exists), changing nothing. The settings go as a parameter alias, ValidateEncryptionAtRestSettings(Settings=@settings)?@settings={…}. Returns the report: whether they're valid, and if not, the issues; never secrets.
TM1 REST FunctionImport ValidateEncryptionAtRestSettings
configure
configure(settings: EncryptionAtRestProviderSettingsPatch, options?: Tm1CallOptions): Promise<void>ConfigureEncryptionAtRest: validates the provider settings, then applies them; a server not yet encrypted is encrypted.
TM1 REST ActionImport ConfigureEncryptionAtRest
disable
disable(options?: Tm1CallOptions): Promise<void>DisableEncryptionAtRest: decrypts the model and stops encrypting it.
TM1 REST ActionImport DisableEncryptionAtRest
rotateDataEncryptionKey
rotateDataEncryptionKey(options?: Tm1CallOptions): Promise<void>RotateDataEncryptionKey: makes a new data encryption key and re-encrypts the whole model with it.
TM1 REST ActionImport RotateDataEncryptionKey
rotateDataModelKey
rotateDataModelKey(options?: Tm1CallOptions): Promise<void>RotateDataModelKey: rotates the model key.
TM1 REST ActionImport RotateDataModelKey
encryptFile
encryptFile(source: string, destination: string, type: EncryptionFileType, options?: Tm1CallOptions): Promise<void>EncryptDataFile (schema 11.3.0): encrypts one file, such as an exported cube. source is relative to the data directory or absolute; type says what the file is: a model object, a transaction log or an audit log.
TM1 REST ActionImport EncryptDataFile
decryptFile
decryptFile(source: string, destination: string, type: EncryptionFileType, options?: Tm1CallOptions): Promise<void>DecryptDataFile (schema 11.3.0): decrypts one file.
TM1 REST ActionImport DecryptDataFile
encryptModel
encryptModel(timeUntilShutdown?: number | null, options?: Tm1CallOptions): Promise<void>EncryptDataModel (schema 11.3.0): encrypts the model, then shuts the server down after timeUntilShutdown milliseconds, or, with none, TM1's wait.
TM1 REST ActionImport EncryptDataModel
decryptModel
decryptModel(timeUntilShutdown?: number | null, options?: Tm1CallOptions): Promise<void>DecryptDataModel (schema 11.3.0): decrypts the model, then shuts the server down after timeUntilShutdown milliseconds, or, with none, TM1's wait.
TM1 REST ActionImport DecryptDataModel