forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
parameterized calls into racClient.get() to match solutions, adds mor…
…e log statements, added security as a required plugin to rule_registry plugin without which, the rac authorization class was receiving an undefined security client so our calls to shouldCheckAuthorization were failing silently. Added some routes and scripts to test authz functionality. To test please see the README in the rule_registry/scripts.
- Loading branch information
Showing
27 changed files
with
344 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
"requiredPlugins": [ | ||
"licensing", | ||
"features", | ||
"ruleRegistry", | ||
"data", | ||
"navigation", | ||
"kibanaLegacy", | ||
|
This file contains 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 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 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 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 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 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,24 @@ | ||
Users with roles granting them access to monitoring (observability) and siem (security solution) should only be able to access alerts with those roles | ||
|
||
```bash | ||
myterminal~$ ./get_security_solution_alert.sh observer | ||
{ | ||
"statusCode": 404, | ||
"error": "Not Found", | ||
"message": "Unauthorized to get \"rac:8.0.0:securitySolution/get\" alert\"" | ||
} | ||
myterminal~$ ./get_security_solution_alert.sh | ||
{ | ||
"success": true | ||
} | ||
myterminal~$ ./get_observability_alert.sh | ||
{ | ||
"success": true | ||
} | ||
myterminal~$ ./get_observability_alert.sh hunter | ||
{ | ||
"statusCode": 404, | ||
"error": "Not Found", | ||
"message": "Unauthorized to get \"rac:8.0.0:observability/get\" alert\"" | ||
} | ||
``` |
17 changes: 17 additions & 0 deletions
17
x-pack/plugins/rule_registry/server/scripts/get_observability_alert.sh
This file contains 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,17 @@ | ||
#!/bin/sh | ||
|
||
# | ||
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
# or more contributor license agreements. Licensed under the Elastic License | ||
# 2.0; you may not use this file except in compliance with the Elastic License | ||
# 2.0. | ||
# | ||
|
||
set -e | ||
|
||
USER=${1:-'observer'} | ||
|
||
# Example: ./find_rules.sh | ||
curl -s -k \ | ||
-u $USER:changeme \ | ||
-X GET ${KIBANA_URL}${SPACE_URL}/monitoring-myfakepath | jq . |
17 changes: 17 additions & 0 deletions
17
x-pack/plugins/rule_registry/server/scripts/get_security_solution_alert.sh
This file contains 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,17 @@ | ||
#!/bin/sh | ||
|
||
# | ||
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
# or more contributor license agreements. Licensed under the Elastic License | ||
# 2.0; you may not use this file except in compliance with the Elastic License | ||
# 2.0. | ||
# | ||
|
||
set -e | ||
|
||
USER=${1:-'hunter'} | ||
|
||
# Example: ./find_rules.sh | ||
curl -s -k \ | ||
-u $USER:changeme \ | ||
-X GET ${KIBANA_URL}${SPACE_URL}/security-myfakepath | jq . |
This file contains 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,5 @@ | ||
This user can access the monitoring route at http://localhost:5601/security-myfakepath | ||
|
||
| Role | Data Sources | Security Solution ML Jobs/Results | Lists | Rules/Exceptions | Action Connectors | Signals/Alerts | | ||
| :-----------------: | :----------: | :-------------------------------: | :---: | :--------------: | :---------------: | :------------: | | ||
| Hunter / T3 Analyst | read, write | read | read | read, write | read | read, write | |
11 changes: 11 additions & 0 deletions
11
x-pack/plugins/rule_registry/server/scripts/hunter/delete_detections_user.sh
This file contains 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,11 @@ | ||
|
||
# | ||
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
# or more contributor license agreements. Licensed under the Elastic License | ||
# 2.0; you may not use this file except in compliance with the Elastic License | ||
# 2.0. | ||
# | ||
|
||
curl -v -H 'Content-Type: application/json' -H 'kbn-xsrf: 123'\ | ||
-u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ | ||
-XDELETE ${ELASTICSEARCH_URL}/_security/user/hunter |
38 changes: 38 additions & 0 deletions
38
x-pack/plugins/rule_registry/server/scripts/hunter/detections_role.json
This file contains 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,38 @@ | ||
{ | ||
"elasticsearch": { | ||
"cluster": [], | ||
"indices": [ | ||
{ | ||
"names": [ | ||
"apm-*-transaction*", | ||
"auditbeat-*", | ||
"endgame-*", | ||
"filebeat-*", | ||
"logs-*", | ||
"packetbeat-*", | ||
"winlogbeat-*" | ||
], | ||
"privileges": ["read", "write"] | ||
}, | ||
{ | ||
"names": [".siem-signals-*"], | ||
"privileges": ["read", "write"] | ||
}, | ||
{ | ||
"names": [".lists*", ".items*"], | ||
"privileges": ["read", "write"] | ||
} | ||
] | ||
}, | ||
"kibana": [ | ||
{ | ||
"feature": { | ||
"ml": ["read"], | ||
"siem": ["all"], | ||
"actions": ["read"], | ||
"builtInAlerts": ["all"] | ||
}, | ||
"spaces": ["*"] | ||
} | ||
] | ||
} |
6 changes: 6 additions & 0 deletions
6
x-pack/plugins/rule_registry/server/scripts/hunter/detections_user.json
This file contains 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,6 @@ | ||
{ | ||
"password": "changeme", | ||
"roles": ["hunter"], | ||
"full_name": "Hunter", | ||
"email": "detections-reader@example.com" | ||
} |
11 changes: 11 additions & 0 deletions
11
x-pack/plugins/rule_registry/server/scripts/hunter/get_detections_role.sh
This file contains 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,11 @@ | ||
|
||
# | ||
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
# or more contributor license agreements. Licensed under the Elastic License | ||
# 2.0; you may not use this file except in compliance with the Elastic License | ||
# 2.0. | ||
# | ||
|
||
curl -H 'Content-Type: application/json' -H 'kbn-xsrf: 123'\ | ||
-u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ | ||
-XGET ${KIBANA_URL}/api/security/role/hunter | jq -S . |
10 changes: 10 additions & 0 deletions
10
x-pack/plugins/rule_registry/server/scripts/hunter/index.ts
This file contains 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,10 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import * as hunterUser from './detections_user.json'; | ||
import * as hunterRole from './detections_role.json'; | ||
export { hunterUser, hunterRole }; |
14 changes: 14 additions & 0 deletions
14
x-pack/plugins/rule_registry/server/scripts/hunter/post_detections_role.sh
This file contains 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,14 @@ | ||
|
||
# | ||
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
# or more contributor license agreements. Licensed under the Elastic License | ||
# 2.0; you may not use this file except in compliance with the Elastic License | ||
# 2.0. | ||
# | ||
|
||
ROLE=(${@:-./detections_role.json}) | ||
|
||
curl -H 'Content-Type: application/json' -H 'kbn-xsrf: 123'\ | ||
-u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ | ||
-XPUT ${KIBANA_URL}/api/security/role/hunter \ | ||
-d @${ROLE} |
14 changes: 14 additions & 0 deletions
14
x-pack/plugins/rule_registry/server/scripts/hunter/post_detections_user.sh
This file contains 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,14 @@ | ||
|
||
# | ||
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
# or more contributor license agreements. Licensed under the Elastic License | ||
# 2.0; you may not use this file except in compliance with the Elastic License | ||
# 2.0. | ||
# | ||
|
||
USER=(${@:-./detections_user.json}) | ||
|
||
curl -H 'Content-Type: application/json' -H 'kbn-xsrf: 123'\ | ||
-u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ | ||
${ELASTICSEARCH_URL}/_security/user/hunter \ | ||
-d @${USER} |
5 changes: 5 additions & 0 deletions
5
x-pack/plugins/rule_registry/server/scripts/observer/README.md
This file contains 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,5 @@ | ||
This user can access the monitoring route at http://localhost:5601/monitoring-myfakepath | ||
|
||
| Role | Data Sources | Security Solution ML Jobs/Results | Lists | Rules/Exceptions | Action Connectors | Signals/Alerts | | ||
| :------: | :----------: | :-------------------------------: | :---: | :--------------: | :---------------: | :------------: | | ||
| observer | read, write | read | read | read, write | read | read, write | |
11 changes: 11 additions & 0 deletions
11
x-pack/plugins/rule_registry/server/scripts/observer/delete_detections_user.sh
This file contains 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,11 @@ | ||
|
||
# | ||
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
# or more contributor license agreements. Licensed under the Elastic License | ||
# 2.0; you may not use this file except in compliance with the Elastic License | ||
# 2.0. | ||
# | ||
|
||
curl -v -H 'Content-Type: application/json' -H 'kbn-xsrf: 123'\ | ||
-u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ | ||
-XDELETE ${ELASTICSEARCH_URL}/_security/user/observer |
38 changes: 38 additions & 0 deletions
38
x-pack/plugins/rule_registry/server/scripts/observer/detections_role.json
This file contains 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,38 @@ | ||
{ | ||
"elasticsearch": { | ||
"cluster": [], | ||
"indices": [ | ||
{ | ||
"names": [ | ||
"apm-*-transaction*", | ||
"auditbeat-*", | ||
"endgame-*", | ||
"filebeat-*", | ||
"logs-*", | ||
"packetbeat-*", | ||
"winlogbeat-*" | ||
], | ||
"privileges": ["read", "write"] | ||
}, | ||
{ | ||
"names": [".siem-signals-*"], | ||
"privileges": ["read", "write"] | ||
}, | ||
{ | ||
"names": [".lists*", ".items*"], | ||
"privileges": ["read", "write"] | ||
} | ||
] | ||
}, | ||
"kibana": [ | ||
{ | ||
"feature": { | ||
"ml": ["read"], | ||
"monitoring": ["all"], | ||
"actions": ["read"], | ||
"builtInAlerts": ["all"] | ||
}, | ||
"spaces": ["*"] | ||
} | ||
] | ||
} |
6 changes: 6 additions & 0 deletions
6
x-pack/plugins/rule_registry/server/scripts/observer/detections_user.json
This file contains 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,6 @@ | ||
{ | ||
"password": "changeme", | ||
"roles": ["observer"], | ||
"full_name": "Observer", | ||
"email": "monitoring-observer@example.com" | ||
} |
11 changes: 11 additions & 0 deletions
11
x-pack/plugins/rule_registry/server/scripts/observer/get_detections_role.sh
This file contains 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,11 @@ | ||
|
||
# | ||
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
# or more contributor license agreements. Licensed under the Elastic License | ||
# 2.0; you may not use this file except in compliance with the Elastic License | ||
# 2.0. | ||
# | ||
|
||
curl -H 'Content-Type: application/json' -H 'kbn-xsrf: 123'\ | ||
-u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ | ||
-XGET ${KIBANA_URL}/api/security/role/hunter | jq -S . |
10 changes: 10 additions & 0 deletions
10
x-pack/plugins/rule_registry/server/scripts/observer/index.ts
This file contains 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,10 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import * as observerUser from './detections_user.json'; | ||
import * as observerRole from './detections_role.json'; | ||
export { observerUser, observerRole }; |
Oops, something went wrong.