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

Fix deployment wizard to add the WAZUH_PROTOCOL variable only for UDP connections #4760

Closed

Conversation

chantal-kelm
Copy link
Member

@chantal-kelm chantal-kelm commented Oct 25, 2022

Description

Now, the WAZUH_PROTOCOL variable is only displayed if a remote connection is of type secure and its protocol is UDP.

Notice

This issue was developed using Imposter, as we have not yet received a response from the @wazuh/framework team of a possible bug in the API. This issue must not be merged yet, as the code will be updated as soon as we have a reply from the @wazuh/framework team.

Issues Resolved

#4318

Evidence

Connection: Secure Protocol: UDP :

udpsecure.mp4

Connection: Secure Protocol: TCP :

TCPSECURE.mp4

Connection: Syslog

syslogtcpnosecure.mp4

Error handling and warning in the UI to the client.

error.mp4

Test

*Go to the Agents' tab
*Click on the 'Deploy new agent' button
*Verify that when a connection is type secure and its protocol is UDP, the variable WAZUH_PROTOCOL appears in the installation command, otherwise it does not appear.

You can use this data to test with the imposter:
CASE 1: Variable WAZUH_PROTOCOL should appear in the installation command.

{
    "data": {
      "remote": [
        {
          "connection": "syslog",
          "ipv6": "no",
          "protocol": [
            "UDP"
          ],
          "port": "514",
          "allowed-ips": [
            "0.0.0.0/0"
          ]
        },
        {
          "connection": "secure",
          "ipv6": "no",
          "protocol": [
            "UDP"
          ],
          "port": "1514",
          "queue_size": "131072"
        }
      ]
    },
    }, "error": 0
  }

Case 2: WAZUH_PROTOCOL variable should not appear in the install command

{
    "data": {
      "remote": [
        {
          "connection": "syslog",
          "ipv6": "no",
          "protocol": [
            "UDP"
          ],
          "port": "514",
          "allowed-ips": [
            "0.0.0.0/0"
          ]
        },
        {
          "connection": "secure",
          "ipv6": "no",
          "protocol": [
            "TCP"
          ],
          "port": "1514",
          "queue_size": "131072"
        }
      ]
    },
    }, "error": 0
  }

@@ -221,8 +221,19 @@ export const RegisterAgent = withErrorBoundary(
async getRemoteInfo() {
try {
const result = await WzRequest.apiReq('GET', '/agents/000/config/request/remote', {});
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: If I am not wrong, this request gets the data of the master node. Related to this pull request #4737 that adds the selection of the manager to connect, the protocol should use the configurated by the selected manager.

For another hand, what should be the value of the protocol variable for the next situation (taking into account the mentioned pull request):

  • manager1: tcp, udp
  • manager2: udp

Copy link
Member

Choose a reason for hiding this comment

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

Added comment in the linked issue to tread this topic: #4318 (comment)

yenienserrano
yenienserrano previously approved these changes Oct 26, 2022
Copy link
Member

@yenienserrano yenienserrano left a comment

Choose a reason for hiding this comment

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

CR: ☑️ with comments
Test: ✅

@Mayons95 Mayons95 self-requested a review October 26, 2022 18:04
@AlexRuiz7 AlexRuiz7 changed the title variable of deployment wazuh protocol Fix deployment wizard to add the WAZUH_PROTOCOL variable only for UDP connections Oct 27, 2022
@Machi3mfl Machi3mfl self-assigned this Oct 27, 2022
Copy link
Contributor

@Mayons95 Mayons95 left a comment

Choose a reason for hiding this comment

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

TR: ✔️
LGTM

Test details

Screenshot from 2022-10-28 08-08-42

Screenshot from 2022-10-28 08-07-46

Screenshot from 2022-10-28 08-06-26

Screenshot from 2022-10-28 08-01-12

Screenshot from 2022-10-28 07-55-24

@github-actions
Copy link
Contributor

Code coverage (Jest) % values
Statements 8.09% ( 2966 / 36641 )
Branches 3.7% ( 1045 / 28214 )
Functions 7% ( 636 / 9080 )
Lines 8.15% ( 2858 / 35072 )

@AlexRuiz7
Copy link
Member

Superseded by #4776

@AlexRuiz7 AlexRuiz7 deleted the 4318-variable-of-deployment-wazuh-protocol branch November 9, 2022 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants