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

Adapt features from legacy packaging scripts to the current ones #623

Merged

Conversation

QU3B1M
Copy link
Member

@QU3B1M QU3B1M commented Jan 6, 2025

Description

Update DEB and RPM maintenance scripts adding support to SysV service manager.

The legacy packaging scripts (distribution/packages/src/common/scripts) were deleted since we detected several incompatibilities in them, the features from these scripts were adapted to our current ones that are based on the OpenSearch current build scripts.

Service file for init.d is also updated, the version for RPM and DEB were merged into just one file.

Validations can be found on this comment.

Related Issues

Resolves #564

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@QU3B1M QU3B1M self-assigned this Jan 6, 2025
@QU3B1M QU3B1M marked this pull request as ready for review January 6, 2025 17:10
@QU3B1M QU3B1M requested a review from a team as a code owner January 6, 2025 17:10
@QU3B1M QU3B1M force-pushed the ci/564-update-packaging-scripts-with-opensearch-features branch 5 times, most recently from 13fe8eb to 82feb83 Compare January 9, 2025 13:32
@QU3B1M QU3B1M linked an issue Jan 10, 2025 that may be closed by this pull request
@QU3B1M QU3B1M linked an issue Jan 10, 2025 that may be closed by this pull request
@f-galland
Copy link
Member

f-galland commented Jan 10, 2025

Testing under devuan:

root@deb-package-tests:~# cat /etc/os-release 
PRETTY_NAME="Devuan GNU/Linux 5 (daedalus)"
NAME="Devuan GNU/Linux"
VERSION_ID="5"
VERSION="5 (daedalus)"
VERSION_CODENAME="daedalus"
ID=devuan
ID_LIKE=debian
HOME_URL="https://www.devuan.org/"
SUPPORT_URL="https://devuan.org/os/community"
BUG_REPORT_URL="https://bugs.devuan.org/"

Package installation:

root@deb-package-tests:~# dpkg -i wazuh-indexer_5.0.0-0_amd64_da8639bc-846f143-494d125.deb 
Selecting previously unselected package wazuh-indexer.
(Reading database ... 11461 files and directories currently installed.)
Preparing to unpack wazuh-indexer_5.0.0-0_amd64_da8639bc-846f143-494d125.deb ...
Running Wazuh Indexer Pre-Installation Script
Unpacking wazuh-indexer (5.0.0-0) ...
Setting up wazuh-indexer (5.0.0-0) ...
Running Wazuh Indexer Post-Installation Script
### NOT starting on installation, please execute the following statements to configure wazuh-indexer service to start automatically using update-rc.d
 sudo update-rc.d wazuh-indexer defaults 95 10
### You can start wazuh-indexer service by executing
 sudo service wazuh-indexer start
### Installing wazuh-indexer demo certificates in /etc/wazuh-indexer
 If you are using a custom certificates path, ignore this message
 See demo certs creation log in /var/log/wazuh-indexer/install_demo_certificates.log

Service starts properly:

root@deb-package-tests:~# service wazuh-indexer start
Starting wazuh-indexer...

root@deb-package-tests:~# service wazuh-indexer status
wazuh-indexer is running (PID: 953)

Initializing the cluster:

root@deb-package-tests:~# /usr/share/wazuh-indexer/bin/indexer-security-init.sh 
Security Admin v7
Will connect to 127.0.0.1:9200 ... done
Connected as "CN=admin,OU=Wazuh,O=Wazuh,L=California,C=US"
OpenSearch Version: 2.18.0
Contacting opensearch cluster 'opensearch' and wait for YELLOW clusterstate ...
Clustername: wazuh-cluster
Clusterstate: GREEN
Number of nodes: 1
Number of data nodes: 1
.opendistro_security index does not exists, attempt to create it ... done (0-all replicas)
Populate config from /etc/wazuh-indexer/opensearch-security/
Will update '/config' with /etc/wazuh-indexer/opensearch-security/config.yml 
   SUCC: Configuration for 'config' created or updated
