mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 01:02:46 +01:00
Change Elastic Fleet Tarball naming
This commit is contained in:
@@ -12,11 +12,18 @@
|
||||
|
||||
for i in {1..30}
|
||||
do
|
||||
ELASTICVERSION=$(so-elasticsearch-query / | jq -r .version.number)
|
||||
ENROLLMENTOKEN=$(curl -K /opt/so/conf/elasticsearch/curl.config -L "localhost:5601/api/fleet/enrollment_api_keys" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' | jq .list | jq -r -c '.[] | select(.policy_id | contains("endpoints-initial")) | .api_key')
|
||||
FLEETHOST=$(curl -K /opt/so/conf/elasticsearch/curl.config 'http://localhost:5601/api/fleet/fleet_server_hosts/grid-default' | jq -r '.item.host_urls[]' | paste -sd ',')
|
||||
if [[ $FLEETHOST ]] && [[ $ENROLLMENTOKEN ]]; then break; else sleep 10; fi
|
||||
if [[ $FLEETHOST ]] && [[ $ENROLLMENTOKEN ]] && [[ $ELASTICVERSION ]]; then break; else sleep 10; fi
|
||||
done
|
||||
if [[ -z $FLEETHOST ]] || [[ -z $ENROLLMENTOKEN ]]; then printf "\nFleet Host URL or Enrollment Token empty - exiting..." && exit; fi
|
||||
|
||||
if [[ -z $FLEETHOST ]] || [[ -z $ENROLLMENTOKEN ]] || [[ -z $ELASTICVERSION ]]
|
||||
then
|
||||
printf "\nFleet Host URL, Enrollment Token or Elastic Version empty - exiting..."
|
||||
printf "\nFleet Host: $FLEETHOST, Elastic Version: $ELASTICVERSION, Enrollment Token: $ENROLLMENTOKEN\n"
|
||||
exit
|
||||
fi
|
||||
|
||||
OSARCH=( "linux-x86_64" "windows-x86_64" "darwin-x86_64" "darwin-aarch64" )
|
||||
|
||||
@@ -25,7 +32,7 @@ rm -rf /nsm/elastic-agent-workspace
|
||||
mkdir -p /nsm/elastic-agent-workspace
|
||||
|
||||
printf "\n### Extracting outer tarball and then each individual tarball/zip\n"
|
||||
tar -xf /nsm/elastic-fleet/artifacts/elastic-agent_SO-{{ GLOBALS.so_version }}.tar.gz -C /nsm/elastic-agent-workspace/
|
||||
tar -xf /nsm/elastic-fleet/artifacts/elastic-agent_SO-$ELASTICVERSION.tar.gz -C /nsm/elastic-agent-workspace/
|
||||
unzip -q /nsm/elastic-agent-workspace/elastic-agent-*.zip -d /nsm/elastic-agent-workspace/
|
||||
for archive in /nsm/elastic-agent-workspace/*.tar.gz
|
||||
do
|
||||
|
||||
@@ -976,14 +976,14 @@ detect_os() {
|
||||
download_elastic_agent_artifacts() {
|
||||
|
||||
if [[ $is_iso ]]; then
|
||||
logCmd "tar -xf /nsm/elastic-fleet/artifacts/beats/elastic-agent_SO-$SOVERSION.tar.gz -C /nsm/elastic-fleet/artifacts/beats/elastic-agent/"
|
||||
logCmd "tar -xf /nsm/elastic-fleet/artifacts/beats/elastic-agent_SO-$elastic_agent_tarball_version.tar.gz -C /nsm/elastic-fleet/artifacts/beats/elastic-agent/"
|
||||
else
|
||||
logCmd "mkdir -p /nsm/elastic-fleet/artifacts/beats/elastic-agent/"
|
||||
retry 15 10 "curl --fail --retry 5 --retry-delay 15 -L https://repo.securityonion.net/file/so-repo/prod/2.4/elasticagent/elastic-agent_SO-$SOVERSION.tar.gz --output /nsm/elastic-fleet/artifacts/elastic-agent_SO-$SOVERSION.tar.gz" "" ""
|
||||
retry 15 10 "curl --fail --retry 5 --retry-delay 15 -L https://repo.securityonion.net/file/so-repo/prod/2.4/elasticagent/elastic-agent_SO-$SOVERSION.md5 --output /nsm/elastic-fleet/artifacts/elastic-agent_SO-$SOVERSION.md5" "" ""
|
||||
retry 15 10 "curl --fail --retry 5 --retry-delay 15 -L https://repo.securityonion.net/file/so-repo/prod/2.4/elasticagent/elastic-agent_SO-$elastic_agent_tarball_version.tar.gz --output /nsm/elastic-fleet/artifacts/elastic-agent_SO-$SOVERSION.tar.gz" "" ""
|
||||
retry 15 10 "curl --fail --retry 5 --retry-delay 15 -L https://repo.securityonion.net/file/so-repo/prod/2.4/elasticagent/elastic-agent_SO-$elastic_agent_tarball_version.md5 --output /nsm/elastic-fleet/artifacts/elastic-agent_SO-$SOVERSION.md5" "" ""
|
||||
|
||||
SOURCEHASH=$(md5sum /nsm/elastic-fleet/artifacts/elastic-agent_SO-$SOVERSION.tar.gz | awk '{ print $1 }')
|
||||
HASH=$(cat /nsm/elastic-fleet/artifacts/elastic-agent_SO-$SOVERSION.md5)
|
||||
SOURCEHASH=$(md5sum /nsm/elastic-fleet/artifacts/elastic-agent_SO-$elastic_agent_tarball_version.tar.gz | awk '{ print $1 }')
|
||||
HASH=$(cat /nsm/elastic-fleet/artifacts/elastic-agent_SO-$elastic_agent_tarball_version.md5)
|
||||
|
||||
if [[ "$HASH" == "$SOURCEHASH" ]]; then
|
||||
info "Elastic Agent source hash is good."
|
||||
@@ -992,7 +992,7 @@ download_elastic_agent_artifacts() {
|
||||
fail_setup
|
||||
fi
|
||||
|
||||
logCmd "tar -xf /nsm/elastic-fleet/artifacts/elastic-agent_SO-$SOVERSION.tar.gz -C /nsm/elastic-fleet/artifacts/beats/elastic-agent/"
|
||||
logCmd "tar -xf /nsm/elastic-fleet/artifacts/elastic-agent_SO-$elastic_agent_tarball_version.tar.gz -C /nsm/elastic-fleet/artifacts/beats/elastic-agent/"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -219,3 +219,6 @@ export patch_pillar_file
|
||||
|
||||
adv_patch_pillar_file="$local_salt_dir/pillar/patch/adv_patch.sls"
|
||||
export adv_patch_pillar_file
|
||||
|
||||
elastic_agent_tarball_version="8.7.1"
|
||||
export elastic_agent_tarball_version
|
||||
Reference in New Issue
Block a user