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

Migration to OpenSearch's Debian scripts #564

Open
2 tasks
Tracked by #485
AlexRuiz7 opened this issue Nov 25, 2024 · 3 comments · May be fixed by #559 or #607
Open
2 tasks
Tracked by #485

Migration to OpenSearch's Debian scripts #564

AlexRuiz7 opened this issue Nov 25, 2024 · 3 comments · May be fixed by #559 or #607
Assignees
Labels
level/task Task issue request/operational Operational requests type/enhancement Enhancement issue

Comments

@AlexRuiz7
Copy link
Member

AlexRuiz7 commented Nov 25, 2024

Description

On #527, we detected that we were using different Debian packages scripts made on our own, instead of using these from OpenSearch present in the repo, These include compatibility to systemd, service and other service managers.

Moreover, it may benefit from other feature such as removing configuration files on apt purge.

The goal is to migrate our changes and use these Debian packages scripts, removing duplicated code.

Functional requirements

  • The wazuh-indexer deb packages use the scripts from upstream
  • The wazuh-indexer deb packages scripts don't miss any functionality from the scripts currently in use.

Implementation restrictions

  • Inputs and outputs of the assemble.sh must not change.

Plan

  • Update the assemble.sh script to use the scripts on distribution/packages/src/common.
  • Port the required changes from distribution/packages/src/deb.

Related issues

@QU3B1M
Copy link
Member

QU3B1M commented Dec 19, 2024

Update assemble.sh script to use the OpenSearch packaging scripts for the Debian system, the build process gives no errors, but when the package is installed using dpkg it crashes

dpkg -i wazuh-indexer_5.0.0-0_arm64_706df02e-c5121c7-3e0ef45.deb 

dpkg-deb: error: archive 'wazuh-indexer_5.0.0-0_arm64_706df02e-c5121c7-3e0ef45.deb' uses unknown compression for member 'control.tar.zst', giving up
dpkg: error processing archive wazuh-indexer_5.0.0-0_arm64_706df02e-c5121c7-3e0ef45.deb (--install):
 dpkg-deb --control subprocess returned error exit status 2
Errors were encountered while processing:
 wazuh-indexer_5.0.0-0_arm64_706df02e-c5121c7-3e0ef45.deb

@QU3B1M
Copy link
Member

QU3B1M commented Dec 20, 2024

The assemble tool requires the .deb packaging scripts to be stored in a debian/ directory, by modifying the temp directory where the scripts are stored the package can be built and installed correctly again.

sudo dpkg -i wazuh-indexer_5.0.0-0_arm64_9fb8d0c6-c5121c7-3e0ef45.deb 
Selecting previously unselected package wazuh-indexer.
(Reading database ... 29248 files and directories currently installed.)
Preparing to unpack wazuh-indexer_5.0.0-0_arm64_9fb8d0c6-c5121c7-3e0ef45.deb ...
Unpacking wazuh-indexer (5.0.0-0) ...
Setting up wazuh-indexer (5.0.0-0) ...

Anyway it fails at the startup, seems to be a problem with the permissions, probably the owner user or group is not being properly configured

Dec 20 11:39:12 debian-11 systemd[1583]: wazuh-indexer.service: Changing to the requested working directory failed: Permission denied
Dec 20 11:39:12 debian-11 systemd[1583]: wazuh-indexer.service: Failed at step CHDIR spawning /usr/share/wazuh-indexer/bin/systemd-entrypoint: Permission denied

For the .rpm packages, it requires further development on the assemble tool since currently it uses a .rpm.spec file as packaging script, and it must be replaced with the Debian like scripts made by OpenSearch for both cases.

@QU3B1M
Copy link
Member

QU3B1M commented Dec 26, 2024

For some reason, the DEB maintenance scripts are passing through the upgrade process instead of the install causing the installation to be incomplete.

dpkg -i wazuh-indexer_5.0.0-0_arm64_4ea7820a-846f143-494d125.deb 
Selecting previously unselected package wazuh-indexer.
(Reading database ... 29248 files and directories currently installed.)
Preparing to unpack wazuh-indexer_5.0.0-0_arm64_4ea7820a-846f143-494d125.deb ...
RUNNING PRE INSTALL
Creating wazuh-indexer group... OK
Creating wazuh-indexer user... OK
Unpacking wazuh-indexer (5.0.0-0) ...
Setting up wazuh-indexer (5.0.0-0) ...
RUNNING POST INSTALL
Executing with parameters: configure 
Configuring wazuh-indexer
Upgade: xtrue
Setting up wazuh-indexer keystore
Created opensearch keystore in /etc/wazuh-indexer/opensearch.keystore
POST INSTALL DONE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task Task issue request/operational Operational requests type/enhancement Enhancement issue
Projects
Status: In progress
3 participants