-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Move security tokens to a separate internal index #37236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
albertzaharovits
wants to merge
23
commits into
elastic:master
from
albertzaharovits:tokens_on_new_index
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
9493da4
Fork out the security tokens template
albertzaharovits c4d8a0a
No templates in SecurityIndexManager
albertzaharovits 903dbb7
Remove extraneous method from SecurityManager
albertzaharovits 748b8fb
SecurityIndexManager independent of static
albertzaharovits a93ada8
Merge branch 'master' into tokens_on_new_index
albertzaharovits ddda03e
Okay, let's go!
albertzaharovits 05de53b
TokenService
albertzaharovits a433eb9
Use alias to resolve the index in the SecurityManager
albertzaharovits ec21cec
WIP
albertzaharovits 441b971
WIP
albertzaharovits 24dafb3
Wonderfully
albertzaharovits e46ed31
Plug in SecurityUpgradeCheck
albertzaharovits 00c23f7
ExpiredTokenRemover
albertzaharovits 7dff216
Nits
albertzaharovits 4be665e
add creation time for tokens
albertzaharovits 37489fe
Yay!!
albertzaharovits 3eebd01
Merge branch 'master' into tokens_on_new_index
albertzaharovits 37d2d84
Merge branch 'master' into tokens_on_new_index
albertzaharovits 2d6e100
Templates have specific index patterns
albertzaharovits a626bc1
Merge branch 'master' into tokens_on_new_index
albertzaharovits e70d0d9
Renames
albertzaharovits ff22f81
Forgo "invalidated-token"
albertzaharovits f030a7f
StepListener
albertzaharovits File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
13 changes: 0 additions & 13 deletions
13
...gin/core/src/main/java/org/elasticsearch/xpack/core/upgrade/IndexUpgradeCheckVersion.java
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...in/resources/security-index-template.json → .../resources/security-index-template-6.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
151 changes: 151 additions & 0 deletions
151
x-pack/plugin/core/src/main/resources/security-index-template-7.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
{ | ||
"index_patterns" : [ ".security-7" ], | ||
"order" : 1000, | ||
"settings" : { | ||
"number_of_shards" : 1, | ||
"number_of_replicas" : 0, | ||
"auto_expand_replicas" : "0-1", | ||
"index.priority": 1000, | ||
"index.format": 6, | ||
"analysis" : { | ||
"filter" : { | ||
"email" : { | ||
"type" : "pattern_capture", | ||
"preserve_original" : true, | ||
"patterns" : [ | ||
"([^@]+)", | ||
"(\\p{L}+)", | ||
"(\\d+)", | ||
"@(.+)" | ||
] | ||
} | ||
}, | ||
"analyzer" : { | ||
"email" : { | ||
"tokenizer" : "uax_url_email", | ||
"filter" : [ | ||
"email", | ||
"lowercase", | ||
"unique" | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"mappings" : { | ||
"doc" : { | ||
"_meta": { | ||
"security-version": "${security.template.version}" | ||
}, | ||
"dynamic" : "strict", | ||
"properties" : { | ||
"username" : { | ||
"type" : "keyword" | ||
}, | ||
"roles" : { | ||
"type" : "keyword" | ||
}, | ||
"password" : { | ||
"type" : "keyword", | ||
"index" : false, | ||
"doc_values": false | ||
}, | ||
"full_name" : { | ||
"type" : "text" | ||
}, | ||
"email" : { | ||
"type" : "text", | ||
"analyzer" : "email" | ||
}, | ||
"metadata" : { | ||
"type" : "object", | ||
"dynamic" : true | ||
}, | ||
"enabled": { | ||
"type": "boolean" | ||
}, | ||
"cluster" : { | ||
"type" : "keyword" | ||
}, | ||
"indices" : { | ||
"type" : "object", | ||
"properties" : { | ||
"field_security" : { | ||
"properties" : { | ||
"grant": { | ||
"type": "keyword" | ||
}, | ||
"except": { | ||
"type": "keyword" | ||
} | ||
} | ||
}, | ||
"names" : { | ||
"type" : "keyword" | ||
}, | ||
"privileges" : { | ||
"type" : "keyword" | ||
}, | ||
"query" : { | ||
"type" : "keyword" | ||
} | ||
} | ||
}, | ||
"applications": { | ||
"type": "object", | ||
"properties": { | ||
"application": { | ||
"type": "keyword" | ||
}, | ||
"privileges": { | ||
"type": "keyword" | ||
}, | ||
"resources": { | ||
"type": "keyword" | ||
} | ||
} | ||
}, | ||
"application" : { | ||
"type" : "keyword" | ||
}, | ||
"global": { | ||
"type": "object", | ||
"properties": { | ||
"application": { | ||
"type": "object", | ||
"properties": { | ||
"manage": { | ||
"type": "object", | ||
"properties": { | ||
"applications": { | ||
"type": "keyword" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"name" : { | ||
"type" : "keyword" | ||
}, | ||
"run_as" : { | ||
"type" : "keyword" | ||
}, | ||
"doc_type" : { | ||
"type" : "keyword" | ||
}, | ||
"type" : { | ||
"type" : "keyword" | ||
}, | ||
"actions" : { | ||
"type" : "keyword" | ||
}, | ||
"rules" : { | ||
"type" : "object", | ||
"dynamic" : true | ||
} | ||
} | ||
} | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
x-pack/plugin/core/src/main/resources/security-tokens-index-template-7.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
"index_patterns" : [ ".security-tokens-7" ], | ||
"order" : 1000, | ||
"settings" : { | ||
"number_of_shards" : 1, | ||
"number_of_replicas" : 0, | ||
"auto_expand_replicas" : "0-1", | ||
"index.priority": 1000, | ||
"index.format": 7 | ||
}, | ||
"mappings" : { | ||
"doc" : { | ||
"_meta": { | ||
"security-version": "${security.template.version}" | ||
}, | ||
"dynamic" : "strict", | ||
"properties" : { | ||
"doc_type" : { | ||
"type" : "keyword" | ||
}, | ||
"creation_time" : { | ||
"type" : "date", | ||
"format" : "epoch_millis" | ||
}, | ||
"refresh_token" : { | ||
"type" : "object", | ||
"properties" : { | ||
"token" : { | ||
"type" : "keyword" | ||
}, | ||
"refreshed" : { | ||
"type" : "boolean" | ||
}, | ||
"invalidated" : { | ||
"type" : "boolean" | ||
}, | ||
"client" : { | ||
"type" : "object", | ||
"properties" : { | ||
"type" : { | ||
"type" : "keyword" | ||
}, | ||
"user" : { | ||
"type" : "keyword" | ||
}, | ||
"realm" : { | ||
"type" : "keyword" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"access_token" : { | ||
"type" : "object", | ||
"properties" : { | ||
"user_token" : { | ||
"type" : "object", | ||
"properties" : { | ||
"id" : { | ||
"type" : "keyword" | ||
}, | ||
"expiration_time" : { | ||
"type" : "date", | ||
"format" : "epoch_millis" | ||
}, | ||
"version" : { | ||
"type" : "integer" | ||
}, | ||
"metadata" : { | ||
"type" : "object", | ||
"dynamic" : true | ||
}, | ||
"authentication" : { | ||
"type" : "binary" | ||
} | ||
} | ||
}, | ||
"invalidated" : { | ||
"type" : "boolean" | ||
}, | ||
"realm" : { | ||
"type" : "keyword" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this truly a binary choice? Maybe the alias should point to both indices until the upgrade or something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a binary choice.
Tokens, expired or not, can sit in a single index at a certain moment in time: either
.security-6
or.security-tokens-7
. When the remover job starts, it builds the query accordingly. It is possible that after building the query and before its execution, the tokens can move (from.security-6
to.security-tokens-7
) and the delete will miss them, but they will be catched by the next removal job.