mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
Add check for integration existence and integration update functionality
This commit is contained in:
@@ -167,6 +167,27 @@ elastic_fleet_integration_create() {
|
|||||||
curl -K /opt/so/conf/elasticsearch/curl.config -L -X POST "localhost:5601/api/fleet/package_policies" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d "$JSON_STRING"
|
curl -K /opt/so/conf/elasticsearch/curl.config -L -X POST "localhost:5601/api/fleet/package_policies" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d "$JSON_STRING"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elastic_fleet_integration_check() {
|
||||||
|
|
||||||
|
AGENT_POLICY=$1
|
||||||
|
|
||||||
|
JSON_STRING=$2
|
||||||
|
|
||||||
|
NAME=$(jq -r .name $JSON_STRING)
|
||||||
|
|
||||||
|
INTEGRATION_ID=$(/usr/sbin/so-elastic-fleet-agent-policy-view "$AGENT_POLICY" | jq -r '.item.package_policies[] | select(.name=="'"$NAME"'") | .id')
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
elastic_fleet_integration_update() {
|
||||||
|
|
||||||
|
UPDATE_ID=$1
|
||||||
|
|
||||||
|
JSON_STRING=$2
|
||||||
|
|
||||||
|
curl -K /opt/so/conf/elasticsearch/curl.config -L -X PUT "localhost:5601/api/fleet/package_policies/$UPDATE_ID" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d "$JSON_STRING"
|
||||||
|
}
|
||||||
|
|
||||||
elastic_fleet_policy_create() {
|
elastic_fleet_policy_create() {
|
||||||
|
|
||||||
NAME=$1
|
NAME=$1
|
||||||
|
|||||||
Reference in New Issue
Block a user