From 6e9962b06cd5209f4f9185d2237c135a77e41bec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Wed, 29 Nov 2023 13:49:11 +0100 Subject: [PATCH] Rename packages to wazuh-indexer --- ...nternalDistributionArchiveSetupPlugin.java | 2 +- .../InternalDistributionBwcSetupPlugin.java | 8 +- distribution/build.gradle | 32 ++++---- distribution/docker/build.gradle | 2 +- distribution/docker/docker-compose.yml | 4 +- distribution/docker/docker-test-entrypoint.sh | 4 +- distribution/docker/src/docker/Dockerfile | 24 +++--- .../src/docker/bin/docker-entrypoint.sh | 8 +- distribution/packages/build.gradle | 78 +++++++++---------- .../common/env/{opensearch => wazuh-indexer} | 24 +++--- .../packages/src/common/scripts/postinst | 52 ++++++------- .../packages/src/common/scripts/postrm | 30 +++---- .../packages/src/common/scripts/posttrans | 8 +- .../packages/src/common/scripts/preinst | 38 ++++----- .../packages/src/common/scripts/prerm | 22 +++--- .../src/common/systemd/opensearch.conf | 1 - .../{opensearch.conf => wazuh-indexer.conf} | 0 .../src/common/systemd/systemd-entrypoint | 4 +- .../src/common/systemd/wazuh-indexer.conf | 1 + ...ensearch.service => wazuh-indexer.service} | 22 +++--- .../deb/init.d/{opensearch => wazuh-indexer} | 28 +++---- .../packages/src/deb/lintian/opensearch | 46 ----------- .../packages/src/deb/lintian/wazuh-indexer | 46 +++++++++++ .../rpm/init.d/{opensearch => wazuh-indexer} | 24 +++--- scripts/build.sh | 2 +- settings.gradle | 2 +- 26 files changed, 256 insertions(+), 256 deletions(-) rename distribution/packages/src/common/env/{opensearch => wazuh-indexer} (68%) delete mode 100644 distribution/packages/src/common/systemd/opensearch.conf rename distribution/packages/src/common/systemd/sysctl/{opensearch.conf => wazuh-indexer.conf} (100%) create mode 100644 distribution/packages/src/common/systemd/wazuh-indexer.conf rename distribution/packages/src/common/systemd/{opensearch.service => wazuh-indexer.service} (73%) rename distribution/packages/src/deb/init.d/{opensearch => wazuh-indexer} (79%) delete mode 100644 distribution/packages/src/deb/lintian/opensearch create mode 100644 distribution/packages/src/deb/lintian/wazuh-indexer rename distribution/packages/src/rpm/init.d/{opensearch => wazuh-indexer} (80%) diff --git a/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionArchiveSetupPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionArchiveSetupPlugin.java index 7ab91448252f2..fa0a3c2a83970 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionArchiveSetupPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionArchiveSetupPlugin.java @@ -156,7 +156,7 @@ private void configureGeneralTaskDefaults(Project project) { project.getTasks().withType(AbstractArchiveTask.class).configureEach(t -> { String subdir = archiveTaskToSubprojectName(t.getName()); t.getDestinationDirectory().set(project.file(subdir + "/build/distributions")); - t.getArchiveBaseName().set("opensearch-min"); + t.getArchiveBaseName().set("wazuh-indexer-min"); }); } diff --git a/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionBwcSetupPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionBwcSetupPlugin.java index 6892af1b17f97..3236508cf4f01 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionBwcSetupPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionBwcSetupPlugin.java @@ -123,7 +123,7 @@ private void registerBwcArtifacts(Project bwcProject, DistributionProject distri String expandedDistConfiguration = "expanded-" + projectName; bwcProject.getConfigurations().create(expandedDistConfiguration); bwcProject.getArtifacts().add(expandedDistConfiguration, distributionProject.getExpandedDistDirectory(), artifact -> { - artifact.setName("opensearch"); + artifact.setName("wazuh-indexer"); artifact.builtBy(buildBwcTask); artifact.setType("directory"); }); @@ -132,7 +132,7 @@ private void registerBwcArtifacts(Project bwcProject, DistributionProject distri private void registerDistributionArchiveArtifact(Project bwcProject, DistributionProject distributionProject, String buildBwcTask) { String artifactFileName = distributionProject.getDistFile().getName(); - String artifactName = "opensearch"; + String artifactName = "wazuh-indexer"; String suffix = artifactFileName.endsWith("tar.gz") ? "tar.gz" : artifactFileName.substring(artifactFileName.length() - 3); int archIndex = artifactFileName.indexOf("x64"); @@ -248,12 +248,12 @@ private static class DistributionProject { if (version.onOrAfter("1.1.0")) { this.distFile = new File( checkoutDir, - baseDir + "/" + name + "/build/distributions/opensearch-min-" + version + "-SNAPSHOT" + classifier + "." + extension + baseDir + "/" + name + "/build/distributions/wazuh-indexer-min-" + version + "-SNAPSHOT" + classifier + "." + extension ); } else { this.distFile = new File( checkoutDir, - baseDir + "/" + name + "/build/distributions/opensearch-" + version + "-SNAPSHOT" + classifier + "." + extension + baseDir + "/" + name + "/build/distributions/wazuh-indexer-" + version + "-SNAPSHOT" + classifier + "." + extension ); } // we only ported this down to the 7.x branch. diff --git a/distribution/build.gradle b/distribution/build.gradle index bbbef40f51c57..f7923ce0aa6b9 100644 --- a/distribution/build.gradle +++ b/distribution/build.gradle @@ -523,18 +523,18 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { *
path.conf
*
The default directory from which to load configuration. This is used in * the packaging scripts, but in that context it is always - * /etc/opensearch. Its also used in bin/opensearch-plugin, where it is - * /etc/opensearch for the os packages but $OPENSEARCH_HOME/config otherwise.
+ * /etc/wazuh-indexer. Its also used in bin/opensearch-plugin, where it is + * /etc/wazuh-indexer for the os packages but $OPENSEARCH_HOME/config otherwise. *
path.env
*
The env file sourced before bin/opensearch to set environment - * variables. Think /etc/defaults/opensearch.
+ * variables. Think /etc/defaults/wazuh-indexer. *
heap.min and heap.max
*
Default min and max heap
*
scripts.footer
*
Footer appended to control scripts embedded in the distribution that is * (almost) entirely there for cosmetic reasons.
*
stopping.timeout
- *
RPM's init script needs to wait for opensearch to stop before + *
RPM's init script needs to wait for wazuh-indexer to stop before * returning from stop and it needs a maximum time to wait. This is it. One * day. DEB retries forever.
* @@ -542,8 +542,8 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { subprojects { ext.expansionsForDistribution = { distributionType, jdk -> final String defaultHeapSize = "1g" - final String packagingPathData = "path.data: /var/lib/opensearch" - final String pathLogs = "/var/log/opensearch" + final String packagingPathData = "path.data: /var/lib/wazuh-indexer" + final String pathLogs = "/var/log/wazuh-indexer" final String packagingPathLogs = "path.logs: ${pathLogs}" final String packagingLoggc = "${pathLogs}/gc.log" @@ -558,8 +558,8 @@ subprojects { 'project.version': version, 'path.conf': [ - 'deb': '/etc/opensearch', - 'rpm': '/etc/opensearch', + 'deb': '/etc/wazuh-indexer', + 'rpm': '/etc/wazuh-indexer', 'def': '"$OPENSEARCH_HOME"/config' ], 'path.data': [ @@ -568,15 +568,15 @@ subprojects { 'def': '#path.data: /path/to/data' ], 'path.env': [ - 'deb': '/etc/default/opensearch', - 'rpm': '/etc/sysconfig/opensearch', + 'deb': '/etc/default/wazuh-indexer', + 'rpm': '/etc/sysconfig/wazuh-indexer', /* There isn't one of these files for tar or zip but its important to make an empty string here so the script can properly skip it. */ 'def': 'if [ -z "$OPENSEARCH_PATH_CONF" ]; then OPENSEARCH_PATH_CONF="$OPENSEARCH_HOME"/config; done', ], 'source.path.env': [ - 'deb': 'source /etc/default/opensearch', - 'rpm': 'source /etc/sysconfig/opensearch', + 'deb': 'source /etc/default/wazuh-indexer', + 'rpm': 'source /etc/sysconfig/wazuh-indexer', 'def': 'if [ -z "$OPENSEARCH_PATH_CONF" ]; then OPENSEARCH_PATH_CONF="$OPENSEARCH_HOME"/config; fi', ], 'path.logs': [ @@ -594,14 +594,14 @@ subprojects { 'heap.max': defaultHeapSize, 'heap.dump.path': [ - 'deb': "-XX:HeapDumpPath=/var/lib/opensearch", - 'rpm': "-XX:HeapDumpPath=/var/lib/opensearch", + 'deb': "-XX:HeapDumpPath=/var/lib/wazuh-indexer", + 'rpm': "-XX:HeapDumpPath=/var/lib/wazuh-indexer", 'def': "-XX:HeapDumpPath=data" ], 'error.file': [ - 'deb': "-XX:ErrorFile=/var/log/opensearch/hs_err_pid%p.log", - 'rpm': "-XX:ErrorFile=/var/log/opensearch/hs_err_pid%p.log", + 'deb': "-XX:ErrorFile=/usr/share/wazuh-indexer/hs_err_pid%p.log", + 'rpm': "-XX:ErrorFile=/usr/share/wazuh-indexer/hs_err_pid%p.log", 'def': "-XX:ErrorFile=logs/hs_err_pid%p.log" ], diff --git a/distribution/docker/build.gradle b/distribution/docker/build.gradle index ad8678c608b54..f0641aa78d617 100644 --- a/distribution/docker/build.gradle +++ b/distribution/docker/build.gradle @@ -60,7 +60,7 @@ ext.expansions = { Architecture architecture, DockerBase base, boolean local -> classifier = "linux-\$(arch)" } - final String opensearch = "opensearch-min-${VersionProperties.getOpenSearch()}-${classifier}.tar.gz" + final String opensearch = "wazuh-indexer-min-${VersionProperties.getOpenSearch()}-${classifier}.tar.gz" /* Both the following Dockerfile commands put the resulting artifact at * the same location, regardless of classifier, so that the commands that diff --git a/distribution/docker/docker-compose.yml b/distribution/docker/docker-compose.yml index 5ed2b159ffe2b..bb4eb53cd49d2 100644 --- a/distribution/docker/docker-compose.yml +++ b/distribution/docker/docker-compose.yml @@ -18,7 +18,7 @@ services: - node.store.allow_mmap=false volumes: - ./build/repo:/tmp/opensearch-repo - - ./build/logs/1:/usr/share/opensearch/logs + - ./build/logs/1:/usr/share/wazuh-indexer/logs ports: - "9200" ulimits: @@ -42,7 +42,7 @@ services: - node.store.allow_mmap=false volumes: - ./build/repo:/tmp/opensearch-repo - - ./build/logs/2:/usr/share/opensearch/logs + - ./build/logs/2:/usr/share/wazuh-indexer/logs ports: - "9200" ulimits: diff --git a/distribution/docker/docker-test-entrypoint.sh b/distribution/docker/docker-test-entrypoint.sh index 1cfc62f6b02b0..6ff8306868a47 100755 --- a/distribution/docker/docker-test-entrypoint.sh +++ b/distribution/docker/docker-test-entrypoint.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -e -o pipefail -cd /usr/share/opensearch/bin/ +cd /usr/share/wazuh-indexer/bin/ -/usr/local/bin/docker-entrypoint.sh | tee > /usr/share/opensearch/logs/console.log +/usr/local/bin/docker-entrypoint.sh | tee > /usr/share/wazuh-indexer/logs/console.log diff --git a/distribution/docker/src/docker/Dockerfile b/distribution/docker/src/docker/Dockerfile index c980217b0b8dc..268af870ebae9 100644 --- a/distribution/docker/src/docker/Dockerfile +++ b/distribution/docker/src/docker/Dockerfile @@ -40,13 +40,13 @@ RUN set -eux ; \\ mv \${tini_bin} /tini ; \\ chmod +x /tini -RUN mkdir /usr/share/opensearch -WORKDIR /usr/share/opensearch +RUN mkdir /usr/share/wazuh-indexer +WORKDIR /usr/share/wazuh-indexer ${source_opensearch} RUN tar zxf /opt/opensearch.tar.gz --strip-components=1 -RUN sed -i -e 's/OPENSEARCH_DISTRIBUTION_TYPE=tar/OPENSEARCH_DISTRIBUTION_TYPE=docker/' /usr/share/opensearch/bin/opensearch-env +RUN sed -i -e 's/OPENSEARCH_DISTRIBUTION_TYPE=tar/OPENSEARCH_DISTRIBUTION_TYPE=docker/' /usr/share/wazuh-indexer/bin/opensearch-env RUN mkdir -p config config/jvm.options.d data logs RUN chmod 0775 config config/jvm.options.d data logs COPY config/opensearch.yml config/log4j2.properties config/ @@ -74,27 +74,27 @@ RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-* && \\ done; \\ (exit \$exit_code) -RUN groupadd -g 1000 opensearch && \\ - adduser -u 1000 -g 1000 -G 0 -d /usr/share/opensearch opensearch && \\ - chmod 0775 /usr/share/opensearch && \\ - chown -R 1000:0 /usr/share/opensearch +RUN groupadd -g 1000 wazuh-indexer && \\ + adduser -u 1000 -g 1000 -G 0 -d /usr/share/wazuh-indexer wazuh-indexer && \\ + chmod 0775 /usr/share/wazuh-indexer && \\ + chown -R 1000:0 /usr/share/wazuh-indexer -WORKDIR /usr/share/opensearch -COPY --from=builder --chown=1000:0 /usr/share/opensearch /usr/share/opensearch +WORKDIR /usr/share/wazuh-indexer +COPY --from=builder --chown=1000:0 /usr/share/wazuh-indexer /usr/share/wazuh-indexer COPY --from=builder --chown=0:0 /tini /tini # Replace OpenJDK's built-in CA certificate keystore with the one from the OS # vendor. The latter is superior in several ways. # REF: https://github.com/elastic/elasticsearch-docker/issues/171 -RUN ln -sf /etc/pki/ca-trust/extracted/java/cacerts /usr/share/opensearch/jdk/lib/security/cacerts +RUN ln -sf /etc/pki/ca-trust/extracted/java/cacerts /usr/share/wazuh-indexer/jdk/lib/security/cacerts -ENV PATH /usr/share/opensearch/bin:\$PATH +ENV PATH /usr/share/wazuh-indexer/bin:\$PATH COPY bin/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh # The JDK's directories' permissions don't allow `java` to be executed under a different # group to the default. Fix this. -RUN find /usr/share/opensearch/jdk -type d -exec chmod 0755 '{}' \\; && \\ +RUN find /usr/share/wazuh-indexer/jdk -type d -exec chmod 0755 '{}' \\; && \\ chmod g=u /etc/passwd && \\ chmod 0775 /usr/local/bin/docker-entrypoint.sh diff --git a/distribution/docker/src/docker/bin/docker-entrypoint.sh b/distribution/docker/src/docker/bin/docker-entrypoint.sh index 33c68afce0bfc..e24c5cb6a7436 100644 --- a/distribution/docker/src/docker/bin/docker-entrypoint.sh +++ b/distribution/docker/src/docker/bin/docker-entrypoint.sh @@ -46,7 +46,7 @@ fi # This is also sourced in opensearch-env, and is only needed here # as well because we use ELASTIC_PASSWORD below. Sourcing this script # is idempotent. -source /usr/share/opensearch/bin/opensearch-env-from-file +source /usr/share/wazuh-indexer/bin/opensearch-env-from-file if [[ -f bin/opensearch-users ]]; then # Check for the ELASTIC_PASSWORD environment variable to set the @@ -56,7 +56,7 @@ if [[ -f bin/opensearch-users ]]; then # enabled, but we have no way of knowing which node we are yet. We'll just # honor the variable if it's present. if [[ -n "$ELASTIC_PASSWORD" ]]; then - [[ -f /usr/share/opensearch/config/opensearch.keystore ]] || (run_as_other_user_if_needed opensearch-keystore create) + [[ -f /usr/share/wazuh-indexer/config/opensearch.keystore ]] || (run_as_other_user_if_needed opensearch-keystore create) if ! (run_as_other_user_if_needed opensearch-keystore has-passwd --silent) ; then # keystore is unencrypted if ! (run_as_other_user_if_needed opensearch-keystore list | grep -q '^bootstrap.password$'); then @@ -76,8 +76,8 @@ fi if [[ "$(id -u)" == "0" ]]; then # If requested and running as root, mutate the ownership of bind-mounts if [[ -n "$TAKE_FILE_OWNERSHIP" ]]; then - chown -R 1000:0 /usr/share/opensearch/{data,logs} + chown -R 1000:0 /usr/share/wazuh-indexer/{data,logs} fi fi -run_as_other_user_if_needed /usr/share/opensearch/bin/opensearch <<<"$KEYSTORE_PASSWORD" +run_as_other_user_if_needed /usr/share/wazuh-indexer/bin/opensearch <<<"$KEYSTORE_PASSWORD" diff --git a/distribution/packages/build.gradle b/distribution/packages/build.gradle index 394d47639fb0a..56e2afbdbf659 100644 --- a/distribution/packages/build.gradle +++ b/distribution/packages/build.gradle @@ -58,8 +58,8 @@ import java.util.regex.Pattern * The following commands are useful when it comes to check the user/group * and files permissions set within the RPM and DEB packages: * - * rpm -qlp --dump path/to/opensearch.rpm - * dpkg -c path/to/opensearch.deb + * rpm -qlp --dump path/to/wazuh-indexer.rpm + * dpkg -c path/to/wazuh-indexer.deb */ plugins { @@ -79,20 +79,20 @@ void addProcessFilesTask(String type, boolean jdk) { MavenFilteringHack.filter(it, expansionsForDistribution(type, jdk)) } - into('etc/opensearch') { + into('etc/wazuh-indexer') { with configFiles(type, jdk) } MavenFilteringHack.filter(it, expansionsForDistribution(type, jdk)) doLast { // create empty dirs, we set the permissions when configuring the packages - mkdir "${packagingFiles}/var/log/opensearch" - mkdir "${packagingFiles}/var/lib/opensearch" - mkdir "${packagingFiles}/usr/share/opensearch/plugins" + mkdir "${packagingFiles}/var/log/wazuh-indexer" + mkdir "${packagingFiles}/var/lib/wazuh-indexer" + mkdir "${packagingFiles}/usr/share/wazuh-indexer/plugins" - // bare empty dir for /etc/opensearch and /etc/opensearch/jvm.options.d - mkdir "${packagingFiles}/opensearch" - mkdir "${packagingFiles}/opensearch/jvm.options.d" + // bare empty dir for /etc/wazuh-indexer and /etc/wazuh-indexer/jvm.options.d + mkdir "${packagingFiles}/wazuh-indexer" + mkdir "${packagingFiles}/wazuh-indexer/jvm.options.d" } } } @@ -111,7 +111,7 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) { OS.current().equals(OS.WINDOWS) == false } dependsOn "process'${jdk ? '' : 'NoJdk'}${type.capitalize()}Files" - packageName "opensearch" + packageName "wazuh-indexer" if (type == 'deb') { if (architecture == 'x64') { arch('amd64') @@ -154,7 +154,7 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) { // top level "into" directive is not inherited from ospackage for some reason, so we must // specify it again explicitly for copying common files - into('/usr/share/opensearch') { + into('/usr/share/wazuh-indexer') { into('bin') { with binFiles(type, jdk) } @@ -199,7 +199,7 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) { } } else { assert type == 'rpm' - into('/usr/share/opensearch') { + into('/usr/share/wazuh-indexer') { from(rootProject.file('licenses')) { include 'APACHE-LICENSE-2.0.txt' rename { 'LICENSE.txt' } @@ -209,23 +209,23 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) { } // ========= config files ========= - configurationFile '/etc/opensearch/opensearch.yml' - configurationFile '/etc/opensearch/jvm.options' - configurationFile '/etc/opensearch/log4j2.properties' + configurationFile '/etc/wazuh-indexer/opensearch.yml' + configurationFile '/etc/wazuh-indexer/jvm.options' + configurationFile '/etc/wazuh-indexer/log4j2.properties' from("${packagingFiles}") { dirMode 0750 into('/etc') - permissionGroup 'opensearch' + permissionGroup 'wazuh-indexer' includeEmptyDirs true createDirectoryEntry true - include("opensearch") // empty dir, just to add directory entry - include("opensearch/jvm.options.d") // empty dir, just to add directory entry + include("wazuh-indexer") // empty dir, just to add directory entry + include("wazuh-indexer/jvm.options.d") // empty dir, just to add directory entry } - from("${packagingFiles}/etc/opensearch") { - into('/etc/opensearch') + from("${packagingFiles}/etc/wazuh-indexer") { + into('/etc/wazuh-indexer') dirMode 0750 fileMode 0660 - permissionGroup 'opensearch' + permissionGroup 'wazuh-indexer' includeEmptyDirs true createDirectoryEntry true fileType CONFIG | NOREPLACE @@ -234,37 +234,37 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) { configurationFile envFile into(new File(envFile).getParent()) { fileType CONFIG | NOREPLACE - permissionGroup 'opensearch' + permissionGroup 'wazuh-indexer' fileMode 0660 - from "${packagingFiles}/env/opensearch" + from "${packagingFiles}/env/wazuh-indexer" } // ========= systemd ========= into('/usr/lib/tmpfiles.d') { - from "${packagingFiles}/systemd/opensearch.conf" + from "${packagingFiles}/systemd/wazuh-indexer.conf" fileMode 0644 } into('/usr/lib/systemd/system') { fileType CONFIG | NOREPLACE - from "${packagingFiles}/systemd/opensearch.service" + from "${packagingFiles}/systemd/wazuh-indexer.service" fileMode 0644 } into('/usr/lib/sysctl.d') { fileType CONFIG | NOREPLACE - from "${packagingFiles}/systemd/sysctl/opensearch.conf" + from "${packagingFiles}/systemd/sysctl/wazuh-indexer.conf" fileMode 0644 } - into('/usr/share/opensearch/bin') { + into('/usr/share/wazuh-indexer/bin') { from "${packagingFiles}/systemd/systemd-entrypoint" fileMode 0755 } // ========= sysV init ========= - configurationFile '/etc/init.d/opensearch' + configurationFile '/etc/init.d/wazuh-indexer' into('/etc/init.d') { fileMode 0750 fileType CONFIG | NOREPLACE - from "${packagingFiles}/init.d/opensearch" + from "${packagingFiles}/init.d/wazuh-indexer" } // ========= empty dirs ========= @@ -281,11 +281,11 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) { dirMode mode } } - copyEmptyDir('/var/log/opensearch', 'opensearch', 'opensearch', 0750) - copyEmptyDir('/var/lib/opensearch', 'opensearch', 'opensearch', 0750) - copyEmptyDir('/usr/share/opensearch/plugins', 'root', 'root', 0755) + copyEmptyDir('/var/log/wazuh-indexer', 'wazuh-indexer', 'wazuh-indexer', 0750) + copyEmptyDir('/var/lib/wazuh-indexer', 'wazuh-indexer', 'wazuh-indexer', 0750) + copyEmptyDir('/usr/share/wazuh-indexer/plugins', 'root', 'root', 0755) - into '/usr/share/opensearch' + into '/usr/share/wazuh-indexer' with noticeFile(jdk) } } @@ -319,7 +319,7 @@ ospackage { user 'root' permissionGroup 'root' - into '/usr/share/opensearch' + into '/usr/share/wazuh-indexer' } Closure commonDebConfig(boolean jdk, String architecture) { @@ -340,7 +340,7 @@ Closure commonDebConfig(boolean jdk, String architecture) { requires 'adduser' into('/usr/share/lintian/overrides') { - from('src/deb/lintian/opensearch') + from('src/deb/lintian/wazuh-indexer') fileMode 0644 } } @@ -382,7 +382,7 @@ Closure commonRpmConfig(boolean jdk, String architecture) { vendor 'OpenSearch' // TODO ospackage doesn't support icon but we used to have one - // without this the rpm will have parent dirs of any files we copy in, eg /etc/opensearch + // without this the rpm will have parent dirs of any files we copy in, eg /etc/wazuh-indexer addParentDirs false } } @@ -477,7 +477,7 @@ subprojects { Path copyrightPath String expectedLicense String licenseFilename - copyrightPath = packageExtractionDir.toPath().resolve("usr/share/doc/opensearch/copyright") + copyrightPath = packageExtractionDir.toPath().resolve("usr/share/doc/wazuh-indexer/copyright") expectedLicense = "ASL-2.0" licenseFilename = "APACHE-LICENSE-2.0.txt" final List header = Arrays.asList("Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/", @@ -496,7 +496,7 @@ subprojects { doLast { String licenseFilename = "APACHE-LICENSE-2.0.txt" final List licenseLines = Files.readAllLines(rootDir.toPath().resolve("licenses/" + licenseFilename)) - final Path licensePath = packageExtractionDir.toPath().resolve("usr/share/opensearch/LICENSE.txt") + final Path licensePath = packageExtractionDir.toPath().resolve("usr/share/wazuh-indexer/LICENSE.txt") assertLinesInFile(licensePath, licenseLines) } } @@ -509,7 +509,7 @@ subprojects { } doLast { final List noticeLines = Arrays.asList("OpenSearch (https://opensearch.org/)", "Copyright OpenSearch Contributors") - final Path noticePath = packageExtractionDir.toPath().resolve("usr/share/opensearch/NOTICE.txt") + final Path noticePath = packageExtractionDir.toPath().resolve("usr/share/wazuh-indexer/NOTICE.txt") assertLinesInFile(noticePath, noticeLines) } } diff --git a/distribution/packages/src/common/env/opensearch b/distribution/packages/src/common/env/wazuh-indexer similarity index 68% rename from distribution/packages/src/common/env/opensearch rename to distribution/packages/src/common/env/wazuh-indexer index 198bcfde90c4c..1b6f33db8a34b 100644 --- a/distribution/packages/src/common/env/opensearch +++ b/distribution/packages/src/common/env/wazuh-indexer @@ -1,19 +1,19 @@ ################################ -# OpenSearch +# wazuh-indexer ################################ -# OpenSearch home directory -#OPENSEARCH_HOME=/usr/share/opensearch +# wazuh-indexer home directory +#OPENSEARCH_HOME=/usr/share/wazuh-indexer -# OpenSearch Java path +# wazuh-indexer Java path #OPENSEARCH_JAVA_HOME= -# OpenSearch configuration directory +# wazuh-indexer configuration directory # Note: this setting will be shared with command-line tools OPENSEARCH_PATH_CONF=${path.conf} -# OpenSearch PID directory -#PID_DIR=/var/run/opensearch +# wazuh-indexer PID directory +#PID_DIR=/var/run/wazuh-indexer # Additional Java OPTS #OPENSEARCH_JAVA_OPTS= @@ -22,12 +22,12 @@ OPENSEARCH_PATH_CONF=${path.conf} #RESTART_ON_UPGRADE=true ################################ -# OpenSearch service +# wazuh-indexer service ################################ # SysV init.d # -# The number of seconds to wait before checking if OpenSearch started successfully as a daemon process +# The number of seconds to wait before checking if wazuh-indexer started successfully as a daemon process OPENSEARCH_STARTUP_SLEEP_TIME=5 ################################ @@ -36,17 +36,17 @@ OPENSEARCH_STARTUP_SLEEP_TIME=5 # Specifies the maximum file descriptor number that can be opened by this process # When using Systemd, this setting is ignored and the LimitNOFILE defined in -# /usr/lib/systemd/system/opensearch.service takes precedence +# /usr/lib/systemd/system/wazuh-indexer.service takes precedence #MAX_OPEN_FILES=65535 # The maximum number of bytes of memory that may be locked into RAM # Set to "unlimited" if you use the 'bootstrap.memory_lock: true' option # in opensearch.yml. # When using systemd, LimitMEMLOCK must be set in a unit file such as -# /etc/systemd/system/opensearch.service.d/override.conf. +# /etc/systemd/system/wazuh-indexer.service.d/override.conf. #MAX_LOCKED_MEMORY=unlimited # Maximum number of VMA (Virtual Memory Areas) a process can own # When using Systemd, this setting is ignored and the 'vm.max_map_count' -# property is set at boot time in /usr/lib/sysctl.d/opensearch.conf +# property is set at boot time in /usr/lib/sysctl.d/wazuh-indexer.conf #MAX_MAP_COUNT=262144 diff --git a/distribution/packages/src/common/scripts/postinst b/distribution/packages/src/common/scripts/postinst index 308e86b850247..5c1e942f87e18 100644 --- a/distribution/packages/src/common/scripts/postinst +++ b/distribution/packages/src/common/scripts/postinst @@ -50,52 +50,52 @@ case "$1" in ;; esac -# to pick up /usr/lib/sysctl.d/opensearch.conf +# to pick up /usr/lib/sysctl.d/wazuh-indexer.conf if command -v systemctl > /dev/null; then systemctl restart systemd-sysctl.service || true fi if [ "x$IS_UPGRADE" != "xtrue" ]; then if command -v systemctl >/dev/null; then - echo "### NOT starting on installation, please execute the following statements to configure opensearch service to start automatically using systemd" + echo "### NOT starting on installation, please execute the following statements to configure wazuh-indexer service to start automatically using systemd" echo " sudo systemctl daemon-reload" - echo " sudo systemctl enable opensearch.service" - echo "### You can start opensearch service by executing" - echo " sudo systemctl start opensearch.service" + echo " sudo systemctl enable wazuh-indexer.service" + echo "### You can start wazuh-indexer service by executing" + echo " sudo systemctl start wazuh-indexer.service" elif command -v chkconfig >/dev/null; then - echo "### NOT starting on installation, please execute the following statements to configure opensearch service to start automatically using chkconfig" - echo " sudo chkconfig --add opensearch" - echo "### You can start opensearch service by executing" - echo " sudo service opensearch start" + echo "### NOT starting on installation, please execute the following statements to configure wazuh-indexer service to start automatically using chkconfig" + echo " sudo chkconfig --add wazuh-indexer" + echo "### You can start wazuh-indexer service by executing" + echo " sudo service wazuh-indexer start" elif command -v update-rc.d >/dev/null; then - echo "### NOT starting on installation, please execute the following statements to configure opensearch service to start automatically using chkconfig" - echo " sudo update-rc.d opensearch defaults 95 10" - echo "### You can start opensearch service by executing" - echo " sudo /etc/init.d/opensearch start" + echo "### NOT starting on installation, please execute the following statements to configure wazuh-indexer service to start automatically using chkconfig" + echo " sudo update-rc.d wazuh-indexer defaults 95 10" + echo "### You can start wazuh-indexer service by executing" + echo " sudo /etc/init.d/wazuh-indexer start" fi elif [ "$RESTART_ON_UPGRADE" = "true" ]; then - echo -n "Restarting opensearch service..." + echo -n "Restarting wazuh-indexer service..." if command -v systemctl >/dev/null; then systemctl daemon-reload - systemctl restart opensearch.service || true + systemctl restart wazuh-indexer.service || true - elif [ -x /etc/init.d/opensearch ]; then + elif [ -x /etc/init.d/wazuh-indexer ]; then if command -v invoke-rc.d >/dev/null; then - invoke-rc.d opensearch stop || true - invoke-rc.d opensearch start || true + invoke-rc.d wazuh-indexer stop || true + invoke-rc.d wazuh-indexer start || true else - /etc/init.d/opensearch restart || true + /etc/init.d/wazuh-indexer restart || true fi # older suse linux distributions do not ship with systemd # but do not have an /etc/init.d/ directory - # this tries to start the opensearch service on these + # this tries to start the wazuh-indexer service on these # as well without failing this script - elif [ -x /etc/rc.d/init.d/opensearch ] ; then - /etc/rc.d/init.d/opensearch restart || true + elif [ -x /etc/rc.d/init.d/wazuh-indexer ] ; then + /etc/rc.d/init.d/wazuh-indexer restart || true fi echo " OK" fi @@ -103,16 +103,16 @@ fi # the equivalent code for rpm is in posttrans if [ "$PACKAGE" = "deb" ]; then if [ ! -f "${OPENSEARCH_PATH_CONF}"/opensearch.keystore ]; then - /usr/share/opensearch/bin/opensearch-keystore create - chown root:opensearch "${OPENSEARCH_PATH_CONF}"/opensearch.keystore + /usr/share/wazuh-indexer/bin/opensearch-keystore create + chown root:wazuh-indexer "${OPENSEARCH_PATH_CONF}"/opensearch.keystore chmod 660 "${OPENSEARCH_PATH_CONF}"/opensearch.keystore md5sum "${OPENSEARCH_PATH_CONF}"/opensearch.keystore > "${OPENSEARCH_PATH_CONF}"/.opensearch.keystore.initial_md5sum else - if /usr/share/opensearch/bin/opensearch-keystore has-passwd --silent ; then + if /usr/share/wazuh-indexer/bin/opensearch-keystore has-passwd --silent ; then echo "### Warning: unable to upgrade encrypted keystore" 1>&2 echo " Please run opensearch-keystore upgrade and enter password" 1>&2 else - /usr/share/opensearch/bin/opensearch-keystore upgrade + /usr/share/wazuh-indexer/bin/opensearch-keystore upgrade fi fi fi diff --git a/distribution/packages/src/common/scripts/postrm b/distribution/packages/src/common/scripts/postrm index 75eded92a8e41..70871f9ae3004 100644 --- a/distribution/packages/src/common/scripts/postrm +++ b/distribution/packages/src/common/scripts/postrm @@ -32,7 +32,7 @@ case "$1" in REMOVE_JVM_OPTIONS_DIRECTORY=true REMOVE_USER_AND_GROUP=true ;; - failed-upgrade|abort-install|abort-upgrade|disappear|upgrade|disappear) + failed-upgrade|abort-install|abort-upgrade|disappear|upgrade) ;; # RedHat #################################################### @@ -53,34 +53,34 @@ esac if [ "$REMOVE_DIRS" = "true" ]; then - if [ -d /var/log/opensearch ]; then + if [ -d /var/log/wazuh-indexer ]; then echo -n "Deleting log directory..." - rm -rf /var/log/opensearch + rm -rf /var/log/wazuh-indexer echo " OK" fi - if [ -d /usr/share/opensearch/plugins ]; then + if [ -d /usr/share/wazuh-indexer/plugins ]; then echo -n "Deleting plugins directory..." - rm -rf /usr/share/opensearch/plugins + rm -rf /usr/share/wazuh-indexer/plugins echo " OK" fi # plugins may have contained bin files - if [ -d /usr/share/opensearch/bin ]; then + if [ -d /usr/share/wazuh-indexer/bin ]; then echo -n "Deleting plugin bin directories..." - rm -rf /usr/share/opensearch/bin + rm -rf /usr/share/wazuh-indexer/bin echo " OK" fi - if [ -d /var/run/opensearch ]; then + if [ -d /var/run/wazuh-indexer ]; then echo -n "Deleting PID directory..." - rm -rf /var/run/opensearch + rm -rf /var/run/wazuh-indexer echo " OK" fi # Delete the data directory if and only if empty - if [ -d /var/lib/opensearch ]; then - rmdir --ignore-fail-on-non-empty /var/lib/opensearch + if [ -d /var/lib/wazuh-indexer ]; then + rmdir --ignore-fail-on-non-empty /var/lib/wazuh-indexer fi # delete the jvm.options.d directory if and only if empty @@ -105,12 +105,12 @@ if [ "$REMOVE_DIRS" = "true" ]; then fi if [ "$REMOVE_USER_AND_GROUP" = "true" ]; then - if id opensearch > /dev/null 2>&1 ; then - userdel opensearch + if id wazuh-indexer > /dev/null 2>&1 ; then + userdel wazuh-indexer fi - if getent group opensearch > /dev/null 2>&1 ; then - groupdel opensearch + if getent group wazuh-indexer > /dev/null 2>&1 ; then + groupdel wazuh-indexer fi fi diff --git a/distribution/packages/src/common/scripts/posttrans b/distribution/packages/src/common/scripts/posttrans index 3b3d4faa766ee..bf6c844ab82bb 100644 --- a/distribution/packages/src/common/scripts/posttrans +++ b/distribution/packages/src/common/scripts/posttrans @@ -6,16 +6,16 @@ fi export OPENSEARCH_PATH_CONF=${OPENSEARCH_PATH_CONF:-${path.conf}} if [ ! -f "${OPENSEARCH_PATH_CONF}"/opensearch.keystore ]; then - /usr/share/opensearch/bin/opensearch-keystore create - chown root:opensearch "${OPENSEARCH_PATH_CONF}"/opensearch.keystore + /usr/share/wazuh-indexer/bin/opensearch-keystore create + chown root:wazuh-indexer "${OPENSEARCH_PATH_CONF}"/opensearch.keystore chmod 660 "${OPENSEARCH_PATH_CONF}"/opensearch.keystore md5sum "${OPENSEARCH_PATH_CONF}"/opensearch.keystore > "${OPENSEARCH_PATH_CONF}"/.opensearch.keystore.initial_md5sum else - if /usr/share/opensearch/bin/opensearch-keystore has-passwd --silent ; then + if /usr/share/wazuh-indexer/bin/opensearch-keystore has-passwd --silent ; then echo "### Warning: unable to upgrade encrypted keystore" 1>&2 echo " Please run opensearch-keystore upgrade and enter password" 1>&2 else - /usr/share/opensearch/bin/opensearch-keystore upgrade + /usr/share/wazuh-indexer/bin/opensearch-keystore upgrade fi fi diff --git a/distribution/packages/src/common/scripts/preinst b/distribution/packages/src/common/scripts/preinst index 31e5b803b1604..75d93c73fccf1 100644 --- a/distribution/packages/src/common/scripts/preinst +++ b/distribution/packages/src/common/scripts/preinst @@ -29,24 +29,24 @@ case "$1" in # Debian #################################################### install|upgrade) - # Create opensearch group if not existing - if ! getent group opensearch > /dev/null 2>&1 ; then - echo -n "Creating opensearch group..." - addgroup --quiet --system opensearch + # Create wazuh-indexer group if not existing + if ! getent group wazuh-indexer > /dev/null 2>&1 ; then + echo -n "Creating wazuh-indexer group..." + addgroup --quiet --system wazuh-indexer echo " OK" fi - # Create opensearch user if not existing - if ! id opensearch > /dev/null 2>&1 ; then - echo -n "Creating opensearch user..." + # Create wazuh-indexer user if not existing + if ! id wazuh-indexer > /dev/null 2>&1 ; then + echo -n "Creating wazuh-indexer user..." adduser --quiet \ --system \ --no-create-home \ --home /nonexistent \ - --ingroup opensearch \ + --ingroup wazuh-indexer \ --disabled-password \ --shell /bin/false \ - opensearch + wazuh-indexer echo " OK" fi ;; @@ -56,23 +56,23 @@ case "$1" in # RedHat #################################################### 1|2) - # Create opensearch group if not existing - if ! getent group opensearch > /dev/null 2>&1 ; then - echo -n "Creating opensearch group..." - groupadd -r opensearch + # Create wazuh-indexer group if not existing + if ! getent group wazuh-indexer > /dev/null 2>&1 ; then + echo -n "Creating wazuh-indexer group..." + groupadd -r wazuh-indexer echo " OK" fi - # Create opensearch user if not existing - if ! id opensearch > /dev/null 2>&1 ; then - echo -n "Creating opensearch user..." + # Create wazuh-indexer user if not existing + if ! id wazuh-indexer > /dev/null 2>&1 ; then + echo -n "Creating wazuh-indexer user..." useradd --system \ --no-create-home \ --home-dir /nonexistent \ - --gid opensearch \ + --gid wazuh-indexer \ --shell /sbin/nologin \ - --comment "opensearch user" \ - opensearch + --comment "wazuh-indexer user" \ + wazuh-indexer echo " OK" fi ;; diff --git a/distribution/packages/src/common/scripts/prerm b/distribution/packages/src/common/scripts/prerm index dd3cadd383dbe..7609abb950339 100644 --- a/distribution/packages/src/common/scripts/prerm +++ b/distribution/packages/src/common/scripts/prerm @@ -51,23 +51,23 @@ esac # Stops the service if [ "$STOP_REQUIRED" = "true" ]; then - echo -n "Stopping opensearch service..." + echo -n "Stopping wazuh-indexer service..." if command -v systemctl >/dev/null; then - systemctl --no-reload stop opensearch.service + systemctl --no-reload stop wazuh-indexer.service - elif [ -x /etc/init.d/opensearch ]; then + elif [ -x /etc/init.d/wazuh-indexer ]; then if command -v invoke-rc.d >/dev/null; then - invoke-rc.d opensearch stop + invoke-rc.d wazuh-indexer stop else - /etc/init.d/opensearch stop + /etc/init.d/wazuh-indexer stop fi # older suse linux distributions do not ship with systemd # but do not have an /etc/init.d/ directory - # this tries to start the opensearch service on these + # this tries to start the wazuh-indexer service on these # as well without failing this script - elif [ -x /etc/rc.d/init.d/opensearch ] ; then - /etc/rc.d/init.d/opensearch stop + elif [ -x /etc/rc.d/init.d/wazuh-indexer ] ; then + /etc/rc.d/init.d/wazuh-indexer stop fi echo " OK" fi @@ -80,15 +80,15 @@ fi if [ "$REMOVE_SERVICE" = "true" ]; then if command -v systemctl >/dev/null; then - systemctl disable opensearch.service > /dev/null 2>&1 || true + systemctl disable wazuh-indexer.service > /dev/null 2>&1 || true fi if command -v chkconfig >/dev/null; then - chkconfig --del opensearch 2> /dev/null || true + chkconfig --del wazuh-indexer 2> /dev/null || true fi if command -v update-rc.d >/dev/null; then - update-rc.d opensearch remove >/dev/null || true + update-rc.d wazuh-indexer remove >/dev/null || true fi fi diff --git a/distribution/packages/src/common/systemd/opensearch.conf b/distribution/packages/src/common/systemd/opensearch.conf deleted file mode 100644 index 1245c11a6b7e8..0000000000000 --- a/distribution/packages/src/common/systemd/opensearch.conf +++ /dev/null @@ -1 +0,0 @@ -d /var/run/opensearch 0755 opensearch opensearch - - diff --git a/distribution/packages/src/common/systemd/sysctl/opensearch.conf b/distribution/packages/src/common/systemd/sysctl/wazuh-indexer.conf similarity index 100% rename from distribution/packages/src/common/systemd/sysctl/opensearch.conf rename to distribution/packages/src/common/systemd/sysctl/wazuh-indexer.conf diff --git a/distribution/packages/src/common/systemd/systemd-entrypoint b/distribution/packages/src/common/systemd/systemd-entrypoint index de59b4573f79a..cc24e7b3b5b5f 100644 --- a/distribution/packages/src/common/systemd/systemd-entrypoint +++ b/distribution/packages/src/common/systemd/systemd-entrypoint @@ -6,7 +6,7 @@ set -e -o pipefail if [ -n "$OPENSEARCH_KEYSTORE_PASSPHRASE_FILE" ] ; then - exec /usr/share/opensearch/bin/opensearch "$@" < "$OPENSEARCH_KEYSTORE_PASSPHRASE_FILE" + exec /usr/share/wazuh-indexer/bin/opensearch "$@" < "$OPENSEARCH_KEYSTORE_PASSPHRASE_FILE" else - exec /usr/share/opensearch/bin/opensearch "$@" + exec /usr/share/wazuh-indexer/bin/opensearch "$@" fi diff --git a/distribution/packages/src/common/systemd/wazuh-indexer.conf b/distribution/packages/src/common/systemd/wazuh-indexer.conf new file mode 100644 index 0000000000000..f9aa920e837b6 --- /dev/null +++ b/distribution/packages/src/common/systemd/wazuh-indexer.conf @@ -0,0 +1 @@ +d /var/run/wazuh-indexer 0750 wazuh-indexer wazuh-indexer - - diff --git a/distribution/packages/src/common/systemd/opensearch.service b/distribution/packages/src/common/systemd/wazuh-indexer.service similarity index 73% rename from distribution/packages/src/common/systemd/opensearch.service rename to distribution/packages/src/common/systemd/wazuh-indexer.service index 962dc5d2aae72..e396257a9d5cf 100644 --- a/distribution/packages/src/common/systemd/opensearch.service +++ b/distribution/packages/src/common/systemd/wazuh-indexer.service @@ -1,30 +1,30 @@ [Unit] -Description=OpenSearch -Documentation=https://www.elastic.co +Description=wazuh-indexer +Documentation=https://documentation.wazuh.com Wants=network-online.target After=network-online.target [Service] Type=notify -RuntimeDirectory=opensearch +RuntimeDirectory=wazuh-indexer PrivateTmp=true -Environment=OPENSEARCH_HOME=/usr/share/opensearch +Environment=OPENSEARCH_HOME=/usr/share/wazuh-indexer Environment=OPENSEARCH_PATH_CONF=${path.conf} -Environment=PID_DIR=/var/run/opensearch +Environment=PID_DIR=/var/run/wazuh-indexer Environment=OPENSEARCH_SD_NOTIFY=true EnvironmentFile=-${path.env} -WorkingDirectory=/usr/share/opensearch +WorkingDirectory=/usr/share/wazuh-indexer -User=opensearch -Group=opensearch +User=wazuh-indexer +Group=wazuh-indexer -ExecStart=/usr/share/opensearch/bin/systemd-entrypoint -p ${PID_DIR}/opensearch.pid --quiet +ExecStart=/usr/share/wazuh-indexer/bin/systemd-entrypoint -p ${PID_DIR}/wazuh-indexer.pid --quiet # StandardOutput is configured to redirect to journalctl since # some error messages may be logged in standard output before -# opensearch logging system is initialized. OpenSearch -# stores its logs in /var/log/opensearch and does not use +# wazuh-indexer logging system is initialized. Wazuh-indexer +# stores its logs in /var/log/wazuh-indexer and does not use # journalctl by default. If you also want to enable journalctl # logging, you can simply remove the "quiet" option from ExecStart. StandardOutput=journal diff --git a/distribution/packages/src/deb/init.d/opensearch b/distribution/packages/src/deb/init.d/wazuh-indexer similarity index 79% rename from distribution/packages/src/deb/init.d/opensearch rename to distribution/packages/src/deb/init.d/wazuh-indexer index 681d87df1d356..5843a982adc5e 100755 --- a/distribution/packages/src/deb/init.d/opensearch +++ b/distribution/packages/src/deb/init.d/wazuh-indexer @@ -1,22 +1,22 @@ #!/usr/bin/env bash # -# /etc/init.d/opensearch -- startup script for OpenSearch +# /etc/init.d/wazuh-indexer -- startup script for Wazuh indexer # ### BEGIN INIT INFO -# Provides: opensearch +# Provides: wazuh-indexer # Required-Start: $network $remote_fs $named # Required-Stop: $network $remote_fs $named # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Short-Description: Starts opensearch -# Description: Starts opensearch using start-stop-daemon +# Short-Description: Starts wazuh-indexer +# Description: Starts wazuh-indexer using start-stop-daemon ### END INIT INFO set -e -o pipefail PATH=/bin:/usr/bin:/sbin:/usr/sbin -NAME=opensearch -DESC="OpenSearch Server" +NAME=wazuh-indexer +DESC=$NAME DEFAULT=/etc/default/$NAME if [ `id -u` -ne 0 ]; then @@ -53,7 +53,7 @@ OPENSEARCH_PATH_CONF=/etc/$NAME MAX_MAP_COUNT=262144 # OpenSearch PID file directory -PID_DIR="/var/run/opensearch" +PID_DIR="/var/run/$NAME" # End of variables that can be overwritten in $DEFAULT @@ -73,7 +73,7 @@ export JAVA_HOME export OPENSEARCH_JAVA_HOME if [ ! -x "$DAEMON" ]; then - echo "The opensearch startup script does not exists or it is not executable, tried: $DAEMON" + echo "The wazuh-indexer startup script does not exists or it is not executable, tried: $DAEMON" exit 1 fi @@ -82,7 +82,7 @@ case "$1" in log_daemon_msg "Starting $DESC" - pid=`pidofproc -p $PID_FILE opensearch` + pid=`pidofproc -p $PID_FILE wazuh-indexer` if [ -n "$pid" ] ; then log_begin_msg "Already running." log_end_msg 0 @@ -91,10 +91,10 @@ case "$1" in # Ensure that the PID_DIR exists (it is cleaned at OS startup time) if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then - mkdir -p "$PID_DIR" && chown opensearch:opensearch "$PID_DIR" + mkdir -p "$PID_DIR" && chown wazuh-indexer:wazuh-indexer "$PID_DIR" fi if [ -n "$PID_FILE" ] && [ ! -e "$PID_FILE" ]; then - touch "$PID_FILE" && chown opensearch:opensearch "$PID_FILE" + touch "$PID_FILE" && chown wazuh-indexer:wazuh-indexer "$PID_FILE" fi if [ -n "$MAX_OPEN_FILES" ]; then @@ -110,7 +110,7 @@ case "$1" in fi # Start Daemon - start-stop-daemon -d $OPENSEARCH_HOME --start --user opensearch -c opensearch --pidfile "$PID_FILE" --exec $DAEMON -- $DAEMON_OPTS + start-stop-daemon -d $OPENSEARCH_HOME --start --user wazuh-indexer -c wazuh-indexer --pidfile "$PID_FILE" --exec $DAEMON -- $DAEMON_OPTS return=$? if [ $return -eq 0 ]; then i=0 @@ -134,7 +134,7 @@ case "$1" in if [ -f "$PID_FILE" ]; then start-stop-daemon --stop --pidfile "$PID_FILE" \ - --user opensearch \ + --user wazuh-indexer \ --quiet \ --retry forever/TERM/20 > /dev/null if [ $? -eq 1 ]; then @@ -151,7 +151,7 @@ case "$1" in log_end_msg 0 ;; status) - status_of_proc -p $PID_FILE opensearch opensearch && exit 0 || exit $? + status_of_proc -p $PID_FILE wazuh-indexer wazuh-indexer && exit 0 || exit $? ;; restart|force-reload) if [ -f "$PID_FILE" ]; then diff --git a/distribution/packages/src/deb/lintian/opensearch b/distribution/packages/src/deb/lintian/opensearch deleted file mode 100644 index e6db8e8c6b322..0000000000000 --- a/distribution/packages/src/deb/lintian/opensearch +++ /dev/null @@ -1,46 +0,0 @@ -# we don't have a changelog, but we put our copyright file -# under /usr/share/doc/opensearch, which triggers this warning -changelog-file-missing-in-native-package - -# we intentionally copy our copyright file for all deb packages -copyright-file-contains-full-apache-2-license -copyright-should-refer-to-common-license-file-for-apache-2 -copyright-without-copyright-notice - -# we still put all our files under /usr/share/opensearch even after transition to platform dependent packages -arch-dependent-file-in-usr-share - -# we have a bundled jdk, so don't use jarwrapper -missing-dep-on-jarwrapper - -# we prefer to not make our config and log files world readable -non-standard-file-perm etc/default/opensearch 0660 != 0644 -non-standard-dir-perm etc/opensearch/ 0750 != 0755 -non-standard-dir-perm etc/opensearch/jvm.options.d/ 0750 != 0755 -non-standard-file-perm etc/opensearch/* -non-standard-dir-perm var/lib/opensearch/ 0750 != 0755 -non-standard-dir-perm var/log/opensearch/ 0750 != 0755 -executable-is-not-world-readable etc/init.d/opensearch 0750 -non-standard-file-permissions-for-etc-init.d-script etc/init.d/opensearch 0750 != 0755 - -# this lintian tag is simply wrong; contrary to the explanation, debian systemd -# does actually look at /usr/lib/systemd/system -systemd-service-file-outside-lib usr/lib/systemd/system/opensearch.service - -# we do not automatically enable the service in init.d or systemd -script-in-etc-init.d-not-registered-via-update-rc.d etc/init.d/opensearch - -# the package scripts handle init.d/systemd directly and don't need to use deb helpers -maintainer-script-calls-systemctl -prerm-calls-updaterc.d opensearch - -# bundled JDK -embedded-library -arch-dependent-file-in-usr-share usr/share/opensearch/jdk/* -unstripped-binary-or-object usr/share/opensearch/jdk/* -extra-license-file usr/share/opensearch/jdk/legal/* -hardening-no-pie usr/share/opensearch/jdk/bin/* -hardening-no-pie usr/share/opensearch/jdk/lib/* - -# the system java version that lintian assumes is far behind what opensearch uses -unknown-java-class-version diff --git a/distribution/packages/src/deb/lintian/wazuh-indexer b/distribution/packages/src/deb/lintian/wazuh-indexer new file mode 100644 index 0000000000000..6d98dc7a7b879 --- /dev/null +++ b/distribution/packages/src/deb/lintian/wazuh-indexer @@ -0,0 +1,46 @@ +# we don't have a changelog, but we put our copyright file +# under /usr/share/doc/wazuh-indexer, which triggers this warning +changelog-file-missing-in-native-package + +# we intentionally copy our copyright file for all deb packages +copyright-file-contains-full-apache-2-license +copyright-should-refer-to-common-license-file-for-apache-2 +copyright-without-copyright-notice + +# we still put all our files under /usr/share/wazuh-indexer even after transition to platform dependent packages +arch-dependent-file-in-usr-share + +# we have a bundled jdk, so don't use jarwrapper +missing-dep-on-jarwrapper + +# we prefer to not make our config and log files world readable +non-standard-file-perm etc/default/wazuh-indexer 0660 != 0644 +non-standard-dir-perm etc/wazuh-indexer/ 0750 != 0755 +non-standard-dir-perm etc/wazuh-indexer/jvm.options.d/ 0750 != 0755 +non-standard-file-perm etc/wazuh-indexer/* +non-standard-dir-perm var/lib/wazuh-indexer/ 0750 != 0755 +non-standard-dir-perm var/log/wazuh-indexer/ 0750 != 0755 +executable-is-not-world-readable etc/init.d/wazuh-indexer 0750 +non-standard-file-permissions-for-etc-init.d-script etc/init.d/wazuh-indexer 0750 != 0755 + +# this lintian tag is simply wrong; contrary to the explanation, debian systemd +# does actually look at /usr/lib/systemd/system +systemd-service-file-outside-lib usr/lib/systemd/system/wazuh-indexer.service + +# we do not automatically enable the service in init.d or systemd +script-in-etc-init.d-not-registered-via-update-rc.d etc/init.d/wazuh-indexer + +# the package scripts handle init.d/systemd directly and don't need to use deb helpers +maintainer-script-calls-systemctl +prerm-calls-updaterc.d wazuh-indexer + +# bundled JDK +embedded-library +arch-dependent-file-in-usr-share usr/share/wazuh-indexer/jdk/* +unstripped-binary-or-object usr/share/wazuh-indexer/jdk/* +extra-license-file usr/share/wazuh-indexer/jdk/legal/* +hardening-no-pie usr/share/wazuh-indexer/jdk/bin/* +hardening-no-pie usr/share/wazuh-indexer/jdk/lib/* + +# the system java version that lintian assumes is far behind what wazuh-indexer uses +unknown-java-class-version diff --git a/distribution/packages/src/rpm/init.d/opensearch b/distribution/packages/src/rpm/init.d/wazuh-indexer similarity index 80% rename from distribution/packages/src/rpm/init.d/opensearch rename to distribution/packages/src/rpm/init.d/wazuh-indexer index 0cb9bf65796ad..75b7b7ac9756f 100644 --- a/distribution/packages/src/rpm/init.d/opensearch +++ b/distribution/packages/src/rpm/init.d/wazuh-indexer @@ -1,9 +1,9 @@ #!/usr/bin/env bash # -# opensearch +# wazuh-indexer # # chkconfig: 2345 80 20 -# description: Starts and stops a single opensearch instance on this system +# description: Starts and stops a single wazuh-indexer instance on this system # ### BEGIN INIT INFO @@ -12,7 +12,7 @@ # Required-Stop: $network $named # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Short-Description: This service manages the opensearch daemon +# Short-Description: This service manages the wazuh-indexer daemon # Description: OpenSearch is a very scalable, schema-free and high-performance search solution supporting multi-tenancy and near realtime search. ### END INIT INFO @@ -33,13 +33,13 @@ if [ -f /etc/rc.d/init.d/functions ]; then . /etc/rc.d/init.d/functions fi -# Sets the default values for opensearch variables used in this script -OPENSEARCH_HOME="/usr/share/opensearch" +# Sets the default values for wazuh-indexer variables used in this script +OPENSEARCH_HOME="/usr/share/wazuh-indexer" MAX_OPEN_FILES=65535 MAX_MAP_COUNT=262144 OPENSEARCH_PATH_CONF="${path.conf}" -PID_DIR="/var/run/opensearch" +PID_DIR="/var/run/wazuh-indexer" # Source the default env file OPENSEARCH_ENV_FILE="${path.env}" @@ -47,8 +47,8 @@ if [ -f "$OPENSEARCH_ENV_FILE" ]; then . "$OPENSEARCH_ENV_FILE" fi -exec="$OPENSEARCH_HOME/bin/opensearch" -prog="opensearch" +exec="$OPENSEARCH_HOME/bin/wazuh-indexer" +prog="wazuh-indexer" pidfile="$PID_DIR/${prog}.pid" export OPENSEARCH_JAVA_OPTS @@ -60,7 +60,7 @@ export OPENSEARCH_JAVA_HOME lockfile=/var/lock/subsys/$prog if [ ! -x "$exec" ]; then - echo "The opensearch startup script does not exists or it is not executable, tried: $exec" + echo "The wazuh-indexer startup script does not exists or it is not executable, tried: $exec" exit 1 fi @@ -79,16 +79,16 @@ start() { # Ensure that the PID_DIR exists (it is cleaned at OS startup time) if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then - mkdir -p "$PID_DIR" && chown opensearch:opensearch "$PID_DIR" + mkdir -p "$PID_DIR" && chown wazuh-indexer:wazuh-indexer "$PID_DIR" fi if [ -n "$pidfile" ] && [ ! -e "$pidfile" ]; then - touch "$pidfile" && chown opensearch:opensearch "$pidfile" + touch "$pidfile" && chown wazuh-indexer:wazuh-indexer "$pidfile" fi cd $OPENSEARCH_HOME echo -n $"Starting $prog: " # if not running, start it up here, usually something like "daemon $exec" - daemon --user opensearch --pidfile $pidfile $exec -p $pidfile -d + daemon --user wazuh-indexer --pidfile $pidfile $exec -p $pidfile -d retval=$? echo [ $retval -eq 0 ] && touch $lockfile diff --git a/scripts/build.sh b/scripts/build.sh index 48075ea6bf566..aab72e00c1485 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -162,7 +162,7 @@ echo "Building OpenSearch for $PLATFORM-$DISTRIBUTION-$ARCHITECTURE" # Copy artifact to dist folder in bundle build output echo "Copying artifact to ${OUTPUT}/dist" [[ "$SNAPSHOT" == "true" ]] && IDENTIFIER="-SNAPSHOT" -ARTIFACT_BUILD_NAME=`ls distribution/$TYPE/$TARGET/build/distributions/ | grep "opensearch-min.*$SUFFIX.$EXT"` +ARTIFACT_BUILD_NAME=`ls distribution/$TYPE/$TARGET/build/distributions/ | grep "wazuh-indexer-min.*$SUFFIX.$EXT"` # [WAZUH] Used by the GH workflow to upload the artifact echo "$ARTIFACT_BUILD_NAME" > "$OUTPUT/artifact_name.txt" mkdir -p "${OUTPUT}/dist" diff --git a/settings.gradle b/settings.gradle index c04b5997d49b1..04b8d3d555550 100644 --- a/settings.gradle +++ b/settings.gradle @@ -20,7 +20,7 @@ buildCache { } } -rootProject.name = "OpenSearch" +rootProject.name = "Wazuh indexer" include 'doc-tools' includeBuild("doc-tools/missing-doclet")