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

Update Indexer and Dasboard base with Opensearch 2.1.0 #1764

Merged
merged 10 commits into from
Aug 2, 2022
7 changes: 5 additions & 2 deletions stack/dashboard/base/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ cp -r /root/stack/dashboard/base/files/etc ./
cp ./etc/custom_welcome/template.js.hbs ./src/legacy/ui/ui_render/bootstrap/template.js.hbs
cp ./etc/custom_welcome/light_theme.style.css ./src/core/server/core_app/assets/legacy_light_theme.css
cp ./etc/custom_welcome/*svg ./src/core/server/core_app/assets/
cp ./etc/custom_welcome/Assets/default_branding/Solid_black.svg ./src/core/server/core_app/assets/default_branding/opensearch_logo.svg
cp ./etc/custom_welcome/Assets/default_branding/Solid_black.svg ./src/core/server/core_app/assets/default_branding/opensearch_logo_default_mode.svg
cp ./etc/custom_welcome/Assets/Favicons/* ./src/core/server/core_app/assets/favicons/
cp ./etc/custom_welcome/Assets/Favicons/favicon.ico ./src/core/server/core_app/assets/favicons/favicon.ico
cp ./etc/http_service.js ./src/core/server/http/http_service.js
Expand All @@ -76,7 +76,7 @@ sed -i 's/navigateToApp("home")/navigateToApp("wazuh")/g' ./src/core/target/publ
sed -i 's|"core.ui.chrome.headerGlobalNav.helpMenuVersion",defaultMessage:"v {version}"|"core.ui.chrome.headerGlobalNav.helpMenuVersion",defaultMessage:"v'${version}'"|' ./src/core/target/public/core.entry.js
## Help link - OpenSearch Dashboards documentation
sed -i 's|OpenSearch Dashboards documentation|Wazuh documentation|' ./src/core/target/public/core.entry.js
sed -i 's|OPENSEARCH_DASHBOARDS_DOCS="https://opensearch.org/docs/dashboards/"|OPENSEARCH_DASHBOARDS_DOCS="https://documentation.wazuh.com/'${wazuh_minor}'"|' ./src/core/target/public/core.entry.js
sed -i 's|href:opensearchDashboardsDocLink,|href:"https://documentation.wazuh.com/'${wazuh_minor}'",|' ./src/core/target/public/core.entry.js
## Help link - Ask OpenSearch
sed -i 's|Ask OpenSearch|Ask Wazuh|' ./src/core/target/public/core.entry.js
sed -i 's|OPENSEARCH_DASHBOARDS_ASK_OPENSEARCH_LINK="https://github.com/opensearch-project"|OPENSEARCH_DASHBOARDS_ASK_OPENSEARCH_LINK="https://wazuh.com/community/join-us-on-slack"|' ./src/core/target/public/core.entry.js
Expand Down Expand Up @@ -116,6 +116,9 @@ gzip -c ./plugins/securityDashboards/target/public/securityDashboards.chunk.5.js
brotli -c ./plugins/securityDashboards/target/public/securityDashboards.chunk.5.js > ./plugins/securityDashboards/target/public/securityDashboards.chunk.5.js.br
# Add VERSION file
cp /root/VERSION .
# Add exception for wazuh plugin install
wazuh_plugin="if (plugin.includes(\'wazuh\')) {\n return plugin;\n } else {\n return \`\${LATEST_PLUGIN_BASE_URL}\/\${version}\/latest\/\${platform}\/\${arch}\/tar\/builds\/opensearch-dashboards\/plugins\/\${plugin}-\${version}.zip\`;\n }"
sed -i "s|return \`\${LATEST_PLUGIN_BASE_URL}\/\${version}\/latest\/\${platform}\/\${arch}\/tar\/builds\/opensearch-dashboards\/plugins\/\${plugin}-\${version}.zip\`;|$wazuh_plugin|" ./src/cli_plugin/install/settings.js

# Remove plugins
/bin/bash ./bin/opensearch-dashboards-plugin remove queryWorkbenchDashboards --allow-root
Expand Down
27 changes: 20 additions & 7 deletions stack/dashboard/base/files/etc/services/wazuh-dashboard
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
#!/bin/sh
# chkconfig: 2345 95 20
# description: Wazuh dashboard
#
# Source function libraries if present.
# (It improves integration with systemd)
#
# Red Hat
if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions

# Debian
elif [ -f /lib/lsb/init-functions ]; then
. /lib/lsb/init-functions

# SUSE
elif [ -f /etc/rc.status ]; then
. /etc/rc.status
rc_reset
fi

name=wazuh-dashboard
program=/usr/share/wazuh-dashboard/bin/opensearch-dashboards
args=-c\\\ /etc/wazuh-dashboard/opensearch_dashboards.yml
Expand All @@ -25,20 +43,15 @@ emit() {

start() {

# Ensure the log directory is setup correctly.
[ ! -d "/var/log/wazuh-dashboard/" ] && mkdir "/var/log/wazuh-dashboard/"
chown "$user":"$group" "/var/log/wazuh-dashboard/"
chmod 755 "/var/log/wazuh-dashboard/"


# Setup any environmental stuff beforehand

# 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 wazuh-dashboard:wazuh-dashboard "$PID_DIR"
mkdir -p "$PID_DIR" && chown "$user":"$group" "$PID_DIR"
fi
if [ -n "$pidfile" ] && [ ! -e "$pidfile" ]; then
touch "$pidfile" && chown wazuh-dashboard:wazuh-dashboard "$pidfile"
touch "$pidfile" && chown "$user":"$group" "$pidfile"
fi


Expand Down
13 changes: 6 additions & 7 deletions stack/dashboard/base/files/etc/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ var _fonts = require("./fonts");

var _styles = require("./styles");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Any modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

/*
Expand All @@ -41,11 +44,6 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
* specific language governing permissions and limitations
* under the License.
*/