Will update '/roles' with /etc/wazuh-indexer/opensearch-security/roles.yml 
   SUCC: Configuration for 'roles' created or updated
Will update '/rolesmapping' with /etc/wazuh-indexer/opensearch-security/roles_mapping.yml 
   SUCC: Configuration for 'rolesmapping' created or updated
Will update '/internalusers' with /etc/wazuh-indexer/opensearch-security/internal_users.yml 
   SUCC: Configuration for 'internalusers' created or updated
Will update '/actiongroups' with /etc/wazuh-indexer/opensearch-security/action_groups.yml 
   SUCC: Configuration for 'actiongroups' created or updated
Will update '/tenants' with /etc/wazuh-indexer/opensearch-security/tenants.yml 
   SUCC: Configuration for 'tenants' created or updated
Will update '/nodesdn' with /etc/wazuh-indexer/opensearch-security/nodes_dn.yml 
   SUCC: Configuration for 'nodesdn' created or updated
Will update '/whitelist' with /etc/wazuh-indexer/opensearch-security/whitelist.yml 
   SUCC: Configuration for 'whitelist' created or updated
Will update '/audit' with /etc/wazuh-indexer/opensearch-security/audit.yml 
   SUCC: Configuration for 'audit' created or updated
Will update '/allowlist' with /etc/wazuh-indexer/opensearch-security/allowlist.yml 
   SUCC: Configuration for 'allowlist' created or updated
SUCC: Expected 10 config types for node {"updated_config_types":["allowlist","tenants","rolesmapping","nodesdn","audit","roles","whitelist","actiongroups","config","internalusers"],"updated_config_size":10,"message":null} is 10 (["allowlist","tenants","rolesmapping","nodesdn","audit","roles","whitelist","actiongroups","config","internalusers"]) due to: null
Done with success

Checking connectivity:

