mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
Compare commits
12 Commits
2.3.50
...
2.3.50GRID
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96c20ea3cf | ||
|
|
10c4a7fd98 | ||
|
|
ffa9001df4 | ||
|
|
e113e75f4d | ||
|
|
9066959945 | ||
|
|
6768e8ddf6 | ||
|
|
a489b369d7 | ||
|
|
074fe46e90 | ||
|
|
f56244d708 | ||
|
|
cedcf05751 | ||
|
|
f04ed94627 | ||
|
|
296c1c5a3c |
64
salt/common/tools/sbin/so-airgap-hotfixapply
Normal file
64
salt/common/tools/sbin/so-airgap-hotfixapply
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright 2014,2015,2016,2017,2018,2019,2020,2021 Security Onion Solutions, LLC
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
. /usr/sbin/so-common
|
||||||
|
|
||||||
|
UPDATE_DIR=/tmp/sohotfixapply
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "No tarball given. Please provide the filename so I can run the hotfix"
|
||||||
|
echo "so-airgap-hotfixapply /path/to/sohotfix.tar"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
if [ ! -f "$1" ]; then
|
||||||
|
echo "Unable to find $1. Make sure your path is correct and retry."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Determining if we need to apply this hotfix"
|
||||||
|
rm -rf $UPDATE_DIR
|
||||||
|
mkdir -p $UPDATE_DIR
|
||||||
|
tar xvf $1 -C $UPDATE_DIR
|
||||||
|
|
||||||
|
# Compare some versions
|
||||||
|
NEWVERSION=$(cat $UPDATE_DIR/VERSION)
|
||||||
|
HOTFIXVERSION=$(cat $UPDATE_DIR/HOTFIX)
|
||||||
|
CURRENTHOTFIX=$(cat /etc/sohotfix)
|
||||||
|
INSTALLEDVERSION=$(cat /etc/soversion)
|
||||||
|
|
||||||
|
if [ "$INSTALLEDVERSION" == "$NEWVERSION" ]; then
|
||||||
|
echo "Checking to see if there are hotfixes needed"
|
||||||
|
if [ "$HOTFIXVERSION" == "$CURRENTHOTFIX" ]; then
|
||||||
|
echo "You are already running the latest version of Security Onion."
|
||||||
|
rm -rf $UPDATE_DIR
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "We need to apply a hotfix"
|
||||||
|
copy_new_files
|
||||||
|
echo $HOTFIXVERSION > /etc/sohotfix
|
||||||
|
salt-call state.highstate -l info queue=True
|
||||||
|
echo "The Hotfix $HOTFIXVERSION has been applied"
|
||||||
|
# Clean up
|
||||||
|
rm -rf $UPDATE_DIR
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "This hotfix is not compatible with your current version. Download the latest ISO and run soup"
|
||||||
|
rm -rf $UPDATE_DIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
fi
|
||||||
33
salt/common/tools/sbin/so-airgap-hotfixdownload
Normal file
33
salt/common/tools/sbin/so-airgap-hotfixdownload
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright 2014,2015,2016,2017,2018,2019,2020,2021 Security Onion Solutions, LLC
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# Get the latest code
|
||||||
|
rm -rf /tmp/sohotfix
|
||||||
|
mkdir -p /tmp/sohotfix
|
||||||
|
cd /tmp/sohotfix
|
||||||
|
git clone https://github.com/Security-Onion-Solutions/securityonion
|
||||||
|
if [ ! -d "/tmp/sohotfix/securityonion" ]; then
|
||||||
|
echo "I was unable to get the latest code. Check your internet and try again."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Looks like we have the code lets create the tarball."
|
||||||
|
cd /tmp/sohotfix/securityonion
|
||||||
|
tar cvf /tmp/sohotfix/sohotfix.tar HOTFIX VERSION salt pillar
|
||||||
|
echo ""
|
||||||
|
echo "Copy /tmp/sohotfix/sohotfix.tar to portable media and then copy it to your airgap manager."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
@@ -15,6 +15,8 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
DEFAULT_SALT_DIR=/opt/so/saltstack/default
|
||||||
|
|
||||||
# Check for prerequisites
|
# Check for prerequisites
|
||||||
if [ "$(id -u)" -ne 0 ]; then
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
echo "This script must be run using sudo!"
|
echo "This script must be run using sudo!"
|
||||||
@@ -122,6 +124,16 @@ check_elastic_license() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copy_new_files() {
|
||||||
|
# Copy new files over to the salt dir
|
||||||
|
cd $UPDATE_DIR
|
||||||
|
rsync -a salt $DEFAULT_SALT_DIR/
|
||||||
|
rsync -a pillar $DEFAULT_SALT_DIR/
|
||||||
|
chown -R socore:socore $DEFAULT_SALT_DIR/
|
||||||
|
chmod 755 $DEFAULT_SALT_DIR/pillar/firewall/addfirewall.sh
|
||||||
|
cd /tmp
|
||||||
|
}
|
||||||
|
|
||||||
disable_fastestmirror() {
|
disable_fastestmirror() {
|
||||||
sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
|
sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ UPDATE_DIR=/tmp/sogh/securityonion
|
|||||||
INSTALLEDVERSION=$(cat /etc/soversion)
|
INSTALLEDVERSION=$(cat /etc/soversion)
|
||||||
POSTVERSION=$INSTALLEDVERSION
|
POSTVERSION=$INSTALLEDVERSION
|
||||||
INSTALLEDSALTVERSION=$(salt --versions-report | grep Salt: | awk {'print $2'})
|
INSTALLEDSALTVERSION=$(salt --versions-report | grep Salt: | awk {'print $2'})
|
||||||
DEFAULT_SALT_DIR=/opt/so/saltstack/default
|
|
||||||
BATCHSIZE=5
|
BATCHSIZE=5
|
||||||
SOUP_LOG=/root/soup.log
|
SOUP_LOG=/root/soup.log
|
||||||
WHATWOULDYOUSAYYAHDOHERE=soup
|
WHATWOULDYOUSAYYAHDOHERE=soup
|
||||||
@@ -214,16 +213,6 @@ clone_to_tmp() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_new_files() {
|
|
||||||
# Copy new files over to the salt dir
|
|
||||||
cd $UPDATE_DIR
|
|
||||||
rsync -a salt $DEFAULT_SALT_DIR/
|
|
||||||
rsync -a pillar $DEFAULT_SALT_DIR/
|
|
||||||
chown -R socore:socore $DEFAULT_SALT_DIR/
|
|
||||||
chmod 755 $DEFAULT_SALT_DIR/pillar/firewall/addfirewall.sh
|
|
||||||
cd /tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
generate_and_clean_tarballs() {
|
generate_and_clean_tarballs() {
|
||||||
local new_version
|
local new_version
|
||||||
new_version=$(cat $UPDATE_DIR/VERSION)
|
new_version=$(cat $UPDATE_DIR/VERSION)
|
||||||
@@ -572,16 +561,28 @@ update_version() {
|
|||||||
# Update the version to the latest
|
# Update the version to the latest
|
||||||
echo "Updating the Security Onion version file."
|
echo "Updating the Security Onion version file."
|
||||||
echo $NEWVERSION > /etc/soversion
|
echo $NEWVERSION > /etc/soversion
|
||||||
|
echo $HOTFIXVERSION > /etc/sohotfix
|
||||||
sed -i "/ soversion:/c\ soversion: $NEWVERSION" /opt/so/saltstack/local/pillar/global.sls
|
sed -i "/ soversion:/c\ soversion: $NEWVERSION" /opt/so/saltstack/local/pillar/global.sls
|
||||||
}
|
}
|
||||||
|
|
||||||
upgrade_check() {
|
upgrade_check() {
|
||||||
# Let's make sure we actually need to update.
|
# Let's make sure we actually need to update.
|
||||||
NEWVERSION=$(cat $UPDATE_DIR/VERSION)
|
NEWVERSION=$(cat $UPDATE_DIR/VERSION)
|
||||||
|
HOTFIXVERSION=$(cat $UPDATE_DIR/HOTFIX)
|
||||||
|
CURRENTHOTFIX=$(cat /etc/sohotfix 2>/dev/null)
|
||||||
if [ "$INSTALLEDVERSION" == "$NEWVERSION" ]; then
|
if [ "$INSTALLEDVERSION" == "$NEWVERSION" ]; then
|
||||||
|
echo "Checking to see if there are hotfixes needed"
|
||||||
|
if [ "$HOTFIXVERSION" == "$CURRENTHOTFIX" ]; then
|
||||||
echo "You are already running the latest version of Security Onion."
|
echo "You are already running the latest version of Security Onion."
|
||||||
exit 0
|
exit 0
|
||||||
|
else
|
||||||
|
echo "We need to apply a hotfix"
|
||||||
|
is_hotfix=true
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
is_hotfix=false
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
upgrade_check_salt() {
|
upgrade_check_salt() {
|
||||||
@@ -709,9 +710,19 @@ upgrade_space
|
|||||||
echo "Checking for Salt Master and Minion updates."
|
echo "Checking for Salt Master and Minion updates."
|
||||||
upgrade_check_salt
|
upgrade_check_salt
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$is_hotfix" == "true" ]; then
|
||||||
|
echo "Applying $HOTFIXVERSION"
|
||||||
|
copy_new_files
|
||||||
|
echo ""
|
||||||
|
update_version
|
||||||
|
salt-call state.highstate -l info queue=True
|
||||||
|
|
||||||
|
else
|
||||||
echo ""
|
echo ""
|
||||||
echo "Performing upgrade from Security Onion $INSTALLEDVERSION to Security Onion $NEWVERSION."
|
echo "Performing upgrade from Security Onion $INSTALLEDVERSION to Security Onion $NEWVERSION."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo "Updating dockers to $NEWVERSION."
|
echo "Updating dockers to $NEWVERSION."
|
||||||
if [ $is_airgap -eq 0 ]; then
|
if [ $is_airgap -eq 0 ]; then
|
||||||
airgap_update_dockers
|
airgap_update_dockers
|
||||||
@@ -848,6 +859,8 @@ if [ $NUM_MINIONS -gt 1 ]; then
|
|||||||
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
This appears to be a distributed deployment. Other nodes should update themselves at the next Salt highstate (typically within 15 minutes). Do not manually restart anything until you know that all the search/heavy nodes in your deployment are updated. This is especially important if you are using true clustering for Elasticsearch.
|
This appears to be a distributed deployment. Other nodes should update themselves at the next Salt highstate (typically within 15 minutes). Do not manually restart anything until you know that all the search/heavy nodes in your deployment are updated. This is especially important if you are using true clustering for Elasticsearch.
|
||||||
|
|
||||||
Each minion is on a random 15 minute check-in period and things like network bandwidth can be a factor in how long the actual upgrade takes. If you have a heavy node on a slow link, it is going to take a while to get the containers to it. Depending on what changes happened between the versions, Elasticsearch might not be able to talk to said heavy node until the update is complete.
|
Each minion is on a random 15 minute check-in period and things like network bandwidth can be a factor in how long the actual upgrade takes. If you have a heavy node on a slow link, it is going to take a while to get the containers to it. Depending on what changes happened between the versions, Elasticsearch might not be able to talk to said heavy node until the update is complete.
|
||||||
@@ -855,9 +868,12 @@ Each minion is on a random 15 minute check-in period and things like network ban
|
|||||||
If it looks like you’re missing data after the upgrade, please avoid restarting services and instead make sure at least one search node has completed its upgrade. The best way to do this is to run 'sudo salt-call state.highstate' from a search node and make sure there are no errors. Typically if it works on one node it will work on the rest. Forward nodes are less complex and will update as they check in so you can monitor those from the Grid section of SOC.
|
If it looks like you’re missing data after the upgrade, please avoid restarting services and instead make sure at least one search node has completed its upgrade. The best way to do this is to run 'sudo salt-call state.highstate' from a search node and make sure there are no errors. Typically if it works on one node it will work on the rest. Forward nodes are less complex and will update as they check in so you can monitor those from the Grid section of SOC.
|
||||||
|
|
||||||
For more information, please see https://docs.securityonion.net/en/2.3/soup.html#distributed-deployments.
|
For more information, please see https://docs.securityonion.net/en/2.3/soup.html#distributed-deployments.
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo "### soup has been served at `date` ###"
|
echo "### soup has been served at `date` ###"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
"logFilename": "/opt/sensoroni/logs/sensoroni.log",
|
"logFilename": "/opt/sensoroni/logs/sensoroni.log",
|
||||||
"logLevel":"info",
|
"logLevel":"info",
|
||||||
"agent": {
|
"agent": {
|
||||||
|
"nodeId": "{{ grains.host | lower }}",
|
||||||
"role": "{{ grains.role }}",
|
"role": "{{ grains.role }}",
|
||||||
"description": "{{ DESCRIPTION }}",
|
"description": "{{ DESCRIPTION }}",
|
||||||
"address": "{{ ADDRESS }}",
|
"address": "{{ ADDRESS }}",
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
THEGREP=$(ps -ef | grep $0 | grep -v $$ | grep -v grep)
|
THEGREP=$(ps -ef | grep $0 | grep -v $$ | grep -v grep)
|
||||||
|
RAIDLOG=/var/log/raid/status.log
|
||||||
|
RAIDSTATUS=$(cat /var/log/raid/status.log)
|
||||||
|
|
||||||
if [ ! "$THEGREP" ]; then
|
if [ ! "$THEGREP" ]; then
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user