diff --git a/stack/dashboard/base/builder.sh b/stack/dashboard/base/builder.sh index 613aa4f922..aeca4c57a8 100755 --- a/stack/dashboard/base/builder.sh +++ b/stack/dashboard/base/builder.sh @@ -93,7 +93,7 @@ sed -i "90s|defaultValue: true|defaultValue: false|g" ./src/core/server/opensear sed -i 's/NODE_OPTIONS="$OSD_NODE_OPTS_PREFIX $OSD_NODE_OPTS $NODE_OPTIONS"/NODE_OPTIONS="$OSD_NODE_OPTS_PREFIX $OSD_NODE_OPTS $NODE_OPTIONS"\n/g' ./bin/use_node sed -i 's/exec "${NODE}"/NODE_ENV=production exec "${NODE}" ${NODE_OPTIONS} /g' ./bin/use_node # Replace the redirection to `home` in the header logo -sed -i "s'/app/home'/app/wazuh'g" ./src/core/target/public/core.entry.js +sed -i "s'/app/home'/app/wz-home'g" ./src/core/target/public/core.entry.js # Replace others redirections to `home` sed -i 's/navigateToApp("home")/navigateToApp("wazuh")/g' ./src/core/target/public/core.entry.js # Changed from Opensearch Documentation links to Wazuh Documentation @@ -143,6 +143,110 @@ brotli -c ./plugins/securityDashboards/target/public/securityDashboards.plugin.j # Generate compressed files gzip -c ./plugins/securityDashboards/target/public/securityDashboards.chunk.5.js > ./plugins/securityDashboards/target/public/securityDashboards.chunk.5.js.gz brotli -c ./plugins/securityDashboards/target/public/securityDashboards.chunk.5.js > ./plugins/securityDashboards/target/public/securityDashboards.chunk.5.js.br + +# Define categories +category_explore='{id:"explore",label:"Explore",order:500,euiIconType:"search"}' +category_dashboard_management='{id:"management",label:"Indexer/dashboard Management",order:5e3,euiIconType:"managementApp"}' + +# Add custom categories (explore) to the built-in +sed -i -e "s|DEFAULT_APP_CATEGORIES=Object.freeze({|DEFAULT_APP_CATEGORIES=Object.freeze({explore:${category_explore},|" ./src/core/target/public/core.entry.js + +# Replace management built-in app category +sed -i -e "s|management:{id:\"management\",label:external_osdSharedDeps_OsdI18n_\[\"i18n\"\].translate(\"core.ui.managementNavList.label\",{defaultMessage:\"Management\"}),order:5e3,euiIconType:\"managementApp\"}|management:${category_dashboard_management}|" ./src/core/target/public/core.entry.js + +# Replace app category to Discover app +sed -i -e 's|category:core_public_\["DEFAULT_APP_CATEGORIES"\].opensearchDashboards|category:core_public_["DEFAULT_APP_CATEGORIES"].explore|' ./src/plugins/discover/target/public/discover.plugin.js + +# Replace app category to Dashboard app +sed -i -e 's|category:core_public_\["DEFAULT_APP_CATEGORIES"\].opensearchDashboards|category:core_public_["DEFAULT_APP_CATEGORIES"].explore|' ./src/plugins/dashboard/target/public/dashboard.plugin.js + +# Replace app category to Visualize app +sed -i -e 's|category:core_public_\["DEFAULT_APP_CATEGORIES"\].opensearchDashboards|category:core_public_["DEFAULT_APP_CATEGORIES"].explore|' ./src/plugins/visualize/target/public/visualize.plugin.js + +# Replace app category to Reporting app +sed -i -e "s|category:{id:\"opensearch\",label:_i18n.i18n.translate(\"opensearch.reports.categoryName\",{defaultMessage:\"OpenSearch Plugins\"}),order:2e3}|category:${category_explore}|" ./plugins/reportsDashboards/target/public/reportsDashboards.plugin.js + +# Replace app category to Alerting app +sed -i -e "s|category:{id:\"opensearch\",label:\"OpenSearch Plugins\",order:2e3}|category:${category_explore}|" ./plugins/alertingDashboards/target/public/alertingDashboards.plugin.js + +# Replace app category to Maps app +sed -i -e "s|category:{id:\"opensearch\",label:\"OpenSearch Plugins\",order:2e3}|category:${category_explore}|" ./plugins/customImportMapDashboards/target/public/customImportMapDashboards.plugin.js + +# Replace app category to Notifications app +sed -i -e "s|category:DEFAULT_APP_CATEGORIES.management|category:${category_explore}|" ./plugins/notificationsDashboards/target/public/notificationsDashboards.plugin.js + +# Replace app category to Index Management app +sed -i -e "s|category:DEFAULT_APP_CATEGORIES.management|category:${category_dashboard_management}|g" ./plugins/indexManagementDashboards/target/public/indexManagementDashboards.plugin.js + +# Replace app category to Dev Tools app +sed -i -e "s|category:public_["DEFAULT_APP_CATEGORIES"].management|category:${category_dashboard_management}|g" ./src/plugins/dev_tools/target/public/devTools.plugin.js + +# Replace app category to Dashboards Management (Stack management) app +sed -i -e "s|category:public_["DEFAULT_APP_CATEGORIES"].management|category:${category_dashboard_management}|g" ./src/plugins/management/target/public/management.plugin.js + +# Replace app category to Security app +sed -i -e "s|category:DEFAULT_APP_CATEGORIES.management|category:${category_dashboard_management}|g" ./plugins/securityDashboards/target/public/securityDashboards.plugin.js + +# Replace app order to Discover app +app_order_discover=1000 +sed -i -e "s|order:1e3|order:${app_order_discover}|g" ./src/plugins/discover/target/public/discover.plugin.js + +# Replace app order to Dashboard app +app_order_dashboard=1010 +sed -i -e "s|order:2500|order:${app_order_dashboard}|g" ./src/plugins/dashboard/target/public/dashboard.plugin.js + +# Replace app order to Visualize app +app_order_visualize=1020 +sed -i -e "s|order:8e3|order:${app_order_visualize}|g" ./src/plugins/visualize/target/public/visualize.plugin.js + +# Replace app order to Dev tools app +app_order_dev_tools=9010 +sed -i -e "s|order:9070|order:${app_order_dev_tools}|g" ./src/plugins/dev_tools/target/public/devTools.plugin.js + +# Replace app order to Dashboard management app +app_order_dashboard_management=9020 +sed -i -e "s|order:9030|order:${app_order_dashboard_management}|g" ./src/plugins/management/target/public/management.plugin.js + +# Replace app order to Security app +app_order_security=9030 +sed -i -e "s|order:9050|order:${app_order_security}|g" ./plugins/securityDashboards/target/public/securityDashboards.plugin.js + +# Replace app order to Index management app +app_order_index_management=9040 +sed -i -e "s|order:9010|order:${app_order_index_management}|g" ./plugins/indexManagementDashboards/target/public/indexManagementDashboards.plugin.js + +# Replace app order to Snapshot management app +app_order_snapshot_management=9050 +sed -i -e "s|order:9020|order:${app_order_snapshot_management}|g" ./plugins/indexManagementDashboards/target/public/indexManagementDashboards.plugin.js + +# Avoid the management Overview application is registered to feature catalogue +sed -i -e "s|home.featureCatalogue|false \&\& home.featureCatalogue|g" ./src/plugins/management_overview/target/public/managementOverview.plugin.js + +# Avoid the management Overview application is registered (appear on side menu) +sed -i -e "s|application.register|false \&\& application.register|g" ./src/plugins/management_overview/target/public/managementOverview.plugin.js + +files_to_recreate=( + ./src/core/target/public/core.entry.js + ./src/plugins/discover/target/public/discover.plugin.js + ./src/plugins/dashboard/target/public/dashboard.plugin.js + ./src/plugins/visualize/target/public/visualize.plugin.js + ./plugins/reportsDashboards/target/public/reportsDashboards.plugin.js + ./plugins/alertingDashboards/target/public/alertingDashboards.plugin.js + ./plugins/customImportMapDashboards/target/public/customImportMapDashboards.plugin.js + ./plugins/notificationsDashboards/target/public/notificationsDashboards.plugin.js + ./plugins/indexManagementDashboards/target/public/indexManagementDashboards.plugin.js + ./src/plugins/dev_tools/target/public/devTools.plugin.js + ./src/plugins/management/target/public/management.plugin.js + ./plugins/securityDashboards/target/public/securityDashboards.plugin.js + ./src/plugins/management_overview/target/public/managementOverview.plugin.js +) + +for value in "${files_to_recreate[@]}" +do + gzip -c "$value" > "$value.gz" + brotli -c "$value" > "$value.br" +done + # Add VERSION file cp /root/VERSION . # Add exception for wazuh plugin install @@ -164,6 +268,7 @@ mv ./package.json.tmp ./package.json /bin/bash ./bin/opensearch-dashboards-plugin remove observabilityDashboards --allow-root /bin/bash ./bin/opensearch-dashboards-plugin remove securityAnalyticsDashboards --allow-root /bin/bash ./bin/opensearch-dashboards-plugin remove searchRelevanceDashboards --allow-root +/bin/bash ./bin/opensearch-dashboards-plugin remove mlCommonsDashboards --allow-root find -type d -exec chmod 750 {} \; find -type f -perm 644 -exec chmod 640 {} \; diff --git a/stack/dashboard/base/files/etc/opensearch_dashboards.yml b/stack/dashboard/base/files/etc/opensearch_dashboards.yml index 538728402d..b5a48982de 100644 --- a/stack/dashboard/base/files/etc/opensearch_dashboards.yml +++ b/stack/dashboard/base/files/etc/opensearch_dashboards.yml @@ -11,5 +11,5 @@ server.ssl.enabled: true server.ssl.key: "/etc/wazuh-dashboard/certs/dashboard-key.pem" server.ssl.certificate: "/etc/wazuh-dashboard/certs/dashboard.pem" opensearch.ssl.certificateAuthorities: ["/etc/wazuh-dashboard/certs/root-ca.pem"] -uiSettings.overrides.defaultRoute: /app/wazuh +uiSettings.overrides.defaultRoute: /app/wz-home