wazuh / wazuh-packages

Wazuh - Tools for packages creation
https://wazuh.com
GNU General Public License v2.0
105 stars 96 forks source link

Indexer package v2 - update to 1.2.4 #1225

Closed okynos closed 2 years ago

okynos commented 2 years ago

Hello!

We want to upgrade our indexer package to 1.2.4 version. To achieve that we have to accomplish:

okynos commented 2 years ago

Hello team,

We have included the following changes:

We have generated new V2 packages but they need more development: DEB: https://s3.amazonaws.com/warehouse.wazuh.com/stack/indexer/stable/v2/wazuh-indexer_4.3.0-1_amd64.deb RPM: https://s3.amazonaws.com/warehouse.wazuh.com/stack/indexer/stable/v2/wazuh-indexer-4.3.0-1.x86_64.rpm

okynos commented 2 years ago

Hello team,

We need to compare original SPECs with current developed ones, to achieve that we will link the compared original documents from OpenSearch:

Our scripts:

We will analyze each section of each script


Postinstall

OpenSearch L11-L14 load the default vars Indexer L31-L33 the same.

OpenSearch L16 export OPENSEARCH_PATH_CONF variable Indexer Not used

OpenSearch L53-L56 Indexer L36-L38 Added sysctl service restart to load /usr/lib/sysctl.d/wazuh-indexer.conf

OpenSearch L20-L51, Selection of different actions to take, upgrade and package (makes no sense on Debian specific scripts) Indexer L42, If it is an install perform actions of install, else is an upgrade

OpenSearch L58-L77, Check system command and suggest an action with echo Indexer L80-L104, perform restart of the indexer service

OpenSearch L78-L101, perform a service restart if the variable RESTART_ON_UPGRADE is set. Indexer Done in upgrade step

OpenSearch L103-L118, Perform keystore generation Indexer doesn't perform this action keystore has to be created by user with the required stored credentials.

Indexer L45-L48, set up folders user and group

Indexer L50-L59, Prepare RCA and performance analyzer files

Indexer L63-L69, Include performance ana;yzer options into jvm.options file.

Indexer L73-L77, Configure host file limits.


Postremove

OpenSearch L1-L52, Same as postinstall Indexer L26-L54, the same

OpenSearch L54-L105, perform removal of:

OpenSearch L107-L115, Remove User and group Indexer L83-L95, perform the same


Preinstall

OpenSearch L1-L23, Same as postinstall Indexer L26-L29, the same

OpenSearch L25-L81, Create User and group if they don't exists in upgrade or install Indexer L31-L67, Create the user and group if they don't exists only on installations.


Preremove

Both perform the same action with one detail OpenSearch Include keystore management and restart variable Indexer manage this matter in postinstall upgrade and include service stop on purge (little fix)


Posttrans

OpenSearch manage the keystore file, create Indexer doesn't create or manage such file.

By the way we have done this changes today:

DEB: https://s3.amazonaws.com/warehouse.wazuh.com/stack/indexer/stable/v2/wazuh-indexer_4.3.0-1_amd64.deb RPM: https://s3.amazonaws.com/warehouse.wazuh.com/stack/indexer/stable/v2/wazuh-indexer-4.3.0-1.x86_64.rpm

alberpilot commented 2 years ago

Postinstall

OpenSearch L11-L14 load the default vars Indexer L31-L33 the same.

Ok.

OpenSearch L16 export OPENSEARCH_PATH_CONF variable Indexer Not used

Let's include it and let's include the code where is used this variable. In those cases where Keystore code is changed, we need to do the same.

OpenSearch L53-L56 Indexer L36-L38 Added sysctl service restart to load /usr/lib/sysctl.d/wazuh-indexer.conf

Ok

OpenSearch L20-L51, Selection of different actions to take, upgrade and package (makes no sense on Debian specific scripts) Indexer L42, If it is an install perform actions of install, else is an upgrade

Ok. (Not related change requested in PR).

OpenSearch L58-L77, Check system command and suggest an action with echo Indexer L80-L104, perform restart of the indexer service

Ok

OpenSearch L78-L101, perform a service restart if the variable RESTART_ON_UPGRADE is set. Indexer Done in upgrade step

Ok

OpenSearch L103-L118, Perform keystore generation Indexer doesn't perform this action keystore has to be created by user with the required stored credentials.

As mentioned before, let's include the same behavior in wazuh-indexer installer.

Indexer L45-L48, set up folders user and group

Ok

Indexer L50-L59, Prepare RCA and performance analyzer files

Ok

Indexer L63-L69, Include performance ana;yzer options into jvm.options file.

Ok

Indexer L73-L77, Configure host file limits.

Ok

Postremove

OpenSearch L1-L52, Same as postinstall Indexer L26-L54, the same

Ok

OpenSearch L54-L105, perform removal of:

/var/log/opensearch /usr/share/opensearch/plugins /usr/share/opensearch/bin /var/run/opensearch /var/lib/opensearch if the folder is empty /usr/share/opensearch/config/jvm.options.d only if it is empty /usr/chare/opensearch/config only if it is empty Indexer L56-L80, Remove: /usr/share/wazuh-indexer /run/wazuh-indexer /etc/wazuh-indexer Only removed on purge /var/log/wazuh-indexer remove only if it is empty /var/lib/wazuh-indexer NEVER REMOVED.

Ok

OpenSearch L107-L115, Remove User and group Indexer L83-L95, perform the same

Ok

Preinstall

OpenSearch L1-L23, Same as postinstall Indexer L26-L29, the same

Ok

OpenSearch L25-L81, Create User and group if they don't exists in upgrade or install Indexer L31-L67, Create the user and group if they don't exists only on installations.

Ok

Preremove

Both perform the same action with one detail OpenSearch Include keystore management and restart variable Indexer manage this matter in postinstall upgrade and include service stop on purge (little fix)

Ok

Posttrans

OpenSearch manage the keystore file, create Indexer doesn't create or manage such file.

Mentioned before.

By the way we have done these changes today:

c7fb222 we have added to the package and SPECs the securityadmin_wrapper.sh script to perform security configuration easily We have fixed a problem with systemd module inside base indexer package. DEB: https://s3.amazonaws.com/warehouse.wazuh.com/stack/indexer/stable/v2/wazuh-indexer_4.3.0-1_amd64.deb RPM: https://s3.amazonaws.com/warehouse.wazuh.com/stack/indexer/stable/v2/wazuh-indexer-4.3.0-1.x86_64.rpm

Nice.

okynos commented 2 years ago

Hello team,

Tasks performed on 3 Feb:

image Today we have performed some fixes and tests over various systems

Tasks:

okynos commented 2 years ago

Hi team,

We have encountered some problems to update CentOS 8 due to the lack of working repositories (vault doesn't seems to work too) We will assume that CentOS 8 and RHEL 8 will work the same way.

image

We will end up this development merging that into general branch