Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • MK – MasterKeyEncrypts cache keys. Master key is stored in some key storage. Master keys identified by String masterKeyId .

Prerequisites

New master key should be available to EncryptionSPI for each server node.

...

Users can control the master key rotation process key via  some kind of user interface(CLI, JMX, Java API). 

  • JAVA API:
    ignite.encryption().changeMasterKey(String masterKeyId)  - starts master key rotation process.
    String ignite.encryption().getMasterKeyId()  - gets current master key id.

  • JMX:
    changeMasterKey(String masterKeyId)  - starts master key rotation process.
    String getMasterKeyId()     - gets current master key id.

  • CLI:
    # Starts master key rotation.
    control.sh --encryption change_master_key newMasterKeyId 

    # Displays cluster's current master key id.
    control.sh --encryption get_master_key 

    # Starts ignite with MK recovery process. See details.
    ignite.sh --change-master-key newMasterKeyId 

Process description 

  1. A node creates the ChangeMasterKeyMessage message and sent it by discovery as a custom event. The goal is to verify that all nodes have the same master key. 
    1. Initiating message should contain: 
      1. New master key id
      2. New master key hash.
    2. When server node processed message following actions are executed: 
      1. It obtain hash of new master key.
      2. Compares it with the one in message
      3. If it differs then error added to the message.
  2. If on step1 there are some errors we log it and cancel process. Otherwise got to step3.
  3. The ChangeMasterKeyFinishMessage action message is sent by discovery as a custom event.
    1. Action message sould contain:
      1. New master key id.
    2. When server node processed message following actions are executed: 
      1. Blocks creation of encrypted cache key. 
      2. Reencrypt all cache group keys with new master key in a temporary datastructure. No changes in MetaStore.
      3. Create WAL logical record (ChangeMasterKeyRecord) that consist of:
        1. New master key id
        2. Reenctyped cache group keys.
      4. Write cache group keys to MetaStore.
      5. Unblock creation of encrypted cache key. 

...

To update this node user should run ignite with command to change master key before join:

ignite.sh --change-master-key newMasterKeyId 

The node will re-encrypt cache keys with new MK and try to join to cluster.

...

New methods will be introduced:

  • setMasterKeyId(String masterKeyId)  // Sets "current" master key id
  • String getMasterKeyId()  // Gets "current" master key id

Follow methods will work with master key that setted by previous method:

  • byte[] masterKeyDigest() 
  • byte[] encryptKey(Serializable key) 
  • Serializable decryptKey(byte[] key) 

This is necessary so that ignite can decrypt cache keys with the old master key and encrypt with the new one.

...

Currently joining node send hash MK for validation in attributes. Attributes can't be modified at runtime. So joining node will send hash MK in JoiningNodeDiscoveryData .