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

Select package type to upgrade #6648

Merged
merged 3 commits into from
May 10, 2024

Conversation

lucianogorza
Copy link
Contributor

@lucianogorza lucianogorza commented May 7, 2024

Description

When upgrade an individual agent, in case that the OS is Linux and the platform is not one of these:

  • debian
  • ubuntu
  • amzn
  • centos
  • fedora
  • ol
  • opensuse
  • opensuse-leap
  • opensuse-tumbleweed
  • rhel
  • sles
  • suse

The confirm modal asks for the package type (RPM or DEB).

Note

The multiple upgrade action was not modified

Issues Resolved

https://github.com/wazuh/internal-devel-requests/issues/1102

Evidence

Ubuntu platform

image
image

The request was made without package_type and force parameters
image

Alpine platform

image
image

The request was made with package_type and force parameters
image

Test

Legend:
⚫: none
🟢: pass
🟡: warning
🔴: fail
⚪: not applicable

UI

Important

Test with a real manager from this branch: https://github.com/wazuh/wazuh/tree/migration/21755-wazuh-packages-redesign. Here are the API changes with the new package_type parameter.

Create an out of date agent with Ubuntu (or other supported Linux platform)

docker run --name os-dev-2130-agent-$(date +%s) --network os-dev-2.13.0 --label com.docker.compose.project=os-dev-2130 --env WAZUH_AGENT_VERSION=4.6.0 -d ubuntu:20.04 bash -c '
  apt update -y
  apt install -y curl lsb-release
  curl -so \wazuh-agent-${WAZUH_AGENT_VERSION}.deb \
    https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${WAZUH_AGENT_VERSION}-1_amd64.deb \
    && WAZUH_MANAGER='wazuh.manager' WAZUH_AGENT_GROUP='default' dpkg -i ./wazuh-agent-${WAZUH_AGENT_VERSION}.deb

  /etc/init.d/wazuh-agent start
  tail -f /var/ossec/logs/ossec.log
'

Create an out of date agent with Alpine (or other unsupported Linux platform)
Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "generic/alpine312"
end

Guide to install the agent in Alpine: https://documentation.wazuh.com/current/installation-guide/wazuh-agent/wazuh-agent-package-linux.html (APK tab)
Docker

docker run --platform linux/amd64 --name os-dev-2130-agent-$(date +%s) --network os-dev-2.13.0 --label com.docker.compose.project=os-dev-2130 --env WAZUH_AGENT_VERSION=4.6.0 -d alpine sh -c '
  wget -O /etc/apk/keys/alpine-devel@wazuh.com-633d7457.rsa.pub https://packages.wazuh.com/key/alpine-devel%40wazuh.com-633d7457.rsa.pub
  echo "https://packages.wazuh.com/4.x/alpine/v3.12/main" >> /etc/apk/repositories
  apk update -y
  apk add wazuh-agent
  export WAZUH_MANAGER="wazuh-manager-master" && sed -i "s|MANAGER_IP|$WAZUH_MANAGER|g" /var/ossec/etc/ossec.conf
  /var/ossec/bin/wazuh-control start
  tail -f /var/ossec/logs/ossec.log
'

The upgrade tasks fail because the manager 4.9.0 cannot find the 4.9.0 package to upgrade the agents.

Go to Server management -> Endpoint Summary

Ubuntu agent

Test Chrome Firefox Safari
Click the All actions (...) button in the agent row and click Upgrade. A modal should open should only display the Agent ID, Agent name, Agent version and OS fields.
Inside the modal, click Upgrade. The API request should only use the agents_list and wait_for_complete parameters.

Details

⚫ Click the `All actions` (`...`) button in the agent row and click `Upgrade`. A modal should open should only display the Agent ID, Agent name, Agent version and OS fields.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Inside the modal, click `Upgrade`. The API request should only use the `agents_list` and `wait_for_complete` parameters.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

Alpine agent

Test Chrome Firefox Safari
Click the All actions (...) button in the agent row and click Upgrade. A modal should open should display the Agent ID, Agent name, Agent version and OS fields, and the package type input.
Inside the modal, select the package type and click Upgrade. The API request should use the agents_list, wait_for_complete, force and package_type parameters.

Details

⚫ Click the `All actions` (`...`) button in the agent row and click `Upgrade`. A modal should open should display the Agent ID, Agent name, Agent version and OS fields, and the package type input.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Inside the modal, select the package type and click `Upgrade`. The API request should use the `agents_list`, `wait_for_complete`, `force` and `package_type` parameters.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

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

@lucianogorza lucianogorza self-assigned this May 7, 2024
@lucianogorza lucianogorza force-pushed the enhancement/1102-select-package-type-to-upgrade branch 2 times, most recently from de1da83 to 8dee1b3 Compare May 7, 2024 17:36
@lucianogorza lucianogorza force-pushed the enhancement/1102-select-package-type-to-upgrade branch from 8dee1b3 to 5745e21 Compare May 7, 2024 20:29
@lucianogorza lucianogorza marked this pull request as ready for review May 7, 2024 20:29
@yenienserrano yenienserrano self-requested a review May 8, 2024 16:23
@yenienserrano
Copy link
Member

yenienserrano commented May 8, 2024

Ubuntu agent

Test Chrome Firefox Safari
Click the All actions (...) button in the agent row and click Upgrade. A modal should open should only display the Agent ID, Agent name, Agent version and OS fields. 🟢
Inside the modal, click Upgrade. The API request should only use the agents_list and wait_for_complete parameters. 🟢

Details

🟢 Click the `All actions` (`...`) button in the agent row and click `Upgrade`. A modal should open should only display the Agent ID, Agent name, Agent version and OS fields.

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

image
🟢 Inside the modal, click `Upgrade`. The API request should only use the `agents_list` and `wait_for_complete` parameters.

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

image

Alpine agent

Test Chrome Firefox Safari
Click the All actions (...) button in the agent row and click Upgrade. A modal should open should display the Agent ID, Agent name, Agent version and OS fields, and the package type input. 🟢
Inside the modal, select the package type and click Upgrade. The API request should use the agents_list, wait_for_complete, force and package_type parameters. 🟢

Details

🟢 Click the `All actions` (`...`) button in the agent row and click `Upgrade`. A modal should open should display the Agent ID, Agent name, Agent version and OS fields, and the package type input.

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

image
🟢 Inside the modal, select the package type and click `Upgrade`. The API request should use the `agents_list`, `wait_for_complete`, `force` and `package_type` parameters.

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

image

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.

LGTM

@asteriscos asteriscos self-requested a review May 10, 2024 11:57
@asteriscos
Copy link
Member

asteriscos commented May 10, 2024

Ubuntu agent

Test Chrome Firefox Safari
Click the All actions (...) button in the agent row and click Upgrade. A modal should open should only display the Agent ID, Agent name, Agent version and OS fields. 🟢 🟢
Inside the modal, click Upgrade. The API request should only use the agents_list and wait_for_complete parameters. 🟢 🟢

Details

🟢 Click the `All actions` (`...`) button in the agent row and click `Upgrade`. A modal should open should only display the Agent ID, Agent name, Agent version and OS fields.

Chrome - 🟢
Peek 2024-05-10 16-23

Firefox - 🟢
Peek 2024-05-10 16-34

🟢 Inside the modal, click `Upgrade`. The API request should only use the `agents_list` and `wait_for_complete` parameters.

Chrome - 🟢
image

Firefox - 🟢
image

Alpine agent

Test Chrome Firefox Safari
Click the All actions (...) button in the agent row and click Upgrade. A modal should open should display the Agent ID, Agent name, Agent version and OS fields, and the package type input. 🟢 🟢
Inside the modal, select the package type and click Upgrade. The API request should use the agents_list, wait_for_complete, force and package_type parameters. 🟢 🟢

Details

🟢 Click the `All actions` (`...`) button in the agent row and click `Upgrade`. A modal should open should display the Agent ID, Agent name, Agent version and OS fields, and the package type input.

Chrome - 🟢
Peek 2024-05-10 17-58

Firefox - 🟢
Peek 2024-05-10 18-02

🟢 Inside the modal, select the package type and click `Upgrade`. The API request should use the `agents_list`, `wait_for_complete`, `force` and `package_type` parameters.

Chrome - 🟢
image

Firefox - 🟢
image

@asteriscos asteriscos merged commit 2f69aff into 4.9.0 May 10, 2024
1 check passed
@asteriscos asteriscos deleted the enhancement/1102-select-package-type-to-upgrade branch May 10, 2024 16:04
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.

3 participants