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

Replace OpenSearch license header with Wazuh's AGPLv3 header #184

Merged
merged 6 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2024, Wazuh Inc.
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
plugins { id "com.diffplug.spotless" version "6.25.0" }
repositories { mavenCentral() }

Expand Down
20 changes: 14 additions & 6 deletions formatter/license-header.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2024, Wazuh Inc.
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
20 changes: 14 additions & 6 deletions gradle/formatting.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2024, Wazuh Inc.
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

allprojects {
project.apply plugin: "com.diffplug.spotless"
Expand Down
862 changes: 661 additions & 201 deletions plugins/command-manager/LICENSE.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plugins/command-manager/NOTICE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OpenSearch (https://opensearch.org/)
Copyright OpenSearch Contributors
Wazuh (https://wazuh.com/)
Copyright Wazuh Contributors
Copyright Wazuh Contributors
9 changes: 5 additions & 4 deletions plugins/command-manager/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@

import org.opensearch.gradle.test.RestIntegTestTask
import java.util.concurrent.Callable

buildscript {
Expand Down Expand Up @@ -45,8 +43,8 @@ publishing {
description = pluginDescription
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
name = "GNU Affero General Public License (AGPL) version 3.0"
url = "http://www.gnu.org/licenses/agpl-3.0.txt"
}
}
developers {
Expand Down Expand Up @@ -122,6 +120,9 @@ dependencies {
testImplementation "io.gatehill.imposter:mock-openapi:${versions.imposter}"
}

// No need to validate license headers since spotless checks and applies it
licenseHeaders.enabled = false

// This requires an additional Jar not published as part of build-tools
loggerUsageCheck.enabled = false

Expand Down
15 changes: 11 additions & 4 deletions plugins/command-manager/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# Copyright (C) 2024, Wazuh Inc.
#
# SPDX-License-Identifier: Apache-2.0
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

org.gradle.caching=true
org.gradle.warning.mode=none
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# Copyright (C) 2024, Wazuh Inc.
#
# SPDX-License-Identifier: Apache-2.0
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2024, Wazuh Inc.
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.wazuh.commandmanager;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2024, Wazuh Inc.
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.wazuh.commandmanager.auth;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2024, Wazuh Inc.
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.wazuh.commandmanager.auth;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2024, Wazuh Inc.
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.wazuh.commandmanager.index;

Expand Down Expand Up @@ -78,8 +86,8 @@ public CompletableFuture<RestStatus> asyncCreate(Document document) {
this.clusterService,
CommandManagerPlugin.COMMAND_MANAGER_INDEX_TEMPLATE_NAME)) {
IndexTemplateUtils.putIndexTemplate(
this.client,
CommandManagerPlugin.COMMAND_MANAGER_INDEX_TEMPLATE_NAME);
this.client,
CommandManagerPlugin.COMMAND_MANAGER_INDEX_TEMPLATE_NAME);
} else {
log.info(
"Index template {} already exists. Skipping creation.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2024, Wazuh Inc.
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.wazuh.commandmanager.jobscheduler;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2024, Wazuh Inc.
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.wazuh.commandmanager.jobscheduler;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2024, Wazuh Inc.
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.wazuh.commandmanager.jobscheduler;

import com.wazuh.commandmanager.utils.IndexTemplateUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.action.index.IndexRequest;
Expand All @@ -27,6 +34,7 @@
import java.util.concurrent.ExecutorService;

import com.wazuh.commandmanager.CommandManagerPlugin;
import com.wazuh.commandmanager.utils.IndexTemplateUtils;

/** Indexes the command job to the Jobs index. */
public class JobDocument {
Expand All @@ -51,7 +59,12 @@ public static JobDocument getInstance() {
* @return a CompletableFuture that will hold the IndexResponse.
*/
public CompletableFuture<IndexResponse> create(
ClusterService clusterService, Client client, ThreadPool threadPool, String id, String jobName, Integer interval) {
ClusterService clusterService,
Client client,
ThreadPool threadPool,
String id,
String jobName,
Integer interval) {
CompletableFuture<IndexResponse> completableFuture = new CompletableFuture<>();
ExecutorService executorService = threadPool.executor(ThreadPool.Names.WRITE);
CommandManagerJobParameter jobParameter =
Expand All @@ -67,13 +80,15 @@ public CompletableFuture<IndexResponse> create(
executorService.submit(
() -> {
try (ThreadContext.StoredContext ignored =
threadPool.getThreadContext().stashContext()) {
if (!IndexTemplateUtils.indexTemplateExists(clusterService,CommandManagerPlugin.JOB_INDEX_TEMPLATE_NAME)) {
IndexTemplateUtils.putIndexTemplate(client, CommandManagerPlugin.JOB_INDEX_TEMPLATE_NAME);
threadPool.getThreadContext().stashContext()) {
if (!IndexTemplateUtils.indexTemplateExists(
clusterService, CommandManagerPlugin.JOB_INDEX_TEMPLATE_NAME)) {
IndexTemplateUtils.putIndexTemplate(
client, CommandManagerPlugin.JOB_INDEX_TEMPLATE_NAME);
} else {
log.info(
"Index template {} already exists. Skipping creation.",
CommandManagerPlugin.JOB_INDEX_NAME);
"Index template {} already exists. Skipping creation.",
CommandManagerPlugin.JOB_INDEX_NAME);
}
IndexResponse indexResponse = client.index(indexRequest).actionGet();
completableFuture.complete(indexResponse);
Expand Down
Loading