Fix sending of commands to the M_API #187
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes the sending of command to the Wazuh Server due to SSL handshake exceptions caused by self-signed certificates.
Following examples from OpenSearch and Apache HttpClient, the HttpRestClient initialization has been modified to allow the loading and use of custom certificates to properly establish the connection with the Wazuh Server.
Once the connection could be established, it could be seen that the plugin was unable to log in to the Wazuh Server. This problem was also fixed, and the Imposter's configuration has been updated accordingly to better mock the Wazuh Server authentication and security layer. Now, imposter won't respond with a 200 response no matter what. Proper authentication headers must be provided, but for the
/
endpoint, which returns basic information about the Wazuh Server. The remainings endpoints are protected with a JWT, and the/security/user/authenticate
endpoint needs basic authorization headers (user and password). Instructions to run imposter using SSL / TSL are also provided (to be done).More and better logging has been included. Most verbose logs have been moved to the DEBUG level, while some existing log calls that were using non-string parameters have been fixed.
Lots of missing JavaDocs have been including, reducing the DocLint warnings from 100 to 54.
Dead code has been removed.
Although everything seems to work fine, it seems that the use of custom certificates makes OpenSearch raise some errors in the logs. See the file attached.
wazuh-cluster.log
Testing evidence
server
indexer
server
agent
Issues Resolved
Closes #154