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

Added server address and wazuh protocol definition in Deploy agent section #5166

Merged
merged 9 commits into from
Jan 26, 2023

Conversation

Machi3mfl
Copy link
Member

@Machi3mfl Machi3mfl commented Jan 25, 2023

Description

This PR, adds a new WzServerAddress component for the Deploy Agent section.
The component is a free input.

Closes #5138 #5140

Scope

Protocol cases

  1. When the only available Protocol is UDP, the WAZUH_PROTOCOL param in the command will show UDP.
  • On Manager and Cluster mode.
  1. When the Protocol available exists TCP, the WAZUH_PROTOCOL param in the command will be TCP (the param is hidden, and TCP is the default value)
  • On Manager and Cluster mode.

Server address input cases

  1. When the user has filled the enrollment.dns field in Management > Configuration. The server address input must be filled by default with this value.

Annotation

The protocol and server address input are independent.
The command protocol param defined depends on only the remote configuration defined in the ossec.conf file.

Test cases evidence

Protocol cases

When the protocol is UDP (Cluster mode)

  1. Check the remote config in Management > Configuration > Global configuration > Remote Tab
  2. Go to Deploy Agent
  3. Complete the OS options.
  4. The WAZUH_PROTOCOL param must show UDP
Kazam_screencast_00005.mp4

When the protocol is TCP (Cluster mode)

  1. Check the remote config in Management > Configuration > Global configuration > Remote Tab
  2. Go to Deploy Agent
  3. Complete the OS options.
  4. The WAZUH_PROTOCOL param must be hidden (when is not defined the protocol is TCP)
Kazam_screencast_00006.mp4

When the protocol is UDP (Manager mode)

  1. Check the remote config in Management > Configuration > Global configuration > Remote Tab
  2. Go to Deploy Agent
  3. Complete the OS options.
  4. The WAZUH_PROTOCOL param must show UDP
Kazam_screencast_00008.mp4

When the protocol is TCP (Manager mode)

  1. Check the remote config in Management > Configuration > Global configuration > Remote Tab
  2. Go to Deploy Agent
  3. Complete the OS options.
  4. The WAZUH_PROTOCOL param must be hidden (when is not defined the protocol is TCP)
Kazam_screencast_00007.mp4

Check List

  • All tests pass
    • yarn test:jest
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@Machi3mfl
Copy link
Member Author

Machi3mfl commented Jan 25, 2023

This PR also resolves issue #5140

Now, when the Deploy Agent inputs changes don't launch new requests.

Kazam_screencast_00000.mp4

@Machi3mfl Machi3mfl self-assigned this Jan 25, 2023
@Machi3mfl Machi3mfl changed the title Added new WzServerAddressInput component Added new Server Address component Jan 25, 2023
CHANGELOG.md Outdated Show resolved Hide resolved
@Machi3mfl Machi3mfl changed the title Added new Server Address component Added new Server Address input in Deploy agent section Jan 26, 2023
@Machi3mfl Machi3mfl changed the title Added new Server Address input in Deploy agent section Added server address and wazuh protocol definition in Deploy agent section Jan 26, 2023
tsconfig.json Outdated Show resolved Hide resolved
@github-actions
Copy link
Contributor

Code coverage (Jest) % values
Statements 8.8% ( 3255 / 36973 )
Branches 4.49% ( 1291 / 28723 )
Functions 7.68% ( 703 / 9159 )
Lines 8.87% ( 3140 / 35403 )

Copy link
Member

@Desvelao Desvelao left a comment

Choose a reason for hiding this comment

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

review:

code 🟢

Tests

Kibana 7.10.2

WIP

Legend:
⚫: none
🟢: passed
🔴: failed
🟡: warning
⚪: not applicable

UI

Test Chrome Firefox Safari
For a manager master (cluster mode) configurated as TCP and UDP as the protocols of the remote secure connection, uses the TCP protocol. It should not display the WAZUH_PROTOCOL deployment variable 🟢 🟢
For a manager master (cluster mode) configurated as TCP as the protocol of the remote secure connection, uses the TCP protocol. It should not display the WAZUH_PROTOCOL deployment variable 🟢 🟢
For a manager master (cluster mode) configurated as UDP as the protocol of the remote secure connection, uses the UDP protocol. It should display the WAZUH_PROTOCOL deployment variable with UDP value 🟢 🟢
For a manager master (manager mode) configurated as TCP and UDP as the protocols of the remote secure connection, uses the TCP protocol. It should not display the WAZUH_PROTOCOL deployment variable 🟢 🟢
For a manager master (cluster mode) configurated as TCP as the protocol of the remote secure connection, uses the TCP protocol. It should not display the WAZUH_PROTOCOL deployment variable 🟢 🟢
For a manager master (manager mode) configurated as UDP as the protocol of the remote secure connection, uses the UDP protocol. It should display the WAZUH_PROTOCOL deployment variable with UDP value 🟢 🟢

Details

🟢 For a manager master (cluster mode) configurated as TCP and UDP as the protocols of the remote secure connection, uses the TCP protocol. It should not display the WAZUH_PROTOCOL deployment variable

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 For a manager master (cluster mode) configurated as TCP as the protocol of the remote secure connection, uses the TCP protocol. It should not display the WAZUH_PROTOCOL deployment variable

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 For a manager master (cluster mode) configurated as UDP as the protocol of the remote secure connection, uses the UDP protocol. It should display the WAZUH_PROTOCOL deployment variable with UDP value

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 For a manager master (manager mode) configurated as TCP and UDP as the protocols of the remote secure connection, uses the TCP protocol. It should not display the WAZUH_PROTOCOL deployment variable

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 For a manager master (cluster mode) configurated as TCP as the protocol of the remote secure connection, uses the TCP protocol. It should not display the WAZUH_PROTOCOL deployment variable

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 For a manager master (manager mode) configurated as UDP as the protocol of the remote secure connection, uses the UDP protocol. It should display the WAZUH_PROTOCOL deployment variable with UDP value

Chrome - ⚫
image

Firefox - ⚫
image

Safari - ⚫

Copy link
Member

@asteriscos asteriscos left a comment

Choose a reason for hiding this comment

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

Test: ❌
If I choose Operating systems without Manager Server Address the script does not show UDP in cluster mode:
image

@Machi3mfl
Copy link
Member Author

Machi3mfl commented Jan 26, 2023

Test: x If I choose Operating systems without Manager Server Address the script does not show UDP in cluster mode: image

Thanks, @asteriscos.
I researched this use case and is the expected behavior, for the Alpine SO the command doesn't have additional parameters like WAZUH_PROTOCOL, WAZUH_MANAGER, etc.
The command structure is defined in the following issue comment

Copy link
Member

@asteriscos asteriscos left a comment

Choose a reason for hiding this comment

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

CR: ✔️

Cluster mode - With Enrollment - UDP - 🟢

Screenshot from 2023-01-26 18-58-19

Cluster mode - Without Enrollment - UDP - 🟢

Screenshot from 2023-01-26 18-56-58

Cluster mode - TCP - 🟢

image

Manager mode - TCP - 🟢

image

Manager mode - UDP - 🟢

image

@github-actions
Copy link
Contributor

The backport to 4.4-2.4-wzd failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-4.4-2.4-wzd 4.4-2.4-wzd
# Navigate to the new working tree
cd .worktrees/backport-4.4-2.4-wzd
# Create a new branch
git switch --create backport-5166-to-4.4-2.4-wzd
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b167d6c4bc65b1b42029ddbab13c99c99cd43428
# Push it to GitHub
git push --set-upstream origin backport-5166-to-4.4-2.4-wzd
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.4-2.4-wzd

Then, create a pull request where the base branch is 4.4-2.4-wzd and the compare/head branch is backport-5166-to-4.4-2.4-wzd.

github-actions bot pushed a commit that referenced this pull request Jan 26, 2023
…ction (#5166)

* Added new WzServerAddressInput component

* Updated CHANGELOG

* Update state server address when is mounted

* Resolved review comments

* Updated CHANGELOG

* Updated logic when protocol is UDP

* Modified wazuh protocol param definition

* Changed PR text in CHANGELOG

* Reverted changes tsconfig

(cherry picked from commit b167d6c)
Desvelao pushed a commit that referenced this pull request Jan 27, 2023
…ction (#5166)

* Added new WzServerAddressInput component

* Updated CHANGELOG

* Update state server address when is mounted

* Resolved review comments

* Updated CHANGELOG

* Updated logic when protocol is UDP

* Modified wazuh protocol param definition

* Changed PR text in CHANGELOG

* Reverted changes tsconfig

(cherry picked from commit b167d6c)
asteriscos pushed a commit that referenced this pull request Jan 27, 2023
…tion in Deploy agent section (#5173)

Added server address and wazuh protocol definition in Deploy agent section (#5166)

* Added new WzServerAddressInput component

* Updated CHANGELOG

* Update state server address when is mounted

* Resolved review comments

* Updated CHANGELOG

* Updated logic when protocol is UDP

* Modified wazuh protocol param definition

* Changed PR text in CHANGELOG

* Reverted changes tsconfig

(cherry picked from commit b167d6c)

Co-authored-by: Maximiliano Ibarra <[email protected]>
asteriscos added a commit that referenced this pull request Jan 27, 2023
…n in Deploy agent section (#5172)

Added server address and wazuh protocol definition in Deploy agent section (#5166)

* Added new WzServerAddressInput component

* Updated CHANGELOG

* Update state server address when is mounted

* Resolved review comments

* Updated CHANGELOG

* Updated logic when protocol is UDP

* Modified wazuh protocol param definition

* Changed PR text in CHANGELOG

* Reverted changes tsconfig

(cherry picked from commit b167d6c)

Co-authored-by: Maximiliano Ibarra <[email protected]>
Co-authored-by: Antonio <[email protected]>
Co-authored-by: Federico Rodriguez <[email protected]>
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