root@deb-package-tests:~# curl -sku admin:admin https://localhost:9200
{
  "name" : "node-1",
  "cluster_name" : "wazuh-cluster",
  "cluster_uuid" : "4hJ7su4VRt659IyvkHZ0Hw",
  "version" : {
    "distribution" : "opensearch",
    "number" : "2.18.0",
    "build_type" : "deb",
    "build_hash" : "da8639bcb37dfb5fffbd34983818e831c249b6c2",
    "build_date" : "2025-01-09T18:02:57.564146372Z",
    "build_snapshot" : false,
    "lucene_version" : "9.12.0",
    "minimum_wire_compatibility_version" : "7.10.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "The OpenSearch Project: https://opensearch.org/"
}

@f-galland
Copy link
Member

Testing under an almalinux docker container:

[root@alma9 ~]# cat /etc/os-release 
NAME="AlmaLinux"
VERSION="9.5 (Teal Serval)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.5"
PLATFORM_ID="platform:el9"
PRETTY_NAME="AlmaLinux 9.5 (Teal Serval)"
ANSI_COLOR="0;34"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:almalinux:almalinux:9::baseos"
HOME_URL="https://almalinux.org/"
DOCUMENTATION_URL="https://wiki.almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"

ALMALINUX_MANTISBT_PROJECT="AlmaLinux-9"
ALMALINUX_MANTISBT_PROJECT_VERSION="9.5"
REDHAT_SUPPORT_PRODUCT="AlmaLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.5"
SUPPORT_END=2032-06-01

Package installation:

[root@alma9 ~]# rpm -i /home/fede/shared/wazuh-indexer_5.0.0-0_x86_64_da8639bc-846f143-494d125.rpm
### You can start wazuh-indexer service by executing
 sudo /etc/init.d/wazuh-indexer start
### Installing wazuh-indexer demo certificates in /etc/wazuh-indexer
 If you are using a custom certificates path, ignore this message
 See demo certs creation log in /var/log/wazuh-indexer/install_demo_certificates.log

Service starts properly:

[root@alma9 ~]# /etc/init.d/wazuh-indexer start
Starting wazuh-indexer...

[root@alma9 ~]# /etc/init.d/wazuh-indexer status
wazuh-indexer is running (PID: 338)

Initializing the cluster:

[root@alma9 ~]# /usr/share/wazuh-indexer/bin/indexer-security-init.sh 
Security Admin v7
Will connect to 127.0.0.1:9200 ... done
Connected as "CN=admin,OU=Wazuh,O=Wazuh,L=California,C=US"
OpenSearch Version: 2.18.0
Contacting opensearch cluster 'opensearch' and wait for YELLOW clusterstate ...
Clustername: wazuh-cluster
Clusterstate: GREEN
Number of nodes: 1
Number of data nodes: 1
.opendistro_security index does not exists, attempt to create it ... done (0-all replicas)
Populate config from /etc/wazuh-indexer/opensearch-security/
Will update '/config' with /etc/wazuh-indexer/opensearch-security/config.yml 
   SUCC: Configuration for 'config' created or updated
Will update '/roles' with /etc/wazuh-indexer/opensearch-security/roles.yml 
   SUCC: Configuration for 'roles' created or updated
Will update '/rolesmapping' with /etc/wazuh-indexer/opensearch-security/roles_mapping.yml 
   SUCC: Configuration for 'rolesmapping' created or updated
Will update '/internalusers' with /etc/wazuh-indexer/opensearch-security/internal_users.yml 
   SUCC: Configuration for 'internalusers' created or updated
Will update '/actiongroups' with /etc/wazuh-indexer/opensearch-security/action_groups.yml 
   SUCC: Configuration for 'actiongroups' created or updated
Will update '/tenants' with /etc/wazuh-indexer/opensearch-security/tenants.yml 
   SUCC: Configuration for 'tenants' created or updated
Will update '/nodesdn' with /etc/wazuh-indexer/opensearch-security/nodes_dn.yml 
   SUCC: Configuration for 'nodesdn' created or updated
Will update '/whitelist' with /etc/wazuh-indexer/opensearch-security/whitelist.yml 
   SUCC: Configuration for 'whitelist' created or updated
Will update '/audit' with /etc/wazuh-indexer/opensearch-security/audit.yml 
   SUCC: Configuration for 'audit' created or updated
Will update '/allowlist' with /etc/wazuh-indexer/opensearch-security/allowlist.yml 
   SUCC: Configuration for 'allowlist' created or updated
SUCC: Expected 10 config types for node {"updated_config_types":["allowlist","tenants","rolesmapping","nodesdn","audit","roles","whitelist","actiongroups","config","internalusers"],"updated_config_size":10,"message":null} is 10 (["allowlist","tenants","rolesmapping","nodesdn","audit","roles","whitelist","actiongroups","config","internalusers"]) due to: null
Done with success

Checking connectivity:

[root@alma9 ~]# curl -sku admin:admin https://localhost:9200
{
  "name" : "node-1",
  "cluster_name" : "wazuh-cluster",
  "cluster_uuid" : "fmsbmqOPTlKBu24i3FnclA",
  "version" : {
    "distribution" : "opensearch",
    "number" : "2.18.0",
    "build_type" : "rpm",
    "build_hash" : "da8639bcb37dfb5fffbd34983818e831c249b6c2",
    "build_date" : "2025-01-09T18:01:35.422201542Z",
    "build_snapshot" : false,
    "lucene_version" : "9.12.0",
    "minimum_wire_compatibility_version" : "7.10.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "The OpenSearch Project: https://opensearch.org/"
}

@QU3B1M QU3B1M force-pushed the ci/564-update-packaging-scripts-with-opensearch-features branch from da8639b to 88f738b Compare January 13, 2025 12:19
@AlexRuiz7 AlexRuiz7 merged commit 6dd2e13 into master Jan 15, 2025
13 checks passed
@AlexRuiz7 AlexRuiz7 deleted the ci/564-update-packaging-scripts-with-opensearch-features branch January 15, 2025 13:16
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