mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +01:00
49 lines
2.0 KiB
Bash
49 lines
2.0 KiB
Bash
#!/bin/bash
|
|
{% set MAIN_HOSTNAME = salt['grains.get']('host') %}
|
|
{% set MAIN_IP = salt['pillar.get']('node:mainip') %}
|
|
|
|
#so-fleet-setup.sh $FleetEmail
|
|
|
|
# Enable Fleet
|
|
echo "Starting Docker Containers..."
|
|
salt-call state.apply mysql queue=True >> /root/fleet-setup.log
|
|
salt-call state.apply fleet queue=True >> /root/fleet-setup.log
|
|
salt-call state.apply redis queue=True >> /root/fleet-setup.log
|
|
|
|
if [ ! "$(docker ps -q -f name=so-fleet)" ]; then
|
|
echo "so-fleet container not running... Exiting..."
|
|
exit 1
|
|
fi
|
|
|
|
initpw=$(date +%s | sha256sum | base64 | head -c 16 ; echo)
|
|
|
|
docker exec so-fleet /bin/ash -c "echo {{ MAIN_IP }} {{ MAIN_HOSTNAME }} >> /etc/hosts"
|
|
docker exec so-fleet fleetctl config set --address https://{{ MAIN_HOSTNAME }}:443 --tls-skip-verify --url-prefix /fleet
|
|
docker exec so-fleet fleetctl setup --email $1 --password $initpw
|
|
|
|
docker exec so-fleet fleetctl apply -f /packs/palantir/Fleet/Endpoints/MacOS/osquery.yaml
|
|
docker exec so-fleet fleetctl apply -f /packs/palantir/Fleet/Endpoints/Windows/osquery.yaml
|
|
docker exec so-fleet fleetctl apply -f /packs/hh/hhdefault.yml
|
|
docker exec so-fleet /bin/sh -c 'for pack in /packs/palantir/Fleet/Endpoints/packs/*.yaml; do fleetctl apply -f "$pack"; done'
|
|
docker exec so-fleet fleetctl apply -f /packs/hh/osquery.conf
|
|
|
|
|
|
# Enable Fleet
|
|
echo "Enabling Fleet..."
|
|
salt-call state.apply fleet.event_enable-fleet queue=True >> /root/fleet-setup.log
|
|
salt-call state.apply common queue=True >> /root/fleet-setup.log
|
|
|
|
# Generate osquery install packages
|
|
echo "Generating osquery install packages - this will take some time..."
|
|
salt-call state.apply fleet.event_gen-packages queue=True >> /root/fleet-setup.log
|
|
sleep 120
|
|
|
|
echo "Installing launcher via salt..."
|
|
salt-call state.apply fleet.install_package queue=True >> /root/fleet-setup.log
|
|
salt-call state.apply filebeat queue=True >> /root/fleet-setup.log
|
|
docker stop so-nginx
|
|
salt-call state.apply common queue=True >> /root/fleet-setup.log
|
|
|
|
echo "Fleet Setup Complete - Login here: https://{{ MAIN_HOSTNAME }}"
|
|
echo "Your username is $2 and your password is $initpw"
|