/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/
const Template = ({
metadata: {
uiPublicUrl,
Expand Down Expand Up @@ -89,6 +87,7 @@ const Template = ({
_react.default.createElement("path",{d:"M883.3,93.62A85.09,85.09,0,0,0,878.86,76a56.88,56.88,0,0,0-9.46-16.64A45.46,45.46,0,0,0,853.3,47q-9.93-4.71-24.54-4.7-19.05,0-32.48,8.22A53,53,0,0,0,782.19,63V8.35h-24.4V187h27.66V113.71q0-12.52,2.8-21.27A37.82,37.82,0,0,1,796,78.35a28.86,28.86,0,0,1,11.42-7.76,39.44,39.44,0,0,1,13.83-2.42c7.47,0,13.55,1.53,18.2,4.57a31.27,31.27,0,0,1,10.82,12,52.22,52.22,0,0,1,5.22,16.12,107.39,107.39,0,0,1,1.38,16.89V187h27.66V108.75A114.2,114.2,0,0,0,883.3,93.62Z", fill:"black"}),
_react.default.createElement("circle",{fill:"#3585F9",cx:"937.12",cy:"167.6",r:"22.24"}));


const loadingLogoDefault = (_injectedMetadata$bra = injectedMetadata.branding.loadingLogo) === null || _injectedMetadata$bra === void 0 ? void 0 : _injectedMetadata$bra.defaultUrl;
const loadingLogoDarkMode = (_injectedMetadata$bra2 = injectedMetadata.branding.loadingLogo) === null || _injectedMetadata$bra2 === void 0 ? void 0 : _injectedMetadata$bra2.darkModeUrl;
const markDefault = (_injectedMetadata$bra3 = injectedMetadata.branding.mark) === null || _injectedMetadata$bra3 === void 0 ? void 0 : _injectedMetadata$bra3.defaultUrl;
Expand Down
2 changes: 1 addition & 1 deletion stack/dashboard/base/generate_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ reference=""
current_path="$( cd $(dirname $0) ; pwd -P )"
dockerfile_path="${current_path}/docker"
container_name="dashboard_base_builder"
opensearch_version="1.2.0"
opensearch_version="2.1.0"
outdir="${current_path}/output"
revision="1"
future="no"
Expand Down
12 changes: 6 additions & 6 deletions stack/indexer/base/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ find -name "*.bat" -exec rm -rf {} \;
rm -rf README.md manifest.yml opensearch-tar-install.sh logs
sed -i 's|OPENSEARCH_DISTRIBUTION_TYPE=tar|OPENSEARCH_DISTRIBUTION_TYPE=rpm|g' bin/opensearch-env
cp -r /root/stack/indexer/base/files/systemd-entrypoint bin/
cp -r /root/stack/indexer/base/files/etc ./
cp -r /root/stack/indexer/base/files/usr ./
cp -r ./config/log4j2.properties ./etc/wazuh-indexer/
cp -r ./config/opensearch-reports-scheduler ./etc/wazuh-indexer/
cp -r ./config/opensearch-observability ./etc/wazuh-indexer/
cp -r ./config/jvm.options.d ./etc/wazuh-indexer/
mkdir -p ./etc/wazuh-indexer/
cp -r ./config/* ./etc/wazuh-indexer/
rm -rf ./config
cp -r /root/stack/indexer/base/files/etc/wazuh-indexer/* ./etc/wazuh-indexer/
cp -r /root/stack/indexer/base/files/etc/sysconfig ./etc/
cp -r /root/stack/indexer/base/files/etc/init.d ./etc/
cp -r /root/stack/indexer/base/files/usr ./
rm -rf ./plugins/opensearch-security/tools/install_demo_configuration.sh
cp /root/VERSION .

Expand Down
3 changes: 3 additions & 0 deletions stack/indexer/base/files/etc/sysconfig/wazuh-indexer
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ OPENSEARCH_PATH_CONF=/etc/wazuh-indexer
# The number of seconds to wait before checking if Wazuh-indexer started successfully as a daemon process
WI_STARTUP_SLEEP_TIME=5

# Notification for systemd
OPENSEARCH_SD_NOTIFY=true

################################
# System properties
################################
Expand Down
2 changes: 1 addition & 1 deletion stack/indexer/base/files/etc/wazuh-indexer/opensearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ plugins.security.restapi.roles_enabled:
- "security_rest_api_access"

plugins.security.system_indices.enabled: true
plugins.security.system_indices.indices: [".opendistro-alerting-config", ".opendistro-alerting-alert*", ".opendistro-anomaly-results*", ".opendistro-anomaly-detector*", ".opendistro-anomaly-checkpoints", ".opendistro-anomaly-detection-state", ".opendistro-reports-*", ".opendistro-notifications-*", ".opendistro-notebooks", ".opensearch-observability", ".opendistro-asynchronous-search-response*", ".replication-metadata-store"]
plugins.security.system_indices.indices: [".plugins-ml-model", ".plugins-ml-task", ".opendistro-alerting-config", ".opendistro-alerting-alert*", ".opendistro-anomaly-results*", ".opendistro-anomaly-detector*", ".opendistro-anomaly-checkpoints", ".opendistro-anomaly-detection-state", ".opendistro-reports-*", ".opensearch-notifications-*", ".opensearch-notebooks", ".opensearch-observability", ".opendistro-asynchronous-search-response*", ".replication-metadata-store"]

### Option to allow Filebeat-oss 7.10.2 to work ###
compatibility.override_main_response_version: true
6 changes: 3 additions & 3 deletions stack/indexer/base/generate_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
set -e

reference=""
opensearch_version="1.2.4"
opensearch_version="2.1.0"

current_path="$( cd $(dirname $0) ; pwd -P )"
outdir="${current_path}/output"
Expand Down Expand Up @@ -68,7 +68,7 @@ help() {
echo "Usage: $0 [OPTIONS]"
echo
echo " -s, --store <path> [Optional] Set the destination path of package. By default, an output folder will be created."
echo " --version <version> [Optional] OpenSearch version, by default ${opensearch_version}"
echo " -v, --version <version> [Optional] OpenSearch version, by default ${opensearch_version}"
echo " --reference <ref> [Optional] wazuh-packages branch or tag"
echo " --future [Optional] Build test future package 99.99.0 Used for development purposes."
echo " -r, --revision <rev> [Optional] Package revision. By default ${revision}"
Expand All @@ -94,7 +94,7 @@ main() {
help 1
fi
;;
"--version")
"-v"|"--version")
if [ -n "${2}" ]; then
opensearch_version="${2}"
shift 2
Expand Down
Loading