mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
if /opt/so/conf/wazuh/initial_agent_registration.log doesnt exist, and agent is already registered, touch file and exit 0 to prevent salt error
This commit is contained in:
@@ -60,8 +60,14 @@ register_agent() {
|
|||||||
GOT_KEY=$?
|
GOT_KEY=$?
|
||||||
|
|
||||||
if [[ -z "$AGENT_ID" || -z "$AGENT_KEY" || $GOT_ID -ne 0 || $GOT_KEY -ne 0 ]]; then
|
if [[ -z "$AGENT_ID" || -z "$AGENT_KEY" || $GOT_ID -ne 0 || $GOT_KEY -ne 0 ]]; then
|
||||||
|
if echo $API_RESULT | jq -er .message | grep -q "There is an agent with the same name"; then
|
||||||
|
echo "Agent $AGENT_NAME already registered!"
|
||||||
|
touch /opt/so/conf/wazuh/initial_agent_registration.log
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
echo "Failed Result: $API_RESULT"
|
echo "Failed Result: $API_RESULT"
|
||||||
return 1
|
return 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Agent '$AGENT_NAME' with ID '$AGENT_ID' added."
|
echo "Agent '$AGENT_NAME' with ID '$AGENT_ID' added."
|
||||||
echo "Key for agent '$AGENT_ID' received."
|
echo "Key for agent '$AGENT_ID' received."
|
||||||
|
|||||||
Reference in New Issue
Block a user