Merge pull request #13791 from Security-Onion-Solutions/fix/fleet_custom

Use ID instead of name for getting integrations from agent policies
This commit is contained in:
weslambert
2024-10-09 14:12:40 -04:00
committed by GitHub
2 changed files with 9 additions and 1 deletions

View File

@@ -102,6 +102,14 @@ elastic_fleet_package_is_installed() {
curl -s -K /opt/so/conf/elasticsearch/curl.config -b "sid=$SESSIONCOOKIE" -L -X GET -H 'kbn-xsrf: true' "localhost:5601/api/fleet/epm/packages/$PACKAGE" | jq -r '.item.status'
}
elastic_fleet_agent_policy_ids() {
curl -s -K /opt/so/conf/elasticsearch/curl.config -b "sid=$SESSIONCOOKIE" -L -X GET "localhost:5601/api/fleet/agent_policies" | jq -r .items[].id
if [ $? -ne 0 ]; then
echo "Error: Failed to retrieve agent policies."
exit 1
fi
}
elastic_fleet_agent_policy_names() {
curl -s -K /opt/so/conf/elasticsearch/curl.config -b "sid=$SESSIONCOOKIE" -L -X GET "localhost:5601/api/fleet/agent_policies" | jq -r .items[].name
if [ $? -ne 0 ]; then

View File

@@ -13,7 +13,7 @@ if [ $? -ne 0 ]; then
fi
IFS=$'\n'
agent_policies=$(elastic_fleet_agent_policy_names)
agent_policies=$(elastic_fleet_agent_policy_ids)
if [ $? -ne 0 ]; then
echo "Error: Failed to retrieve agent policies."
exit 1