skipcheck

TM1 client · Docs · The server

EncryptionService

from skipcheck_tm1.services import EncryptionService

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), DataEncryptionKeyRotationFailed and RotateDataModelKey.
  • 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
key_protect = (
    KeyProtectSettingsPatch.builder()
    .service_endpoint("https://us-south.kms.cloud.ibm.com")
    .instance_id("8f2c1d6e-0000-4000-8000-000000000000")
    .auth_ref("/run/secrets/key-protect-api-key")
    .key_ref("planning-root-key")
    .build()
)
report = tm1.encryption.validate(key_protect)
if not report.is_valid:
    raise RuntimeError(f"Can't encrypt: {report.issues}")
tm1.encryption.configure(key_protect)

Rotate the data encryption key:

# A new data encryption key; TM1 re-encrypts the whole model with it
tm1.encryption.rotate_data_encryption_key()

The asyncio flavor, skipcheck_tm1.aio, has the same methods to await, on AsyncEncryptionService.

Members

validateChecks the provider settings would work now (the key service is reachable and allows it, and the key exists), changing nothing.
configureValidates the provider settings, then applies them; a server not yet encrypted is encrypted.
disableDecrypts the model and stops encrypting it.
rotate_data_encryption_keyMakes a new data encryption key and re-encrypts the whole model with it.
rotate_data_model_keyRotates the model key.
encrypt_fileEncryptDataFile (schema 11.3.0).
decrypt_fileDecryptDataFile (schema 11.3.0).
encrypt_modelEncryptDataModel (schema 11.3.0).
decrypt_modelDecryptDataModel (schema 11.3.0).

validate

validate(settings: Any) -> EncryptionAtRestValidationReport

ValidateEncryptionAtRestSettings: checks the provider settings would work now (the key service is reachable and allows it, and the key exists), changing nothing. Returns the report: whether they're valid, and if not, the issues; never secrets.

TM1 REST FunctionImport ValidateEncryptionAtRestSettings

configure

configure(settings: Any) -> None

ConfigureEncryptionAtRest: validates the provider settings, then applies them; a server not yet encrypted is encrypted.

TM1 REST ActionImport ConfigureEncryptionAtRest

disable

disable() -> None

DisableEncryptionAtRest: decrypts the model and stops encrypting it.

TM1 REST ActionImport DisableEncryptionAtRest

rotate_data_encryption_key

rotate_data_encryption_key() -> None

RotateDataEncryptionKey: makes a new data encryption key and re-encrypts the whole model with it.

TM1 REST ActionImport RotateDataEncryptionKey

rotate_data_model_key

rotate_data_model_key() -> None

RotateDataModelKey: rotates the model key.

TM1 REST ActionImport RotateDataModelKey

encrypt_file

encrypt_file(source: str, destination: str, type: EncryptionFileType) -> None

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

decrypt_file

decrypt_file(source: str, destination: str, type: EncryptionFileType) -> None

DecryptDataFile (schema 11.3.0): decrypts one file.

TM1 REST ActionImport DecryptDataFile

encrypt_model

encrypt_model(time_until_shutdown: float | timedelta | None = None) -> None

EncryptDataModel (schema 11.3.0): encrypts the model, then shuts the server down after time_until_shutdown (seconds), or TM1's wait if None.

.. deprecated:: 11.8.35 Deprecated in TM1 schema 11.8.35: use configure.

TM1 REST ActionImport EncryptDataModel

decrypt_model

decrypt_model(time_until_shutdown: float | timedelta | None = None) -> None

DecryptDataModel (schema 11.3.0): decrypts the model, then shuts the server down.

.. deprecated:: 11.8.35 Deprecated in TM1 schema 11.8.35: use disable.

TM1 REST ActionImport DecryptDataModel