mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-08 02:02:50 +01:00
Merge pull request #10459 from Security-Onion-Solutions/2.4/fixes
Change Fleet Host URL API Endpoint
This commit is contained in:
@@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
. /usr/sbin/so-common
|
. /usr/sbin/so-common
|
||||||
|
|
||||||
#FLEETHOST="https://{{ GLOBALS.manager_ip }}:8220"
|
|
||||||
|
|
||||||
for i in {1..30}
|
for i in {1..30}
|
||||||
do
|
do
|
||||||
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')
|
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')
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ fi
|
|||||||
curl -K /opt/so/conf/elasticsearch/curl.config -L -X POST "localhost:5601/api/fleet/fleet_server_hosts" -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/fleet_server_hosts" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d "$JSON_STRING"
|
||||||
printf "\n\n"
|
printf "\n\n"
|
||||||
|
|
||||||
|
|
||||||
### Create Policies & Associated Integration Configuration ###
|
### Create Policies & Associated Integration Configuration ###
|
||||||
|
|
||||||
# Manager Fleet Server Host
|
# Manager Fleet Server Host
|
||||||
@@ -72,7 +71,7 @@ so-elastic-fleet-integration-policy-load
|
|||||||
# Set Elastic Agent Artifact Registry URL
|
# Set Elastic Agent Artifact Registry URL
|
||||||
JSON_STRING=$( jq -n \
|
JSON_STRING=$( jq -n \
|
||||||
--arg NAME "FleetServer_{{ GLOBALS.hostname }}" \
|
--arg NAME "FleetServer_{{ GLOBALS.hostname }}" \
|
||||||
--arg URL "http://{{ GLOBALS.url_base }}/artifacts/" \
|
--arg URL "http://{{ GLOBALS.url_base }}:8443/artifacts/" \
|
||||||
'{"name":$NAME,"host":$URL,"is_default":true}'
|
'{"name":$NAME,"host":$URL,"is_default":true}'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -385,10 +385,10 @@ function create_fleet_policy() {
|
|||||||
|
|
||||||
function update_fleet_host_urls() {
|
function update_fleet_host_urls() {
|
||||||
# Query for current Fleet Host URLs & append New Fleet Node Hostname & IP
|
# Query for current Fleet Host URLs & append New Fleet Node Hostname & IP
|
||||||
JSON_STRING=$(curl -K /opt/so/conf/elasticsearch/curl.config 'http://localhost:5601/api/fleet/fleet_server_hosts' | jq --arg HOSTNAME "https://$LSHOSTNAME:8220" --arg IP "https://$MAINIP:8220" -r '.items[].host_urls += [ $HOSTNAME, $IP ] | {"name":"Default","host_urls": .items[].host_urls,"is_default":true,"proxy_id":null}')
|
JSON_STRING=$(curl -K /opt/so/conf/elasticsearch/curl.config 'http://localhost:5601/api/fleet/fleet_server_hosts/grid-default' | jq --arg HOSTNAME "https://$LSHOSTNAME:8220" --arg IP "https://$MAINIP:8220" '.item.host_urls += [ $HOSTNAME, $IP ] | {"name":"grid-default","is_default":true,"host_urls": .item.host_urls}')
|
||||||
|
|
||||||
# Update Fleet Host URLs
|
# Update Fleet Host URLs
|
||||||
curl -K /opt/so/conf/elasticsearch/curl.config -L -X PUT "localhost:5601/api/fleet/fleet_server_hosts/fleet-default-fleet-server-host" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d "$JSON_STRING"
|
curl -K /opt/so/conf/elasticsearch/curl.config -L -X PUT "localhost:5601/api/fleet/fleet_server_hosts/grid-default" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d "$JSON_STRING"
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_logstash_outputs() {
|
function update_logstash_outputs() {
|
||||||
|
|||||||
Reference in New Issue
Block a user