mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +01:00
add test support to so-minion
This commit is contained in:
@@ -23,6 +23,7 @@ if [[ $# -lt 1 ]]; then
|
|||||||
echo " accept: Accepts a new key and adds the minion files"
|
echo " accept: Accepts a new key and adds the minion files"
|
||||||
echo " delete: Removes the key and deletes the minion files"
|
echo " delete: Removes the key and deletes the minion files"
|
||||||
echo " reject: Rejects a key"
|
echo " reject: Rejects a key"
|
||||||
|
echo " test: Ingest test data"
|
||||||
echo ""
|
echo ""
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -75,6 +76,22 @@ function getinstallinfo() {
|
|||||||
source <(echo $INSTALLVARS)
|
source <(echo $INSTALLVARS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testminion() {
|
||||||
|
# Always run on the host, since this is going to be the manager of a distributed grid, or an eval/standalone.
|
||||||
|
# Distributed managers must run this in order for the sensor nodes to have access to the so-tcpreplay image.
|
||||||
|
so-test
|
||||||
|
result=$?
|
||||||
|
|
||||||
|
# If this so-minion script is not running on the given minion ID, run so-test remotely on the sensor as well
|
||||||
|
local_id=$(lookup_grain id)
|
||||||
|
if [[ ! "$local_id" =~ "${MINION_ID}_" ]]; then
|
||||||
|
salt "$MINION_ID" cmd.run 'so-test'
|
||||||
|
result=$?
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit $result
|
||||||
|
}
|
||||||
|
|
||||||
function listminions() {
|
function listminions() {
|
||||||
salt-key list -F --out=json
|
salt-key list -F --out=json
|
||||||
exit $?
|
exit $?
|
||||||
@@ -277,3 +294,7 @@ if [[ "$OPERATION" = 'add' || "$OPERATION" = 'setup' ]]; then
|
|||||||
create$NODETYPE
|
create$NODETYPE
|
||||||
echo "Minion file created for $MINION_ID"
|
echo "Minion file created for $MINION_ID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$OPERATION" = 'test' ]]; then
|
||||||
|
testminion
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user