Skip to content

Disable hostname resolution in agent start up#3405

Merged
vikman90 merged 8 commits into3.9from
2770-hostname-reload
Jun 3, 2019
Merged

Disable hostname resolution in agent start up#3405
vikman90 merged 8 commits into3.9from
2770-hostname-reload

Conversation

@albertomn86
Copy link
Contributor

@albertomn86 albertomn86 commented May 27, 2019

Related issue
#2770

Description

This PR removes the hostname resolution during the configuration reading in the agent start up.
If the DNS is not reachable when the agent is starting, the config validation aborts the starting.
Removing this validation, the agent is now able to resolve the hostname once it has started.

This PR also improves some messages related with the agent connection.

Tests

  • Compilation without warnings in every supported platform
    • Linux
    • Windows
    • MAC OS X
    • Solaris 10
  • Source installation
  • Source upgrade
  • Memory tests
    • Valgrind report for affected components
    • CPU impact
    • RAM usage impact
  • Retrocompatibility with older Wazuh versions
  • Working on cluster enviroments

@albertomn86 albertomn86 requested a review from vikman90 May 27, 2019 14:32
@albertomn86 albertomn86 changed the title Disable hostname resolution in agent agent start up Disable hostname resolution in agent start up May 27, 2019
@albertomn86 albertomn86 force-pushed the 2770-hostname-reload branch from da30eb1 to 35e5a73 Compare May 28, 2019 08:05
@albertomn86
Copy link
Contributor Author

Valgrind report

==75936== Memcheck, a memory error detector
==75936== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==75936== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==75936== Command: /var/ossec/bin/ossec-agentd -f
==75936==
==75936== HEAP SUMMARY:
==75936==     in use at exit: 93,055 bytes in 49 blocks
==75936==   total heap usage: 6,544 allocs, 6,495 frees, 4,144,754 bytes allocated
==75936==
==75936== LEAK SUMMARY:
==75936==    definitely lost: 0 bytes in 0 blocks
==75936==    indirectly lost: 0 bytes in 0 blocks
==75936==      possibly lost: 1,088 bytes in 4 blocks
==75936==    still reachable: 91,967 bytes in 45 blocks
==75936==         suppressed: 0 bytes in 0 blocks
==75936== Rerun with --leak-check=full to see details of leaked memory
==75936==
==75936== For counts of detected and suppressed errors, rerun with: -v
==75936== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==75936== could not unlink /tmp/vgdb-pipe-from-vgdb-to-75936-by-root-on-???
==75936== could not unlink /tmp/vgdb-pipe-to-vgdb-from-75936-by-root-on-???
==75936== could not unlink /tmp/vgdb-pipe-shared-mem-vgdb-75936-by-root-on-???

@albertomn86 albertomn86 force-pushed the 2770-hostname-reload branch from 3b80228 to 03a7d53 Compare May 29, 2019 12:07
@albertomn86 albertomn86 marked this pull request as ready for review May 29, 2019 13:01
@vikman90 vikman90 self-assigned this May 29, 2019
@vikman90 vikman90 added type/bug Something isn't working module/agent Issues related to the agent daemon labels May 29, 2019
Copy link
Member

@vikman90 vikman90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@albertomn86 Thanks!
The code is great, but I get these logs when the agent cannot resolve the address:

  • Linux:
2019/05/29 15:49:15 ossec-agentd: INFO: Server IP Address: estretch/
  • Windows:
2019/05/29 06:57:28 ossec-agent[4872] start_agent.c:63 at connect_server(): DEBUG: Discarding connection to 'ef4.wazuh.co/'. Could not resolve hostname.

Such messages should not include the /.
Cheers.

@vikman90 vikman90 requested a review from snaow May 29, 2019 16:23
Copy link
Member

@vikman90 vikman90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@snaow snaow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attemps has a typo.

@vikman90 vikman90 merged commit 694fc03 into 3.9 Jun 3, 2019
@vikman90 vikman90 deleted the 2770-hostname-reload branch June 3, 2019 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module/agent Issues related to the agent daemon type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants