Skip to content

Backup .security #34454

@albertzaharovits

Description

@albertzaharovits

At present backing up the .security is achieved using the common snapshot APIs. The problem is that the snapshot and restore actions require a superuser if the snapshot will be including the .security index. This is a problem because periodic snapshotting is a good practice but using a superuser for it is obscuring the benefits.

A superuser is a user having the "superuser" role.
Only a superuser is able to read or write the ".security" index, as well as list it (in wildcards).

The Security Index contains:

  • Tokens - used to authn users without password; a token is shorter lived than a password
  • Users - attributes and hashed password for users under the Native & Reserved Realm
  • Role Mappings - rules that assign users (based on their attributes) to roles
  • Roles - description of permissions for each role
  • App Privileges - description of app privileges (outside of ES authz model, eg Kibana Spaces)

Right now, snapshotting is equivalent to reading the index because the user can add a repository and then restore it under a cluster of its own control. Likewise, restoring is equivalent to writing the index, hence the tight authorization enforcement when the ".security" index is included.

Snapshot and Restore are authorized as cluster actions by the manage privilege. This privilege is required irrespective of the indices being snapshotted. The manage cluster privilege is a very powerful privilege.

The proposed action plan will be based upon the existing snapshot and restore infra as opposed to using separate APIs. All the following changes concern only the snapshot operation. The restore operation should not be automated and is OK for it to require superuser. Moreover, this superuser should reside in the file realm because the .security has to be closed before restoring and therefore it cannot be used for this operation.

EDITED 16.04.19
EDITED 25.06.19

Proposed action plan

  1. create read-only system role for snapshotting internal indices (no other actions allowed, including restore which will still require superuser privileges); the internal indices set remains to be defined but it will include .security it is .security, .security-6 and .security-7 (and potentially .security-tokens and .security-tokens-7) .
    This has been completed by merging:
  1. fork ephemeral contents of the .security index to another security index sibling. This sibling should not be ordinarily snapshoted or restored (but should be optionally included). This index is called .snapshot-tokens and the work has been completed by merging and backporting:
  1. support client library encryption for at least one repository type . Encryption on the cloud client appears to be more promising than encryption on the repository side because the latter might not be compatible with incremental snapshotting.
    The client side encryption of the cloud client SDKs is patchy: some support it - AWS, others don't - GCS, and they offer various controls over the key format and where it can reside. Moreover key rotation looks like a taboo topic if you opt to store the encryption key outside the provider's "Vault Service". For this matter we've opted for a flexible solution, in which we do encryption via the Java API so that we can store the encryption key in the node's keystore file, but also the key handler could designate a key (eg address in the "Vault Service") that is meaningful only to the cloud library SDK.

    This is in-progress with the pre-requisite work of:
  • Consistent Secure Settings because data nodes with different encryption keys would amount to hard to detect failure mode.
  • Client Side Encrypted Snapshot Repositories
    In the last team's meeting we decided to remove the encrypted snapshot repo prerequisite of this feature's (Backup .security). Chief reason being that the main motivation for this feature now comes from users with encryption at rest and key management policies; these requirements are on a different level than we originally anticipated, so the complexity of this feature now outgrows the complexity of the Backup .security for which encryption is only a nice to have.
  1. Document (and maybe enforce) the snapshotting of the .security index only to a repository with encryption capabilities (see previous point). Documentation of the complete snapshot-restore flow (creating the file based role and user, closing .security, etc...) is also required.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions