Create symlink before registration otherwise registration script can't save it's state (.log) file into the conf subdir; add more logging output to track down registration failures

This commit is contained in:
Jason Ertel
2020-11-23 18:36:19 -05:00
parent bafefb980b
commit 1e32a01657
2 changed files with 6 additions and 5 deletions

View File

@@ -55,8 +55,9 @@ register_agent() {
# Adding agent and getting Id from manager
echo ""
echo "Adding agent:"
echo "curl -s -u $USER:**** -k -X POST -d 'name=$AGENT_NAME&ip=$AGENT_IP' $PROTOCOL://$API_IP:$API_PORT/agents"
echo "Executing: curl -s -u $USER:**** -k -X POST -d 'name=$AGENT_NAME&ip=$AGENT_IP' $PROTOCOL://$API_IP:$API_PORT/agents"
API_RESULT=$(curl -s -u $USER:"$PASSWORD" -k -X POST -d 'name='$AGENT_NAME'&ip='$AGENT_IP -L $PROTOCOL://$API_IP:$API_PORT/agents)
echo "Result: $API_RESULT"
echo -e $API_RESULT | grep -q "\"error\":0" 2>&1
if [ "$?" != "0" ]; then

View File

@@ -128,15 +128,15 @@ whitelistmanager:
- name: /usr/sbin/wazuh-manager-whitelist
- cwd: /
/opt/so/conf/wazuh:
file.symlink:
- target: /nsm/wazuh/etc
wazuhagentservice:
service.running:
- name: wazuh-agent
- enable: True
/opt/so/conf/wazuh:
file.symlink:
- target: /nsm/wazuh/etc
hidsruledir:
file.directory:
- name: /opt/so/rules/hids