-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
The Kibana upgrade assistant has the ability to upgrades 5.x format indices by reindexing them into a new name and then aliasing the old name to the new name.
It includes the ability to do this for .security-6 and the intent was that this would be the recommended way to upgrade a security index from 5.x to work on 7.x
However, this has some unintended consequences.
Scenario
- I created a 5.6.15 cluster and created users and roles.
- I ran the 5.6 Elasticsearch migration API to convert that v5
.securityindex into.security-6with a.securityalias. - I copied the data and config to a new node running 6.7.0 BC3
- I started Elasticsearch and Kibana (also BC3) and ran the Kibana migration assistant on
.watches-6and.security-6
Result:
GET _cat/aliases
.triggered_watches .triggered_watches-6 - - -
.watches .reindexed-v6-watches-6 - - -
.watches-6 .reindexed-v6-watches-6 - - -
.security .reindexed-v6-security-6 - - -
.security-6 .reindexed-v6-security-6 - - -
.kibana .kibana_1 - - -
This is all in keeping with how the upgrade assistant is designed to work. We now have .reindexed-v6-security-6 index, and the .security and .security-6 aliases point to it.
Issue
The problem is that the protections we have to prevent users from getting accidental access to the security index rely on a strict naming convention.
Since Elasticsearch security knows nothing of the Kibana migration assistant, it does not apply any special access restrictions to the .reindexed-v6-security-6 index.
Consequently a user with this role (or many others like it)
{
"indices" : [
{ "names" : [ ".re*" ], "privileges" : [ "read" ] }
]
}
can read from the security index, and a user with write privileges would be able to do much more (e.g. reset passwords).
Solution
Broadly, there's 2 options
- Update Elasticsearch to know that
.reindexed-v6-security-6is another possible name for the security index. This is not particularly hard, we just need to make sure we cover everywhere it's needed (e.g.RestrictedIndicesNames, but alsoXPackUserand maybe others) - Change the Kibana assistant to do something special for
.security-6. It already has some knowledge about special indices - for example it stops Watcher before reindexing.watches-6
I also have a concern about the risk associated with having more than 1 possible name for the security index. As it stands, clusters that were originally upgraded from 5.x will have the .reindexed-v6-security-6 but clusters that upgraded from 6.x only, and clusters that were fresh 7.x installs will have .security-6.
Experience has shown that having too many variables like this leads to mistakes, which in the case of security can be mean quite significant problems.
Based on that, my preference would be something like:
- Change the Kibana assistant to rename
.security-6to.security-7 - Change Elasticsearch from 6.7 onwards to treat both
.security-6and.security-7as restricted indices - Change Elasticsearch from 7.0 onwards to name the internal security index as
.security-7whenever it needs to be created.
That seems to leave us in the lowest-risk end state (but I'm naturally cautious about such matters).