Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print message in hex format when remoted doesn't recognize it #21011

Merged
merged 3 commits into from Dec 21, 2023

Conversation

TomasTurina
Copy link
Member

Related issue
#17596

Description

As part of #17596, this PR adds information to the wazuh-remoted daemon log that will help in the future identify when an agent sends an unexpected message, so we can identify the cause of this. Additionally, an error message becomes a warning to avoid failures in Jenkins checks when this happens, as this is a situation where the manager and agent can recover without intervention.

Logs/Alerts example

2023/12/21 14:43:17 wazuh-remoted: WARNING: Unexpected message (hex): '2130333021234145533ad6d8712a021d2999cfc2fce5f3d117b079f2e0198de4b8ee199deaaff06ccfad6944ecdf301ef7f2e225fa6c98d1ed8042f42d2371538ebf453ab355bccff3a46cbf666976700b9f35037d9f58eee309ccb8821e381fe1856ae0d4dc9336a5e372e42caf9bb4ade80d9c84ee51d56f9f4197cc8766e18287f85378b429f29d59066f29c207205ee5ee3b72232d6b2c96c9246da9edcea18ebcd01cc6e59d0e002755245b3cf56684b37f27f7679b42ee32d0b887260394f37b55f58ec7bf9c0002d2f4647f138d8b04d96deda06212dc7997659f25d0cb5612b15612229610656f8f638d3d97f5c43f07617f084e11f8552f99cb9ad0f5bc59e5578f0cef0fc4d3c402b672f28417f8eede30eb4233bb'

Tests

  • Compilation without warnings in every supported platform
    • Linux
  • Source installation
  • Package installation
  • Source upgrade
  • Package upgrade
  • Review logs syntax and correct language

sdvendramini
sdvendramini previously approved these changes Dec 21, 2023
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.

@TomasTurina the fix looks good but I would like to move the code to another function, like

void print_hex_string(char * buffer, size_t buffer_size, const char * data, size_t data_len);

This way we let the code be more understandable, and we can add Doxygen and unit tests.

Thanks.

@TomasTurina TomasTurina merged commit 1c84291 into 4.7.2 Dec 21, 2023
61 of 63 checks passed
@TomasTurina TomasTurina deleted the 17596_print_unexpected_msg_remoted branch December 21, 2023 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants