wazuh / wazuh-indexer

Wazuh indexer, the Wazuh search engine
https://opensearch.org/docs/latest/opensearch/index/
Apache License 2.0
6 stars 16 forks source link

Add OPENSEARCH_TMPDIR to systemd service #231

Closed f-galland closed 1 month ago

f-galland commented 1 month ago

Description

This PR adds OPENSEARCH_TMPDIR environment variable to the wazuh-indexer.service systemd unit and has it pointing to /var/log/wazuh-indexer/tmp such that /tmp and /var/tmp mount options such as noexec don't affect the service's initialization.

Issues Resolved

Resolves: https://github.com/wazuh/wazuh-packages/issues/1539

Check List

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.

f-galland commented 1 month ago

Tested and working as expected:

[root@alma8 ~]# ls -l /var/log/wazuh-indexer/ | grep tmp
drwxr-x---. 2 wazuh-indexer wazuh-indexer      6 May 21 11:58 tmp

[root@alma8 ~]# systemctl status wazuh-indexer.service --no-pager
● wazuh-indexer.service - wazuh-indexer
   Loaded: loaded (/usr/lib/systemd/system/wazuh-indexer.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2024-05-21 11:58:20 -03; 7min ago
     Docs: https://documentation.wazuh.com
 Main PID: 10418 (java)
    Tasks: 66 (limit: 23148)
   Memory: 1.3G
   CGroup: /system.slice/wazuh-indexer.service
           └─10418 /usr/share/wazuh-indexer/jdk/bin/java -Xshare:auto -Dopensearch.networkaddress.cache.ttl=60 -Dopensearch.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch …

May 21 11:58:12 alma8 systemd-entrypoint[10418]: WARNING: System::setSecurityManager has been called by org.opensearch.bootstrap.OpenSearch (file:/usr/share/wazuh-index…h-2.13.0.jar)
May 21 11:58:12 alma8 systemd-entrypoint[10418]: WARNING: Please consider reporting this to the maintainers of org.opensearch.bootstrap.OpenSearch
May 21 11:58:12 alma8 systemd-entrypoint[10418]: WARNING: System::setSecurityManager will be removed in a future release
May 21 11:58:13 alma8 systemd-entrypoint[10418]: May 21, 2024 11:58:13 AM sun.util.locale.provider.LocaleProviderAdapter <clinit>
May 21 11:58:13 alma8 systemd-entrypoint[10418]: WARNING: COMPAT locale provider will be removed in a future release
May 21 11:58:13 alma8 systemd-entrypoint[10418]: WARNING: A terminally deprecated method in java.lang.System has been called
May 21 11:58:13 alma8 systemd-entrypoint[10418]: WARNING: System::setSecurityManager has been called by org.opensearch.bootstrap.Security (file:/usr/share/wazuh-indexer…h-2.13.0.jar)
May 21 11:58:13 alma8 systemd-entrypoint[10418]: WARNING: Please consider reporting this to the maintainers of org.opensearch.bootstrap.Security
May 21 11:58:13 alma8 systemd-entrypoint[10418]: WARNING: System::setSecurityManager will be removed in a future release
May 21 11:58:20 alma8 systemd[1]: Started wazuh-indexer.
Hint: Some lines were ellipsized, use -l to show in full.

[root@alma8 ~]# systemctl cat wazuh-indexer.service --no-pager | grep OPENSEARCH_TMPDIR
Environment=OPENSEARCH_TMPDIR=/var/log/wazuh-indexer/tmp