diff --git a/.github/ISSUE_TEMPLATE/compatibility_request.md b/.github/ISSUE_TEMPLATE/compatibility_request.md new file mode 100644 index 000000000000..b294b6fc8704 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/compatibility_request.md @@ -0,0 +1,23 @@ +--- +name: Compatibility request +about: Suggest supporting a new version of OpenSearch +title: 'Compatibility with OpenSearch (version)' +labels: compatibility, level/task, type/research +assignees: '' + +--- + +## Description +We need to ensure the UI compatibility with the next version of OpenSearch vX.X. +This update is still being discussed, but we need to be aware of potential issues. + +For that, we need to: + +- [ ] Review opensearch and opensearch-dashboard latest stable changelog. +- [ ] Identify improvements and potential impact on the UI. +- [ ] Create new tracking and development branches. +- [ ] Develop a testing environment to verify our components would work under this new build. + + +## Issues +- _List here the detected issues_ diff --git a/.github/ISSUE_TEMPLATE/new_release.md b/.github/ISSUE_TEMPLATE/new_release.md new file mode 100644 index 000000000000..2a8fb24f0e4d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/new_release.md @@ -0,0 +1,33 @@ +--- +name: New release +about: "[wazuh-team] Track the effort of the team to release a new version of Wazuh" +title: Support for Wazuh 4.x.x +labels: level/task, type/enhancement +assignees: '' + +--- + +## Description + +Example: +> Wazuh 4.3.8 will be released shortly. Our Wazuh Dashboard app need to support this new version. From our side, no changes will be included, so we only need to bump the version. + + +## Tasks + +### Pre-release +- [ ] Add support for Wazuh 4.x.x (bump). +- [ ] Generate the required tags. +- [ ] Generate the packages. +- [ ] Test the packages, to verify they install, and the app works as expected. +- [ ] [Optional] Run Regression Testing (#issue) +- [ ] Generate draft releases. +- [ ] Notify the @wazuh/cicd and @wazuh/content teams that the release is good to go, from our side. + +### Post-release +- [ ] Make draft releases final and public. +- [ ] Sync branches. + +### Supported versions + +Same as on [previous releases](https://github.com/wazuh/wazuh-dashboard/wiki/Compatibility) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000000..8baaf0415e3c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,92 @@ +# This is a basic workflow that is manually triggered + +name: Build + +on: + workflow_call: + inputs: + CHECKOUT_TO: # This is the branch to checkout to. Defaults to 'master' + description: 'The branch/tag/commit to checkout to' + required: true + default: '' + type: string + workflow_dispatch: + inputs: + CHECKOUT_TO: # This is the branch to checkout to. Defaults to 'master' + description: 'The branch/tag/commit to checkout to' + required: true + default: '' + +jobs: + build: + runs-on: ubuntu-latest + name: Build + defaults: + run: + working-directory: ./artifacts + strategy: + matrix: + DISTRIBUTION: [ tar.gz ] + ARCHITECTURE: [ x64 ] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + repository: wazuh/wazuh-dashboard + path: ./artifacts + ref: ${{ inputs.CHECKOUT_TO }} + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: './artifacts/.nvmrc' + registry-url: 'https://registry.npmjs.org' + + - name: Setup Yarn + run: | + npm uninstall -g yarn + npm i -g yarn@1.22.10 + yarn config set network-timeout 1000000 -g + + - name: Configure Yarn Cache + run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV + + - name: Initialize Yarn Cache + uses: actions/cache@v3 + with: + path: ${{ env.YARN_CACHE_LOCATION }} + key: yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + yarn- + + - name: Get package version + run: | + echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV + echo "WZD_VERSION=$(yarn --silent wzd-version)" >> $GITHUB_ENV + echo "WZD_REVISION=$(yarn --silent wzd-revision)" >> $GITHUB_ENV + + - name: Get artifact build name + run: | + echo "ARTIFACT_BUILD_NAME=wazuh-dashboard_${{ env.WZD_VERSION }}-${{ env.WZD_REVISION }}_${{ matrix.ARCHITECTURE }}_${{ inputs.CHECKOUT_TO }}.${{ matrix.DISTRIBUTION }}" >> $GITHUB_ENV + + - name: Run bootstrap + run: yarn osd bootstrap + + - name: Build linux-x64 + if: matrix.ARCHITECTURE == 'x64' + run: yarn build-platform --linux --skip-os-packages --release + + - name: Build linux-arm64 + if: matrix.ARCHITECTURE == 'arm64' + run: yarn build-platform --linux-arm --skip-os-packages --release + + - name: Rename artifact + run: mv /home/runner/work/wazuh-dashboard/wazuh-dashboard/artifacts/target/opensearch-dashboards-${{ env.VERSION }}-linux-${{ matrix.ARCHITECTURE }}.${{ matrix.DISTRIBUTION }} /home/runner/work/wazuh-dashboard/wazuh-dashboard/artifacts/target/${{ env.ARTIFACT_BUILD_NAME }} + + - uses: actions/upload-artifact@v3 + if: success() + with: + name: ${{ env.ARTIFACT_BUILD_NAME }} + path: ./artifacts/target/${{ env.ARTIFACT_BUILD_NAME }} + retention-days: 30 diff --git a/.github/workflows/build_wazuh_dashboard_with_plugins.yml b/.github/workflows/build_wazuh_dashboard_with_plugins.yml new file mode 100644 index 000000000000..8ab9a563409e --- /dev/null +++ b/.github/workflows/build_wazuh_dashboard_with_plugins.yml @@ -0,0 +1,212 @@ +name: Build final packages + +on: + workflow_dispatch: + inputs: + REFERENCE_SECURITY_PLUGIN: + description: 'Reference Wazuh security packages (branch/tag/commit)' + required: true + default: '' + REFERENCE_WAZUH_PLUGINS: + description: 'Reference Wazuh plugins (branch/tag/commit)' + required: true + default: '' + REFERENCE_WAZUH_DASHBOARD: + description: 'Reference Wazuh dashboard (branch/tag/commit)' + required: true + default: '' + DISTRIBUTION: + description: 'Distribution to build (deb | rpm | tar | all-platforms)' + required: true + default: '' + +jobs: + build-plugins: + name: Build plugins + uses: wazuh/wazuh-dashboard-plugins/.github/workflows/manual-build.yml@master + with: + reference: ${{ inputs.REFERENCE_WAZUH_PLUGINS }} + + build-dashboard: + name: Build dashboard + uses: wazuh/wazuh-dashboard/.github/workflows/build.yml@4.9.0 + with: + CHECKOUT_TO: ${{ inputs.REFERENCE_WAZUH_DASHBOARD }} + + build-security-plugin: + name: Build security plugin + uses: wazuh/wazuh-security-dashboards-plugin/.github/workflows/manual-build.yml@4.9.0 + with: + reference: ${{ inputs.REFERENCE_SECURITY_PLUGIN }} + + + Build-base-package: + needs: [build-plugins, build-dashboard, build-security-plugin] + runs-on: ubuntu-latest + name: Generate final packages + strategy: + fail-fast: false + matrix: + # TODO: Add arm64 support + ARCHITECTURE: [ x64 ] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + registry-url: 'https://registry.npmjs.org' + + - name: Setup variables + run: | + echo "CURRENT_DIR=$(pwd -P)" >> $GITHUB_ENV + echo "VERSION=$(yarn --silent wzd-version)" >> $GITHUB_ENV + echo "REVISION=$(yarn --silent wzd-revision)" >> $GITHUB_ENV + + - name: Setup packages names + run: | + echo "WAZUH_DASHBOARD_SLIM=wazuh-dashboard_${{ env.VERSION }}-${{ env.REVISION }}_${{ matrix.ARCHITECTURE }}_${{ inputs.REFERENCE_WAZUH_DASHBOARD }}.tar.gz" >> $GITHUB_ENV + echo "WAZUH_SECURITY_PLUGIN=wazuh-security-dashboards-plugin_${{ env.VERSION }}-${{ env.REVISION }}_${{ inputs.REFERENCE_SECURITY_PLUGIN }}.zip" >> $GITHUB_ENV + echo "WAZUH_PLUGINS=wazuh-dashboard-plugins_${{ env.VERSION }}-${{ env.REVISION }}_${{ inputs.REFERENCE_WAZUH_PLUGINS }}.zip" >> $GITHUB_ENV + + - name: Download dashboard artifact + uses: actions/download-artifact@v3 + with: + name: ${{ env.WAZUH_DASHBOARD_SLIM }} + path: ${{ env.CURRENT_DIR }}/artifacts/dashboard + + - name: Download security plugin artifact + uses: actions/download-artifact@v3 + with: + name: ${{ env.WAZUH_SECURITY_PLUGIN }} + path: ${{ env.CURRENT_DIR }}/artifacts/security-plugin + + - name: Download plugins artifacts + uses: actions/download-artifact@v3 + with: + name: ${{ env.WAZUH_PLUGINS }} + path: ${{ env.CURRENT_DIR }}/artifacts/plugins + + - name: Zip plugins + run: | + zip -r -j ${{ env.CURRENT_DIR }}/artifacts/wazuh-package.zip ${{ env.CURRENT_DIR }}/artifacts/plugins + zip -r -j ${{ env.CURRENT_DIR }}/artifacts/security-package.zip ${{ env.CURRENT_DIR }}/artifacts/security-plugin + zip -r -j ${{ env.CURRENT_DIR }}/artifacts/dashboard-package.zip ${{ env.CURRENT_DIR }}/artifacts/dashboard/${{ env.WAZUH_DASHBOARD_SLIM }} + + + - name: Build packages + run: | + cd ${{ env.CURRENT_DIR }}/dev-tools/build-packages + bash ./build-packages.sh \ + -v ${{ env.VERSION }} \ + -r ${{ env.REVISION }} \ + -a file://${{env.CURRENT_DIR}}/artifacts/wazuh-package.zip \ + -s file://${{env.CURRENT_DIR}}/artifacts/security-package.zip \ + -b file://${{env.CURRENT_DIR}}/artifacts/dashboard-package.zip \ + --tar + + + - name: Upload tar packages + uses: actions/upload-artifact@v3 + with: + name: wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}-linux-${{ matrix.ARCHITECTURE }}.tar.gz + path: ${{ env.CURRENT_DIR }}/dev-tools/build-packages/output/wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}-linux-${{ matrix.ARCHITECTURE }}.tar.gz + retention-days: 30 + + build-deb-package: + needs: [Build-base-package] + if: ( contains(inputs.DISTRIBUTION, 'deb') || contains(inputs.DISTRIBUTION, 'all-platforms') ) + runs-on: ubuntu-latest + name: Build deb package + strategy: + fail-fast: false + matrix: + # TODO: Add arm64 support + ARCHITECTURE: [ x64 ] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + registry-url: 'https://registry.npmjs.org' + + - name: Setup variables + run: | + echo "CURRENT_DIR=$(pwd -P)" >> $GITHUB_ENV + echo "VERSION=$(yarn --silent wzd-version)" >> $GITHUB_ENV + echo "REVISION=$(yarn --silent wzd-revision)" >> $GITHUB_ENV + + - name: Download dashboard artifact + uses: actions/download-artifact@v3 + with: + name: wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}-linux-${{ matrix.ARCHITECTURE }}.tar.gz + path: ${{ env.CURRENT_DIR }}/artifacts/dashboard-tar + + - name: Build packages + run: | + cd ${{ env.CURRENT_DIR }}/dev-tools/build-packages/deb/ + bash ./launcher.sh \ + -v ${{ env.VERSION }} \ + -r ${{ env.REVISION }} \ + -p file://${{env.CURRENT_DIR}}/artifacts/dashboard-tar/wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}-linux-${{ matrix.ARCHITECTURE }}.tar.gz + + - name: Upload deb packages + uses: actions/upload-artifact@v3 + if: success() + with: + name: wazuh-dashboard_${{ env.VERSION }}-${{ env.REVISION }}_amd64.deb + path: ${{ env.CURRENT_DIR }}/dev-tools/build-packages/deb/output/wazuh-dashboard_${{ env.VERSION }}-${{ env.REVISION }}_amd64.deb + retention-days: 30 + + + build-rpm-package: + needs: [Build-base-package] + if: ( contains(inputs.DISTRIBUTION, 'rpm') || contains(inputs.DISTRIBUTION, 'all-platforms') ) + runs-on: ubuntu-latest + name: Build rpm package + strategy: + fail-fast: false + matrix: + ARCHITECTURE: [ x64 ] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + registry-url: 'https://registry.npmjs.org' + + - name: Setup variables + run: | + echo "CURRENT_DIR=$(pwd -P)" >> $GITHUB_ENV + echo "VERSION=$(yarn --silent wzd-version)" >> $GITHUB_ENV + echo "REVISION=$(yarn --silent wzd-revision)" >> $GITHUB_ENV + + - name: Download dashboard artifact + uses: actions/download-artifact@v3 + with: + name: wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}-linux-${{ matrix.ARCHITECTURE }}.tar.gz + path: ${{ env.CURRENT_DIR }}/artifacts/dashboard-tar + + - name: Build packages + run: | + cd ${{ env.CURRENT_DIR }}/dev-tools/build-packages/rpm/ + bash ./launcher.sh \ + -v ${{ env.VERSION }} \ + -r ${{ env.REVISION }} \ + -p file://${{env.CURRENT_DIR}}/artifacts/dashboard-tar/wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}-linux-${{ matrix.ARCHITECTURE }}.tar.gz + + - name: Upload rpm packages + uses: actions/upload-artifact@v3 + if: success() + with: + name: wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}.x86_64.rpm + path: ${{ env.CURRENT_DIR }}/dev-tools/build-packages/rpm/output/wazuh-dashboard-${{ env.VERSION }}-${{ env.REVISION }}.x86_64.rpm + retention-days: 30 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000000..092c298a32e4 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,77 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "main", "[0-9].[0-9]", "[0-9].x" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "main" ] + schedule: + - cron: '00 8 * * 5' + workflow_dispatch: + +jobs: + analyze: + name: Analyze + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Use only 'java' to analyze code written in Java, Kotlin or both + # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/cypress_workflow.yml b/.github/workflows/cypress_workflow.yml index 90bacdbefb57..3ece5cb8d75a 100644 --- a/.github/workflows/cypress_workflow.yml +++ b/.github/workflows/cypress_workflow.yml @@ -40,6 +40,7 @@ env: COMMENT_TAG: '[MANUAL CYPRESS TEST RUN RESULTS]' COMMENT_SUCCESS_MSG: ':white_check_mark: Cypress test run succeeded!' COMMENT_FAILURE_MSG: ':x: Cypress test run failed!' + OPENSEARCH_VERSION: ${{ vars.OPENSEARCH_VERSION }} jobs: cypress-tests: @@ -106,7 +107,7 @@ jobs: with: path: ${{ env.FTR_PATH }} repository: ${{ env.TEST_REPO }} - ref: '${{ env.TEST_BRANCH }}' + ref: '${{ env.OPENSEARCH_VERSION }}' - name: Setup spec files by input if: ${{ inputs.specs != '' }} @@ -147,7 +148,7 @@ jobs: working-directory: ${{ env.FTR_PATH }} start: ${{ env.OPENSEARCH_SNAPSHOT_CMD }}, ${{ env.START_CMD }} wait-on: 'http://localhost:9200, http://localhost:5601' - command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.SPEC }} + command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --config ignoreTestFiles="dashboard_sanity_test_spec.js" --spec ${{ env.SPEC }} # Screenshots are only captured on failure, will change this once we do visual regression tests - uses: actions/upload-artifact@v3 @@ -156,7 +157,7 @@ jobs: name: ftr-cypress-screenshots path: ${{ env.FTR_PATH }}/cypress/screenshots retention-days: 1 - + - uses: actions/upload-artifact@v3 if: always() with: @@ -170,7 +171,6 @@ jobs: name: ftr-cypress-results path: ${{ env.FTR_PATH }}/cypress/results retention-days: 1 - add-comment: needs: [cypress-tests] if: ${{ always() && github.event_name == 'workflow_dispatch' && inputs.pr_number != '' }} @@ -205,6 +205,6 @@ jobs: '${{ env.SPEC }}' ``` - #### Link to results: + #### Link to results: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} edit-mode: replace diff --git a/.gitignore b/.gitignore index d72d66a6d17d..1add5bb6a1d2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .aws-config.json .signing-config.json .ackrc +/dev-tools/build-packages/*/output /.opensearch /.chromium /package.json.bak diff --git a/README.md b/README.md index 4d4924046027..c4c1bf3909c2 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,41 @@ - +
+ +
- [Welcome!](#welcome) - [Project Resources](#project-resources) -- [Code of Conduct](#code-of-conduct) +- [Wazuh UI](#wazuh-ui) - [License](#license) - [Copyright](#copyright) ## Welcome -OpenSearch Dashboards is an open-source data visualization tool designed to work with OpenSearch. OpenSearch Dashboards gives you data visualization tools to improve and automate business intelligence and support data-driven decision-making and strategic planning. +Wazuh dashboard is a fork of the [OpenSearch Dashboards][opensearch-dashboards] which +incorporate changes to make it easier to use for Wazuh users. Our aim is to contribute +back any work not tied specifically to Wazuh. -We aim to be an exceptional community-driven platform and to foster open participation and collective contribution with all contributors. Stay up to date on what's happening with the OpenSearch Project by tracking GitHub [issues](https://github.com/opensearch-project/OpenSearch-Dashboards/issues) and [pull requests](https://github.com/opensearch-project/OpenSearch-Dashboards/pulls). +Wazuh is a security detection, visibility, and compliance open-source project. Wazuh +helps you to gain deeper security visibility into your infrastructure by monitoring +hosts at an operating system and application level. -You can [contribute to this project](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/CONTRIBUTING.md) by [opening issues](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/new/choose) to give feedback, share ideas, identify bugs, and contribute code. - -Set up your [OpenSearch Dashboards development environment](ttps://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/DEVELOPER_GUIDE.md#getting-started-guide) today! The project team looks forward to your contributions. - -## Code Summary - -[![Build and Test][build-and-test-badge]][build-and-test-link] -[![Unit Test Code Coverage][codecov-badge]][codecov-link] -[![Link Checker][link-checker-badge]][link-checker-link] +You can learn more about it at [wazuh.com][wazuh-web]. ## Project Resources -- [Project Website](https://opensearch.org/) -- [Downloads](https://opensearch.org/downloads.html) -- [Documentation](https://opensearch.org/docs/) -- Need help? See the [communication guide](COMMUNICATIONS.md) for various options -- [Project Principles](https://opensearch.org/#principles) +- [Project Website][wazuh-web] +- [Documentation][wazuh-docs] +- Need help? Joins us on [Slack][slack-invite]! - [Developer Guide](DEVELOPER_GUIDE.md) -- [Contributing to OpenSearch](CONTRIBUTING.md) +- [Contributing](CONTRIBUTING.md) - [Maintainer Responsibilities](MAINTAINERS.md) - [Release Management](RELEASING.md) - [Testing](TESTING.md) - [Security](SECURITY.md) -## Code of Conduct +## Wazuh UI -This project has adopted the [Amazon Open Source Code of Conduct](CODE_OF_CONDUCT.md). For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq), or contact [opensource-codeofconduct@amazon.com](mailto:opensource-codeofconduct@amazon.com) with any additional questions or comments. +This repository is not a new Wazuh UI, but the platform on which Wazuh UI will run. +The UI can be found on its own [repository][wazuh-plugin]. ## License @@ -46,11 +43,13 @@ This project is licensed under the [Apache v2.0 License](LICENSE.txt). ## Copyright -Copyright OpenSearch Contributors. See [NOTICE](NOTICE.txt) for details. +- Copyright OpenSearch Contributors. See [NOTICE](NOTICE.txt) for details. +- Copyright Wazuh, Inc. + + -[build-and-test-badge]: https://github.com/opensearch-project/OpenSearch-Dashboards/actions/workflows/build_and_test_workflow.yml/badge.svg -[build-and-test-link]: https://github.com/opensearch-project/OpenSearch-Dashboards/actions/workflows/build_and_test_workflow.yml -[codecov-badge]: https://codecov.io/gh/opensearch-project/OpenSearch-Dashboards/branch/main/graphs/badge.svg -[codecov-link]: https://app.codecov.io/gh/opensearch-project/OpenSearch-Dashboards -[link-checker-badge]: https://github.com/opensearch-project/OpenSearch-Dashboards/actions/workflows/links_checker.yml/badge.svg -[link-checker-link]: https://github.com/opensearch-project/OpenSearch-Dashboards/actions/workflows/links_checker.yml +[opensearch-dashboards]: https://github.com/opensearch-project/OpenSearch-Dashboards +[wazuh-plugin]: https://github.com/wazuh/wazuh-kibana-app +[wazuh-web]: https://wazuh.com +[wazuh-docs]: https://documentation.wazuh.com +[slack-invite]: https://join.slack.com/t/wazuh/shared_invite/zt-1lgu531ur-7M_k_ZQbpdo4QCn_pHee3w diff --git a/config/node.options.prod b/config/node.options.prod new file mode 100644 index 000000000000..ed533b559152 --- /dev/null +++ b/config/node.options.prod @@ -0,0 +1,9 @@ +## Node command line options +## See `node --help` and `node --v8-options` for available options +## Please note you should specify one option per line + +## max size of old space in megabytes +#--max-old-space-size=4096 + +## Wazuh - do not terminate process on unhandled promise rejection +--unhandled-rejections=warn diff --git a/config/opensearch_dashboards.prod.yml b/config/opensearch_dashboards.prod.yml new file mode 100644 index 000000000000..89b23a8be11e --- /dev/null +++ b/config/opensearch_dashboards.prod.yml @@ -0,0 +1,15 @@ +server.host: 0.0.0.0 +server.port: 443 +opensearch.hosts: https://localhost:9200 +opensearch.ssl.verificationMode: certificate +opensearch.requestHeadersAllowlist: ["securitytenant","Authorization"] +opensearch_security.multitenancy.enabled: false +opensearch_security.readonly_mode.roles: ["kibana_read_only"] +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/wz-home + +opensearchDashboards.branding: + useExpandedHeader: false diff --git a/dev-tools/build-packages/README.md b/dev-tools/build-packages/README.md new file mode 100644 index 000000000000..16f085dde78f --- /dev/null +++ b/dev-tools/build-packages/README.md @@ -0,0 +1,70 @@ +# Package building +This folder contains tools used to create `rpm` and `deb` packages. + +## Requirements + - A system with Docker. + - Internet connection (to download the docker images the first time). + +## Builders + +### Tarball + +To system packages (deb and rpm), a tarball of Wazuh dashboard `.tar.gz` is required. +This tarball contains the [Wazuh plugin][wazuh-plugin], the [Wazuh Security plugin][wazuh-security-plugin], +a set of OpenSearch plugins and the default configuration for the app. + +The `generate_base.sh` script generates a `.tar.gz` file using the following inputs: +- `-a` | `--app`: URL to the zipped Wazuh plugin.* +- `-b` | `--base`: URL to the Wazuh dashboard `.tar.gz`, as generated with `yarn build --skip-os-packages --release`.* +- `-s` | `--security`: URL to the zipped Wazuh Security plugin, as generated with `yarn build`.* +- `-v` | `--version`: the Wazuh version of the package. +- `-r` | `--revision`: [Optional] Set the revision of the build. By default, it is set to 1. +- `-o` | `--output` [Optional] Set the destination path of package. By default, an output folder will be created in the same directory as the script. + +*Note:* use `file://` to indicate a local file. Otherwise, the script will try to download the file from the given URL. + +Example: +```bash +bash generate_base.sh \ + --app https://packages-dev.wazuh.com/pre-release/ui/dashboard/wazuh-4.6.0-1.zip \ + --base file:///home/user/wazuh-dashboard/target/opensearch-dashboards-2.4.1-linux-x64.tar.gz \ + --security file:///home/user/wazuh-security-dashboards-plugin/build/security-dashboards-2.4.1.0.zip \ + --version 4.6.0 +``` + +### DEB + +The `launcher.sh` script generates a `.deb` package based on the previously generated `.tar.gz`. +A Docker container is used to generate the package. It takes the following inputs: +- `-v` | `--version`: the Wazuh version of the package. +- `-p` | `--package`: the location of the `.tar.gz` file. It can be a URL or a PATH, with the format `file://` +- `-r` | `--revision`: [Optional] Set the revision of the build. By default, it is set to 1. +- `-o` | `--output` [Optional] Set the destination path of package. By default, an output folder will be created in the same directory as the script. +- `--dont-build-docker`: [Optional] Locally built Docker image will be used instead of generating a new one. + +Example: +```bash +bash launcher.sh \ + --version 4.6.0 \ + --package file:///home/user/wazuh-dashboard/dev_tools/build_packages/base/output/wazuh-dashboard-4.6.0-1-linux-x64.tar.gz +``` + +### RPM + +The `launcher.sh` script generates a `.rpm` package based on the previously generated `.tar.gz`. +A Docker container is used to generate the package. It takes the following inputs: +- `-v` | `--version`: the Wazuh version of the package. +- `-p` | `--package`: the location of the `.tar.gz` file. It can be a URL or a PATH, with the format `file://` +- `-r` | `--revision`: [Optional] Set the revision of the build. By default, it is set to 1. +- `-o` | `--output` [Optional] Set the destination path of package. By default, an output folder will be created in the same directory as the script. +- `--dont-build-docker`: [Optional] Locally built Docker image will be used instead of generating a new one. + +Example: +```bash +bash launcher.sh \ + --version 4.6.0 \ + --package file:///home/user/wazuh-dashboard/dev_tools/build_packages/base/output/wazuh-dashboard-4.6.0-1-linux-x64.tar.gz +``` + +[wazuh-plugin]: https://github.com/wazuh/wazuh-kibana-app +[wazuh-security-plugin]: https://github.com/wazuh/wazuh-security-dashboards-plugin \ No newline at end of file diff --git a/dev-tools/build-packages/base/generate_base.sh b/dev-tools/build-packages/base/generate_base.sh new file mode 100755 index 000000000000..ad80a08c6c4b --- /dev/null +++ b/dev-tools/build-packages/base/generate_base.sh @@ -0,0 +1,256 @@ +#!/bin/bash + +# Wazuh package generator +# Copyright (C) 2022, Wazuh Inc. +# +# This program is a free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public +# License (version 2) as published by the FSF - Free Software +# Foundation. + +set -e + +# Inputs +app="" +base="" +revision="1" +security="" +version="" + +# Paths +current_path="$( cd $(dirname $0) ; pwd -P )" +config_path=$(realpath $current_path/../../../config) + +# Folders +out_dir="${current_path}/output" +tmp_dir="${current_path}/tmp" + +trap ctrl_c INT + +clean() { + exit_code=$1 + echo + echo "Cleaning temporary files..." + echo + # Clean the files + rm -r $tmp_dir + + if [ $exit_code != 0 ]; then + rm $out_dir/*.tar.gz + rmdir $out_dir + fi + + exit ${exit_code} +} + +ctrl_c() { + clean 1 +} + +# ----------------------------------------------------------------------------- + +build() { + # Validate and download files to build the package + valid_url='(https?|ftp|file)://[-[:alnum:]\+&@#/%?=~_|!:,.;]*[-[:alnum:]\+&@#/%=~_|]' + echo + echo "Downloading plugins..." + echo + mkdir -p $tmp_dir + cd $tmp_dir + mkdir -p applications + mkdir -p dashboards + if [[ $app =~ $valid_url ]]; then + if ! curl --output applications/app.zip --silent --fail "${app}"; then + echo "The given URL or Path to the Wazuh Apps is not working: ${app}" + clean 1 + else + echo "Extracting applications from app.zip" + unzip -q applications/app.zip -d applications + rm applications/app.zip + fi + else + echo "The given URL or Path to the Wazuh App is not valid: ${app}" + clean 1 + fi + + echo + echo "Downloading dashboards..." + echo + + if [[ $base =~ $valid_url ]]; then + if [[ $base =~ .*\.zip ]]; then + if ! curl --output wazuh-dashboard.zip --silent --fail "${base}"; then + echo "The given URL or Path to the Wazuh Dashboard base is not working: ${base}" + clean 1 + else + echo "Extracting Wazuh Dashboard base" + unzip -q wazuh-dashboard.zip -d ./dashboards/ + rm wazuh-dashboard.zip + mv ./dashboards/$(ls ./dashboards) wazuh-dashboard.tar.gz + fi + else + if ! curl --output wazuh-dashboard.tar.gz --silent --fail "${base}"; then + echo "The given URL or Path to the Wazuh Dashboard base is not working: ${base}" + clean 1 + fi + fi + else + echo "The given URL or Path to the Wazuh Dashboard base is not valid: ${base}" + clean 1 + fi + + echo + echo "Downloading security plugin..." + echo + + if [[ $security =~ $valid_url ]]; then + if ! curl --output applications/security.zip --silent --fail "${security}"; then + echo "The given URL or Path to the Wazuh Security Plugin is not working: ${security}" + clean 1 + else + echo "Extracting Security application" + unzip -q applications/security.zip -d applications + rm applications/security.zip + fi + else + echo "The given URL or Path to the Wazuh Security Plugin is not valid: ${security}" + clean 1 + fi + + tar -zxf wazuh-dashboard.tar.gz + directory_name=$(tar tf wazuh-dashboard.tar.gz | head -1 | sed 's#/.*##' | sort -u) + working_dir="wazuh-dashboard-$version-$revision-linux-x64" + mv $directory_name $working_dir + cd $working_dir + + echo + echo Building the package... + echo + + # Install plugins + bin/opensearch-dashboards-plugin install alertingDashboards + bin/opensearch-dashboards-plugin install customImportMapDashboards + bin/opensearch-dashboards-plugin install ganttChartDashboards + bin/opensearch-dashboards-plugin install indexManagementDashboards + bin/opensearch-dashboards-plugin install notificationsDashboards + bin/opensearch-dashboards-plugin install reportsDashboards + # Install Wazuh apps and Security app + plugins=$(ls $tmp_dir/applications) + echo $plugins + for plugin in $plugins; do + echo $plugin + if [[ $plugin =~ .*\.zip ]]; then + bin/opensearch-dashboards-plugin install file:../applications/$plugin + fi + done + + # Enable the default configuration (renaming) + cp $config_path/opensearch_dashboards.prod.yml config/opensearch_dashboards.yml + cp $config_path/node.options.prod config/node.options + + # TODO: investigate to remove this if possible + # Fix ambiguous shebangs (necessary for RPM building) + grep -rnwl './node_modules/' -e '#!/usr/bin/env python$' | xargs -I {} sed -i 's/#!\/usr\/bin\/env python/#!\/usr\/bin\/env python3/g' {} + grep -rnwl './node_modules/' -e '#!/usr/bin/python$' | xargs -I {} sed -i 's/#!\/usr\/bin\/python/#!\/usr\/bin\/python3/g' {} + + # Compress + echo + echo Compressing the package... + echo + cd .. + if [ ! -d "$out_dir" ]; then + mkdir -p $out_dir + fi + tar -czf $out_dir/$working_dir.tar.gz $working_dir + + echo + echo DONE! + echo + clean 0 +} + +# ----------------------------------------------------------------------------- + +help() { + echo + echo "Usage: $0 [OPTIONS]" + echo " -a, --app Set the location of the .zip file containing the Wazuh plugin." + echo " -b, --base Set the location of the .tar.gz file containing the base wazuh-dashboard build." + echo " -s, --security Set the location of the .zip file containing the wazuh-security-dashboards-plugin." + echo " -v, --version Set the version of this build." + echo " -r, --revision [Optional] Set the revision of this build. By default, it is set to 1." + echo " -o, --output [Optional] Set the destination path of package. By default, an output folder will be created." + echo " -h, --help Show this help." + echo + exit $1 +} + +# ----------------------------------------------------------------------------- + +main() { + while [ -n "${1}" ]; do + case "${1}" in + "-h" | "--help") + help 0 + ;; + "-a" | "--app") + if [ -n "$2" ]; then + app="$2" + shift 2 + else + help 1 + fi + ;; + "-s" | "--security") + if [ -n "${2}" ]; then + security="${2}" + shift 2 + else + help 0 + fi + ;; + "-b" | "--base") + if [ -n "${2}" ]; then + base="${2}" + shift 2 + else + help 0 + fi + ;; + "-v" | "--version") + if [ -n "${2}" ]; then + version="${2}" + shift 2 + else + help 0 + fi + ;; + "-r" | "--revision") + if [ -n "${2}" ]; then + revision="${2}" + shift 2 + fi + ;; + "-o" | "--output") + if [ -n "${2}" ]; then + output="${2}" + shift 2 + fi + ;; + *) + + help 1 + ;; + esac + done + + if [ -z "$app" ] | [ -z "$base" ] | [ -z "$security" ] | [ -z "$version" ]; then + help 1 + fi + + build || exit 1 + + exit 0 +} + +main "$@" diff --git a/dev-tools/build-packages/build-packages.sh b/dev-tools/build-packages/build-packages.sh new file mode 100644 index 000000000000..9a9b4053ab53 --- /dev/null +++ b/dev-tools/build-packages/build-packages.sh @@ -0,0 +1,191 @@ +#!/bin/bash + +app="" +base="" +revision="1" +security="" +version="" +all_platforms="no" +deb="no" +rpm="no" +tar="no" +output="$( cd $(dirname $0) ; pwd -P )/output" + +current_path="$( cd $(dirname $0) ; pwd -P )" + +build_tar() { + echo "Building tar package..." + cd ./base + bash ./generate_base.sh -a $app -b $base -s $security -v $version -r $revision + + name_package_tar=$(ls ./output) + + echo "Moving tar package to $output" + mv $current_path/base/output/$name_package_tar $output/$name_package_tar + cd ../ +} + +build_deb() { + echo "Building deb package..." + name_package_tar=$(find $output -name "*.tar.gz") + cd ./deb + bash ./launcher.sh -v $version -r $revision -p file://$name_package_tar + name_package_tar=$(ls ./output) + echo "Moving deb package to $output/deb" + mv $current_path/deb/output $output/deb + cd ../ +} + +build_rpm() { + echo "Building rpm package..." + name_package_tar=$(find $output -name "*.tar.gz") + cd ./rpm + bash ./launcher.sh -v $version -r $revision -p file://$name_package_tar + echo "Moving rpm package to $output/rpm" + mv $current_path/rpm/output $output/rpm + cd ../ +} + + +build() { + name_package_tar="wazuh-dashboard-$version-$revision-linux-x64.tar.gz" + + if [ ! -d "$output" ]; then + mkdir $output + fi + + if [ "$all_platforms" == "yes" ]; then + deb="yes" + rpm="yes" + tar="yes" + fi + + build_tar + cd $current_path + + if [ $deb == "yes" ]; then + echo "Building deb package..." + build_deb + fi + + if [ $rpm == "yes" ]; then + echo "Building rpm package..." + build_rpm + fi + + if [ "$tar" == "no" ]; then + echo "Removing tar package..." + rm -r $(find $output -name "*.tar.gz") + fi +} + +help() { + echo + echo "Usage: $0 [OPTIONS]" + echo " -a, --app Set the location of the .zip file containing the Wazuh plugin." + echo " -b, --base Set the location of the .tar.gz file containing the base wazuh-dashboard build." + echo " -s, --security Set the location of the .zip file containing the wazuh-security-dashboards-plugin." + echo " -v, --version Set the version of this build." + echo " --all-platforms Build for all platforms." + echo " --deb Build for deb." + echo " --rpm Build for rpm." + echo " --tar Build for tar." + echo " -r, --revision [Optional] Set the revision of this build. By default, it is set to 1." + echo " -o, --output [Optional] Set the destination path of package. By default, an output folder will be created." + echo " -h, --help Show this help." + echo + exit $1 +} + +# ----------------------------------------------------------------------------- + +main() { + while [ -n "${1}" ]; do + case "${1}" in + "-h" | "--help") + help 0 + ;; + "-a" | "--app") + if [ -n "$2" ]; then + app="$2" + shift 2 + else + help 1 + fi + ;; + "-s" | "--security") + if [ -n "${2}" ]; then + security="${2}" + shift 2 + else + help 0 + fi + ;; + "-b" | "--base") + if [ -n "${2}" ]; then + base="${2}" + shift 2 + else + help 0 + fi + ;; + "-v" | "--version") + if [ -n "${2}" ]; then + version="${2}" + shift 2 + else + help 0 + fi + ;; + "-r" | "--revision") + if [ -n "${2}" ]; then + revision="${2}" + shift 2 + fi + ;; + "--all-platforms") + all_platforms="yes" + shift 1 + ;; + "--deb") + deb="yes" + shift 1 + ;; + "--rpm") + rpm="yes" + shift 1 + ;; + "--tar") + tar="yes" + shift 1 + ;; + "-o" | "--output") + if [ -n "${2}" ]; then + output="${2}" + shift 2 + fi + ;; + *) + echo "help" + + help 1 + ;; + esac + done + + if [ -z "$app" ] | [ -z "$base" ] | [ -z "$security" ] | [ -z "$version" ]; then + echo "You must specify the app, base, security and version." + help 1 + fi + + if [ "$all_platforms" == "no" ] && [ "$deb" == "no" ] && [ "$rpm" == "no" ] && [ "$tar" == "no" ]; then + echo "You must specify at least one package to build." + help 1 + fi + + build || exit 1 + + exit 0 +} + +main "$@" diff --git a/dev-tools/build-packages/config/default b/dev-tools/build-packages/config/default new file mode 100644 index 000000000000..c4f94fd36814 --- /dev/null +++ b/dev-tools/build-packages/config/default @@ -0,0 +1,7 @@ +user="wazuh-dashboard" +group="wazuh-dashboard" +chroot="/" +chdir="/" +nice="" +KILL_ON_STOP_TIMEOUT=0 + diff --git a/dev-tools/build-packages/config/wazuh-dashboard b/dev-tools/build-packages/config/wazuh-dashboard new file mode 100644 index 000000000000..ae87055c3a9d --- /dev/null +++ b/dev-tools/build-packages/config/wazuh-dashboard @@ -0,0 +1,170 @@ +#!/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 +PID_DIR="/run/wazuh-dashboard" +pidfile="$PID_DIR/$name.pid" + +[ -r /etc/default/$name ] && . /etc/default/$name +[ -r /etc/sysconfig/$name ] && . /etc/sysconfig/$name + +export NODE_OPTIONS + +[ -z "$nice" ] && nice=0 + +trace() { + logger -t "/etc/init.d/wazuh-dashboard" "$@" +} + +emit() { + trace "$@" + echo "$@" +} + +start() { + + + # 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 "$user":"$group" "$PID_DIR" + fi + if [ -n "$pidfile" ] && [ ! -e "$pidfile" ]; then + touch "$pidfile" && chown "$user":"$group" "$pidfile" + fi + + + # Run the program! + + chroot --userspec "$user":"$group" "$chroot" sh -c "cd \"$chdir\";exec \"$program\" $args" & + + + + # Generate the pidfile from here. If we instead made the forked process + # generate it there will be a race condition between the pidfile writing + # and a process possibly asking for status. + echo $! > $pidfile + + emit "$name started" + return 0 +} + +stop() { + # Try a few times to kill TERM the program + if status ; then + pid=$(cat "$pidfile") + trace "Killing $name (pid $pid) with SIGTERM" + kill -TERM $pid + # Wait for it to exit. + for i in 1 2 3 4 5 ; do + trace "Waiting $name (pid $pid) to die..." + status || break + sleep 1 + done + if status ; then + if [ "$KILL_ON_STOP_TIMEOUT" -eq 1 ] ; then + trace "Timeout reached. Killing $name (pid $pid) with SIGKILL. This may result in data loss." + kill -KILL $pid + emit "$name killed with SIGKILL." + else + emit "$name stop failed; still running." + fi + else + emit "$name stopped." + fi + fi +} + +status() { + if [ -f "$pidfile" ] ; then + pid=$(cat "$pidfile") + if ps -p $pid > /dev/null 2> /dev/null ; then + # process by this pid is running. + # It may not be our pid, but that's what you get with just pidfiles. + # TODO(sissel): Check if this process seems to be the same as the one we + # expect. It'd be nice to use flock here, but flock uses fork, not exec, + # so it makes it quite awkward to use in this case. + return 0 + else + return 2 # program is dead but pid file exists + fi + else + return 3 # program is not running + fi +} + +force_stop() { + if status ; then + stop + status && kill -KILL $(cat "$pidfile") + fi +} + + +case "$1" in + force-start|start|stop|force-stop|restart) + trace "Attempting '$1' on wazuh-dashboard" + ;; +esac + +case "$1" in + force-start) + PRESTART=no + exec "$0" start + ;; + start) + status + code=$? + if [ $code -eq 0 ]; then + emit "$name is already running" + exit $code + else + start + exit $? + fi + ;; + stop) stop ;; + force-stop) force_stop ;; + status) + status + code=$? + if [ $code -eq 0 ] ; then + emit "$name is running" + else + emit "$name is not running" + fi + exit $code + ;; + restart) + + stop && start + ;; + *) + echo "Usage: $SCRIPTNAME {start|force-start|stop|force-start|force-stop|status|restart}" >&2 + exit 3 + ;; +esac + +exit $? + diff --git a/dev-tools/build-packages/config/wazuh-dashboard.service b/dev-tools/build-packages/config/wazuh-dashboard.service new file mode 100644 index 000000000000..3fd27c5a1ab9 --- /dev/null +++ b/dev-tools/build-packages/config/wazuh-dashboard.service @@ -0,0 +1,15 @@ +[Unit] +Description=wazuh-dashboard + +[Service] +Type=simple +User=wazuh-dashboard +Group=wazuh-dashboard +EnvironmentFile=-/etc/default/wazuh-dashboard +EnvironmentFile=-/etc/sysconfig/wazuh-dashboard +ExecStart=/usr/share/wazuh-dashboard/bin/opensearch-dashboards "-c /etc/wazuh-dashboard/opensearch_dashboards.yml" +WorkingDirectory=/usr/share/wazuh-dashboard + +[Install] +WantedBy=multi-user.target + diff --git a/dev-tools/build-packages/deb/builder.sh b/dev-tools/build-packages/deb/builder.sh new file mode 100755 index 000000000000..681623489fa9 --- /dev/null +++ b/dev-tools/build-packages/deb/builder.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# Wazuh package builder +# Copyright (C) 2021, Wazuh Inc. +# +# This program is a free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public +# License (version 2) as published by the FSF - Free Software +# Foundation. + +set -e + +# Script parameters to build the package +target="wazuh-dashboard" +architecture=$1 +revision=$2 +version=$3 +directory_base="/usr/share/wazuh-dashboard" + +# Build directories +build_dir=/build +pkg_name="${target}-${version}" +pkg_path="${build_dir}/${target}" +source_dir="${pkg_path}/${pkg_name}" +deb_file="${target}_${version}-${revision}_${architecture}.deb" + +mkdir -p ${source_dir}/debian + +# Including spec file +cp -r /root/build-packages/deb/debian/* ${source_dir}/debian/ + +# Generating directory structure to build the .deb package +cd ${build_dir}/${target} && tar -czf ${pkg_name}.orig.tar.gz "${pkg_name}" + +# Configure the package with the different parameters +sed -i "s:VERSION:${version}:g" ${source_dir}/debian/changelog +sed -i "s:RELEASE:${revision}:g" ${source_dir}/debian/changelog +sed -i "s:export INSTALLATION_DIR=.*:export INSTALLATION_DIR=${directory_base}:g" ${source_dir}/debian/rules + +# Installing build dependencies +cd ${source_dir} +mk-build-deps -ir -t "apt-get -o Debug::pkgProblemResolver=yes -y" + +# Build package +debuild --no-lintian -b -uc -us \ + -eINSTALLATION_DIR="${directory_base}" \ + -eVERSION="${version}" \ + -eREVISION="${revision}" + +cd ${pkg_path} && sha512sum ${deb_file} >/tmp/${deb_file}.sha512 +mv ${pkg_path}/${deb_file} /tmp/ diff --git a/dev-tools/build-packages/deb/debian/changelog b/dev-tools/build-packages/deb/debian/changelog new file mode 100644 index 000000000000..3a5ac0f89eb2 --- /dev/null +++ b/dev-tools/build-packages/deb/debian/changelog @@ -0,0 +1,95 @@ +wazuh-dashboard (VERSION-RELEASE) unstable; urgency=low + + * More info: https://documentation.wazuh.com/current/release-notes/ + + -- Wazuh, Inc Fri, 05 May 2023 12:31:50 +0000 + +wazuh-dashboard (4.4.2-RELEASE) stable; urgency=low + + * More info: https://documentation.wazuh.com/current/release-notes/ + + -- Wazuh, Inc Mon, 24 Apr 2023 12:31:50 +0000 + +wazuh-dashboard (4.4.1-RELEASE) stable; urgency=low + + * More info: https://documentation.wazuh.com/current/release-notes/ + + -- Wazuh, Inc Mon, 17 Apr 2023 12:31:50 +0000 + +wazuh-dashboard (4.4.0-RELEASE) stable; urgency=low + + * More info: https://documentation.wazuh.com/current/release-notes/ + + -- Wazuh, Inc Wed, 18 Jan 2023 12:31:50 +0000 + +wazuh-dashboard (4.3.10-RELEASE) unstable; urgency=low + + * More info: https://documentation.wazuh.com/current/release-notes/ + + -- Wazuh, Inc Thu, 10 Nov 2022 15:00:00 +0000 + +wazuh-dashboard (4.3.9-RELEASE) unstable; urgency=low + + * More info: https://documentation.wazuh.com/current/release-notes/ + + -- Wazuh, Inc Mon, 03 Oct 2022 15:00:00 +0000 + +wazuh-dashboard (4.3.8-RELEASE) unstable; urgency=low + + * More info: https://documentation.wazuh.com/current/release-notes/ + + -- Wazuh, Inc Mon, 19 Sep 2022 15:00:00 +0000 + +wazuh-dashboard (4.3.7-RELEASE) unstable; urgency=low + + * More info: https://documentation.wazuh.com/current/release-notes/ + + -- Wazuh, Inc Mon, 08 Aug 2022 15:00:00 +0000 + +wazuh-dashboard (4.3.6-RELEASE) unstable; urgency=low + + * More info: https://documentation.wazuh.com/current/release-notes/ + + -- Wazuh, Inc Thu, 07 Jul 2022 15:00:00 +0000 + +wazuh-dashboard (4.3.5-RELEASE) unstable; urgency=low + + * More info: https://documentation.wazuh.com/current/release-notes/ + + -- Wazuh, Inc Wed, 29 Jun 2022 15:00:00 +0000 + +wazuh-dashboard (4.3.4-RELEASE) unstable; urgency=low + + * More info: https://documentation.wazuh.com/current/release-notes/ + + -- Wazuh, Inc Tue, 07 Jun 2022 15:41:39 +0000 + +wazuh-dashboard (4.3.3-RELEASE) unstable; urgency=low + + * More info: https://documentation.wazuh.com/current/release-notes/ + + -- Wazuh, Inc Tue, 31 May 2022 15:41:39 +0000 + +wazuh-dashboard (4.3.2-RELEASE) unstable; urgency=low + + * More info: https://documentation.wazuh.com/current/release-notes/ + + -- Wazuh, Inc Mon, 30 May 2022 15:41:39 +0000 + +wazuh-dashboard (4.3.1-RELEASE) unstable; urgency=low + + * More info: https://documentation.wazuh.com/current/release-notes/ + + -- Wazuh, Inc Wed, 18 May 2022 12:14:41 +0000 + +wazuh-dashboard (4.3.0-RELEASE) unstable; urgency=low + + * More info: https://documentation.wazuh.com/current/release-notes/ + + -- Wazuh, Inc Thu, 05 May 2022 12:15:57 +0000 + +wazuh-dashboard (4.2.5-1) UNRELEASED; urgency=low + + * More info: https://documentation.wazuh.com/current/release-notes/ + + -- Wazuh, Inc Mon, 15 Nov 2021 16:47:07 +0000 diff --git a/dev-tools/build-packages/deb/debian/control b/dev-tools/build-packages/deb/debian/control new file mode 100644 index 000000000000..5f35b4f6e601 --- /dev/null +++ b/dev-tools/build-packages/deb/debian/control @@ -0,0 +1,12 @@ +Source: wazuh-dashboard +Section: admin +Priority: extra +Maintainer: Wazuh, Inc +Build-Depends: debhelper-compat (= 12) +Standards-Version: 4.5.0 +Homepage: https://www.wazuh.com + +Package: wazuh-dashboard +Architecture: any +Depends: debconf, adduser, curl, tar, libcap2-bin +Description: Wazuh dashboard is a user interface and visualization tool for security-related data. This Wazuh central component enables exploring, visualizing, and analyzing the stored security alerts generated by the Wazuh server. Wazuh dashboard enables inspecting the status and managing the configurations of the Wazuh cluster and agents as well as creating and managing users and roles. In addition, it allows testing the ruleset and making calls to the Wazuh API. Documentation can be found at https://documentation.wazuh.com/current/getting-started/components/wazuh-dashboard.html diff --git a/dev-tools/build-packages/deb/debian/copyright b/dev-tools/build-packages/deb/debian/copyright new file mode 100644 index 000000000000..d2003bbbead7 --- /dev/null +++ b/dev-tools/build-packages/deb/debian/copyright @@ -0,0 +1,22 @@ +This work was packaged for Debian by: + + Wazuh, Inc on Sat, 04 Dec 2021 14:04:26 +0000 + +It was downloaded from: + + https://www.wazuh.com + +Copyright: + + GNU General Public License version 2. + +License: + + GNU General Public License version 2. + +The Debian packaging is: + + Copyright (C) 2021 Wazuh, Inc + +and is licensed under the GPL version 2, +see "/usr/share/common-licenses/GPL-2". \ No newline at end of file diff --git a/dev-tools/build-packages/deb/debian/postinst b/dev-tools/build-packages/deb/debian/postinst new file mode 100644 index 000000000000..232c1d0316ce --- /dev/null +++ b/dev-tools/build-packages/deb/debian/postinst @@ -0,0 +1,53 @@ +#!/bin/sh +# postinst script for wazuh-dashboard +# Copyright (C) 2021, Wazuh Inc. +# +# This program is a free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public +# License (version 2) as published by the FSF - Free Software +# Foundation. + +set -e + +export NAME=wazuh-dashboard +export CONFIG_DIR=/etc/"${NAME}" +export INSTALLATION_DIR=/usr/share/"${NAME}" +export PID_DIR=/run/"${NAME}" + +# Setting Owner and group of own folders +mkdir -p "${PID_DIR}" +chown -R "${NAME}":"${NAME}" "${PID_DIR}" + +case "$1" in +configure) + chmod 750 "${TARGET_DIR}""${CONFIG_DIR}" + chown -R "${NAME}":"${NAME}" "${TARGET_DIR}""${CONFIG_DIR}" + chmod 750 "${TARGET_DIR}""${INSTALLATION_DIR}" + chown -R "${NAME}":"${NAME}" "${TARGET_DIR}""${INSTALLATION_DIR}" + setcap 'cap_net_bind_service=+ep' "${INSTALLATION_DIR}"/node/bin/node + if [ -f "${INSTALLATION_DIR}"/"${NAME}".restart ]; then + rm -f "${INSTALLATION_DIR}"/"${NAME}".restart + if command -v systemctl >/dev/null 2>&1 && systemctl >/dev/null 2>&1; then + systemctl daemon-reload >/dev/null 2>&1 + systemctl restart wazuh-dashboard.service >/dev/null 2>&1 + elif command -v service >/dev/null 2>&1 && service wazuh-dashboard status 2>/dev/null | grep "running" >/dev/null 2>&1; then + service wazuh-dashboard restart >/dev/null 2>&1 + fi + fi + if [ ! -f "${INSTALLATION_DIR}"/config/opensearch_dashboards.keystore ]; then + runuser "${NAME}" --shell="/bin/bash" --command="${INSTALLATION_DIR}/bin/opensearch-dashboards-keystore create" >/dev/null 2>&1 + runuser "${NAME}" --shell="/bin/bash" --command="echo kibanaserver | ${INSTALLATION_DIR}/bin/opensearch-dashboards-keystore add opensearch.username --stdin" >/dev/null 2>&1 + runuser "${NAME}" --shell="/bin/bash" --command="echo kibanaserver | ${INSTALLATION_DIR}/bin/opensearch-dashboards-keystore add opensearch.password --stdin" >/dev/null 2>&1 + fi + ;; + +abort-upgrade | abort-remove | abort-deconfigure) ;; + +*) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; + +esac + +exit 0 diff --git a/dev-tools/build-packages/deb/debian/postrm b/dev-tools/build-packages/deb/debian/postrm new file mode 100644 index 000000000000..a5b88616434f --- /dev/null +++ b/dev-tools/build-packages/deb/debian/postrm @@ -0,0 +1,82 @@ +#!/bin/sh +# postinst script for wazuh-dashboard +# Copyright (C) 2021, Wazuh Inc. +# +# This program is a free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public +# License (version 2) as published by the FSF - Free Software +# Foundation. + +set -e + +export NAME=wazuh-dashboard +export CONFIG_DIR=/etc/"${NAME}" +export INSTALLATION_DIR=/usr/share/"${NAME}" +export PID_DIR=/run/${NAME} + +# +# This script is executed in the post-removal phase +# +# On Debian, +# $1=remove : indicates a removal +# $1=purge : indicates an upgrade + +# source the default env file +if [ -f "/etc/default/${NAME}" ]; then + . "/etc/default/${NAME}" +fi + +REMOVE_DIRS=false +REMOVE_CONFIG_DIRECTORY=false +REMOVE_USER_AND_GROUP=false + +case "$1" in +remove) + REMOVE_DIRS=true + ;; + +purge) + REMOVE_DIRS=true + REMOVE_CONFIG_DIRECTORY=true + REMOVE_USER_AND_GROUP=true + ;; +failed-upgrade | abort-install | upgrade | abort-upgrade | disappear) ;; + +*) + + echo "post remove script called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +if [ "$REMOVE_DIRS" = "true" ]; then + + if [ -d ${PID_DIR} ]; then + echo -n "Deleting PID directory..." + rm -rf ${PID_DIR} >/dev/null 2>&1 + echo " OK" + fi + + if [ -d "${INSTALLATION_DIR}" ]; then + echo -n "Deleting installation directory..." + rm -rf "${INSTALLATION_DIR}" + echo " OK" + fi + + # Delete the config directory if we are purging + if [ "$REMOVE_CONFIG_DIRECTORY" = "true" ]; then + rm -rf "${CONFIG_DIR}" + echo " OK" + fi + +fi + +if [ "$REMOVE_USER_AND_GROUP" = "true" ]; then + if id "${NAME}" >/dev/null 2>&1; then + userdel "${NAME}" + fi + + if getent group "${NAME}" >/dev/null 2>&1; then + groupdel "${NAME}" + fi +fi diff --git a/dev-tools/build-packages/deb/debian/preinst b/dev-tools/build-packages/deb/debian/preinst new file mode 100644 index 000000000000..1d955fd8dc1c --- /dev/null +++ b/dev-tools/build-packages/deb/debian/preinst @@ -0,0 +1,73 @@ +#!/bin/sh +# postinst script for wazuh-dashboard +# Copyright (C) 2021, Wazuh Inc. +# +# This program is a free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public +# License (version 2) as published by the FSF - Free Software +# Foundation. + +set -e + +# +# This script is executed in the pre-installation phase +# +# On Debian, +# $1=install : indicates an new install +# $1=upgrade : indicates an upgrade + +# configuration variables +export NAME=wazuh-dashboard +export CONFIG_DIR=/etc/"${NAME}" +export INSTALLATION_DIR=/usr/share/"${NAME}" + +case "$1" in +# Debian #################################################### +install) + # environment configuration + mkdir -p "${CONFIG_DIR}" + mkdir -p "${INSTALLATION_DIR}" + + # Create wazuh-dashboard group if not existing + if ! getent group "${NAME}" >/dev/null 2>&1; then + echo -n "Creating ${NAME} group..." + addgroup --quiet --system "${NAME}" + echo " OK" + fi + # Create wazuh-dashboard user if not existing + if ! id "${NAME}" >/dev/null 2>&1; then + echo -n "Creating ${NAME} user..." + adduser --quiet \ + --system \ + --no-create-home \ + --home /nonexistent \ + --ingroup "${NAME}" \ + --disabled-password \ + --shell /bin/false \ + "${NAME}" + echo " OK" + fi + + ;; +upgrade) + # Stop the services to upgrade the package + if command -v systemctl >/dev/null 2>&1 && systemctl >/dev/null 2>&1 && systemctl is-active --quiet "${NAME}" >/dev/null 2>&1; then + systemctl stop "${NAME}".service >/dev/null 2>&1 + touch "${INSTALLATION_DIR}"/"${NAME}".restart + # Check for SysV + elif command -v service >/dev/null 2>&1 && service "${NAME}" status 2>/dev/null | grep "running" >/dev/null 2>&1; then + service "${NAME}" stop >/dev/null 2>&1 + touch "${INSTALLATION_DIR}"/"${NAME}".restart + fi + ;; +abort-deconfigure | abort-upgrade | abort-remove) ;; + +*) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + + ;; + +esac + +exit 0 diff --git a/dev-tools/build-packages/deb/debian/prerm b/dev-tools/build-packages/deb/debian/prerm new file mode 100644 index 000000000000..eef54075a11b --- /dev/null +++ b/dev-tools/build-packages/deb/debian/prerm @@ -0,0 +1,82 @@ +#!/bin/sh +# postinst script for wazuh-dashboard +# Copyright (C) 2021, Wazuh Inc. +# +# This program is a free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public +# License (version 2) as published by the FSF - Free Software +# Foundation. + +set -e + +export NAME=wazuh-dashboard +export CONFIG_DIR=/etc/"${NAME}" +export INSTALLATION_DIR=/usr/share/"${NAME}" + +# +# This script is executed in the pre-remove phase +# +# On Debian, +# $1=remove : indicates a removal +# $1=upgrade : indicates an upgrade + +# source the default env file +if [ -f "/etc/default/${NAME}" ]; then + . "/etc/default/${NAME}" +fi + +STOP_REQUIRED=false +REMOVE_SERVICE=false + +case "$1" in + +# Debian #################################################### +remove) + STOP_REQUIRED=true + REMOVE_SERVICE=true + ;; +upgrade | deconfigure | failed-upgrade) ;; + +*) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; + +esac + +# Stops the service +if [ "$STOP_REQUIRED" = "true" ]; then + echo -n "Stopping wazuh-dashboard service..." + if command -v systemctl >/dev/null; then + systemctl --no-reload stop "${NAME}".service + + elif [ -x /etc/init.d/"${NAME}" ]; then + if command -v invoke-rc.d >/dev/null; then + invoke-rc.d "${NAME}" stop + else + /etc/init.d/"${NAME}" 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 wazuh-dashboard service on these + # as well without failing this script + elif [ -x /etc/rc.d/init.d/"${NAME}" ]; then + /etc/rc.d/init.d/"${NAME}" stop + fi + echo " OK" +fi + +if [ "$REMOVE_SERVICE" = "true" ]; then + if command -v systemctl >/dev/null; then + systemctl disable "${NAME}".service >/dev/null 2>&1 || true + fi + + if command -v chkconfig >/dev/null; then + chkconfig --del "${NAME}" 2>/dev/null || true + fi + + if command -v update-rc.d >/dev/null; then + update-rc.d "${NAME}" remove >/dev/null || true + fi +fi diff --git a/dev-tools/build-packages/deb/debian/rules b/dev-tools/build-packages/deb/debian/rules new file mode 100644 index 000000000000..98638dab5602 --- /dev/null +++ b/dev-tools/build-packages/deb/debian/rules @@ -0,0 +1,112 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. +# +# Modified to make a template file for a multi-binary package with separated +# build-arch and build-indep targets by Bill Allombert 2001 +# +# Modified by Wazuh +# Copyright (C) 2021, Wazuh Inc. +# +# This program is a free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public +# License (version 2) as published by the FSF - Free Software +# Foundation. + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 + +# This has to be exported to make some magic below work. +export DH_OPTIONS + +export TARGET_DIR=${CURDIR}/debian/wazuh-dashboard +export NAME=wazuh-dashboard +export CONFIG_DIR=/etc/$(NAME) +export INSTALLATION_DIR=$(INSTALLATION_DIR) +export USER=$(NAME) +export GROUP=$(NAME) +export DASHBOARD_FILE=wazuh-dashboard.tar.gz + +# ----------------------------------------------------------------------------- + +%: + dh $@ + +# ----------------------------------------------------------------------------- + +override_dh_shlibdeps: + +# ----------------------------------------------------------------------------- + +override_dh_auto_configure: + +# ----------------------------------------------------------------------------- + +override_dh_auto_install: + +# ----------------------------------------------------------------------------- + +override_dh_install: + cp /opt/$(DASHBOARD_FILE) ./ + + groupadd $(GROUP) + useradd -g $(GROUP) $(USER) + + tar -xf $(DASHBOARD_FILE) + + mkdir -p $(TARGET_DIR)$(CONFIG_DIR) + mkdir -p $(TARGET_DIR)$(INSTALLATION_DIR) + mkdir -p $(TARGET_DIR)/etc/systemd/system + mkdir -p $(TARGET_DIR)/etc/default + + cp wazuh-dashboard-base/config/node.options $(TARGET_DIR)$(CONFIG_DIR) + cp wazuh-dashboard-base/config/opensearch_dashboards.yml $(TARGET_DIR)$(CONFIG_DIR) + mv wazuh-dashboard-base/* $(TARGET_DIR)$(INSTALLATION_DIR) + + mkdir -p $(TARGET_DIR)$(INSTALLATION_DIR)/config + + cp $(TARGET_DIR)$(INSTALLATION_DIR)/wazuh-dashboard.service $(TARGET_DIR)/etc/systemd/system/wazuh-dashboard.service + cp $(TARGET_DIR)$(INSTALLATION_DIR)/wazuh-dashboard $(TARGET_DIR)/etc/systemd/system/$(NAME) + cp $(TARGET_DIR)$(INSTALLATION_DIR)/default $(TARGET_DIR)/etc/default/$(NAME) + + rm -rf $(TARGET_DIR)$(INSTALLATION_DIR)/etc + + chown -R $(USER):$(GROUP) $(TARGET_DIR)$(INSTALLATION_DIR) + chown -R $(USER):$(GROUP) $(TARGET_DIR)$(CONFIG_DIR) + + find $(TARGET_DIR)$(INSTALLATION_DIR)/plugins/wazuh/ -exec chown $(USER):$(GROUP) {} \; + +# ----------------------------------------------------------------------------- + +override_dh_fixperms: + chmod 750 $(TARGET_DIR)$(CONFIG_DIR) + chown -R $(USER):$(GROUP) $(TARGET_DIR)$(CONFIG_DIR) + chmod 750 $(TARGET_DIR)$(INSTALLATION_DIR) + chown -R $(USER):$(GROUP) $(TARGET_DIR)$(INSTALLATION_DIR) + chown root:root $(TARGET_DIR)/etc/systemd/system/wazuh-dashboard.service + chown root:root $(TARGET_DIR)/etc/systemd/system/"$(NAME)" + chown $(USER):$(GROUP) $(TARGET_DIR)/etc/default/"$(NAME)" + chown $(USER):$(GROUP) $(TARGET_DIR)$(INSTALLATION_DIR)/VERSION + chmod 440 $(TARGET_DIR)$(INSTALLATION_DIR)/VERSION + chmod 750 $(TARGET_DIR)/etc/systemd/system/wazuh-dashboard + chmod 750 $(TARGET_DIR)/etc/default/wazuh-dashboard + chmod 640 "$(TARGET_DIR)$(CONFIG_DIR)"/node.options + chmod 640 $(TARGET_DIR)/etc/systemd/system/wazuh-dashboard.service + find "$(TARGET_DIR)$(INSTALLATION_DIR)" -type d -exec chmod 750 {} \; + find "$(TARGET_DIR)$(INSTALLATION_DIR)" -type f -perm 644 -exec chmod 640 {} \; + find "$(TARGET_DIR)$(INSTALLATION_DIR)" -type f -perm 755 -exec chmod 750 {} \; + find "$(TARGET_DIR)$(INSTALLATION_DIR)" -type f -perm 744 -exec chmod 740 {} \; + +# ----------------------------------------------------------------------------- + +override_dh_strip: + dh_strip --no-automatic-dbgsym -XlibGLESv2.so -XlibEGL.so + +# ----------------------------------------------------------------------------- + +.PHONY: override_dh_strip override_dh_auto_clean override_dh_auto_build override_dh_auto_configure diff --git a/dev-tools/build-packages/deb/docker/amd64/Dockerfile b/dev-tools/build-packages/deb/docker/amd64/Dockerfile new file mode 100644 index 000000000000..f3ca3b981113 --- /dev/null +++ b/dev-tools/build-packages/deb/docker/amd64/Dockerfile @@ -0,0 +1,16 @@ +FROM debian:10 + +ENV DEBIAN_FRONTEND noninteractive + +# Installing necessary packages +RUN apt-get update && apt-get install -y --allow-change-held-packages apt-utils && \ + apt-get install -y --allow-change-held-packages \ + curl sudo wget expect gnupg build-essential \ + devscripts equivs selinux-basics procps gawk + +# Add the script to build the Debian package +ADD builder.sh /usr/local/bin/builder +RUN chmod +x /usr/local/bin/builder + +# Set the entrypoint +ENTRYPOINT ["/usr/local/bin/builder"] \ No newline at end of file diff --git a/dev-tools/build-packages/deb/launcher.sh b/dev-tools/build-packages/deb/launcher.sh new file mode 100755 index 000000000000..090bcb96a71b --- /dev/null +++ b/dev-tools/build-packages/deb/launcher.sh @@ -0,0 +1,195 @@ +#!/bin/bash + +# Wazuh package generator +# Copyright (C) 2021, Wazuh Inc. +# +# This program is a free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public +# License (version 2) as published by the FSF - Free Software +# Foundation. + +# Inputs +package="" +version="" +revision="1" +architecture="amd64" +build_base="yes" +build_docker="yes" + +# Constants +deb_amd64_builder="deb_dashboard_builder_amd64" +deb_builder_dockerfile="${current_path}/docker" + +# Paths +current_path="$( cd $(dirname $0) ; pwd -P )" +config_path=$(realpath $current_path/../config) + +# Folders +out_dir="${current_path}/output" +tmp_dir="${current_path}/tmp" + +trap ctrl_c INT + +clean() { + exit_code=$1 + echo + echo "Cleaning temporary files..." + echo + # Clean the files + rm -r $tmp_dir + rm $current_path/docker/amd64/*.sh + if [ $exit_code != 0 ]; then + rm $out_dir/* + rmdir $out_dir + fi + + exit ${exit_code} +} + +ctrl_c() { + clean 1 +} + +build_deb() { + container_name="$1" + dockerfile_path="$2" + + # Validate and download files to build the package + valid_url='(https?|ftp|file)://[-[:alnum:]\+&@#/%?=~_|!:,.;]*[-[:alnum:]\+&@#/%=~_|]' + + echo + echo "Downloading files..." + echo + + mkdir -p $tmp_dir + cd $tmp_dir + + if [[ $package =~ $valid_url ]]; then + if ! curl --output wazuh-dashboard.tar.gz --silent --fail "${package}"; then + echo "The given URL or Path to the Wazuh Dashboard package is not working: ${package}" + clean 1 + fi + else + echo "The given URL or Path to the Wazuh Dashboard package is not valid: ${package}" + clean 1 + fi + + echo + echo Building the package... + echo + + # Prepare the package + directory_name=$(tar tf wazuh-dashboard.tar.gz | head -1 | sed 's#/.*##' | sort -u) + tar -zxf wazuh-dashboard.tar.gz + rm wazuh-dashboard.tar.gz + mv $directory_name wazuh-dashboard-base + cp $config_path/* wazuh-dashboard-base + echo ${version} >wazuh-dashboard-base/VERSION + tar -czf ./wazuh-dashboard.tar.gz wazuh-dashboard-base + + # Copy the necessary files + cp ${current_path}/builder.sh ${dockerfile_path} + + # Build the Docker image + if [[ ${build_docker} == "yes" ]]; then + docker build -t ${container_name} ${dockerfile_path} || return 1 + fi + + # Build the Debian package with a Docker container + if [ ! -d "$out_dir" ]; then + mkdir -p $out_dir + fi + volumes="-v ${out_dir}/:/tmp:Z -v ${tmp_dir}/wazuh-dashboard.tar.gz:/opt/wazuh-dashboard.tar.gz" + docker run -t --rm ${volumes} \ + -v ${current_path}/../..:/root:Z \ + ${container_name} ${architecture} \ + ${revision} ${version} || return 1 + + echo "Package $(ls -Art ${out_dir} | tail -n 1) added to ${out_dir}." + + echo + echo DONE! + echo + + return 0 +} + +build() { + build_name="${deb_amd64_builder}" + file_path="../${deb_builder_dockerfile}/${architecture}" + build_deb ${build_name} ${file_path} || return 1 + return 0 +} + +help() { + echo + echo "Usage: $0 [OPTIONS]" + echo + echo " -v, --version Wazuh version" + echo " -p, --package Set the location of the .tar.gz file containing the Wazuh Dashboard package." + echo " -r, --revision [Optional] Package revision. By default: 1." + echo " -o, --output [Optional] Set the destination path of package. By default, an output folder will be created." + echo " --dont-build-docker [Optional] Locally built Docker image will be used instead of generating a new one." + echo " -h, --help Show this help." + echo + exit $1 +} + +main() { + while [ -n "${1}" ]; do + case "${1}" in + "-h" | "--help") + help 0 + ;; + "-p" | "--package") + if [ -n "${2}" ]; then + package="${2}" + shift 2 + else + help 1 + fi + ;; + "-v" | "--version") + if [ -n "${2}" ]; then + version="${2}" + shift 2 + else + help 1 + fi + ;; + "-r" | "--revision") + if [ -n "${2}" ]; then + revision="${2}" + shift 2 + else + help 1 + fi + ;; + "--dont-build-docker") + build_docker="no" + shift 1 + ;; + "-o" | "--output") + if [ -n "${2}" ]; then + out_dir="${2}" + shift 2 + else + help 1 + fi + ;; + *) + help 1 + ;; + esac + done + + if [ -z "$package" ] | [ -z "$version" ]; then + help 1 + fi + + build || clean 1 + + clean 0 +} + +main "$@" diff --git a/dev-tools/build-packages/rpm/builder.sh b/dev-tools/build-packages/rpm/builder.sh new file mode 100755 index 000000000000..f71f9476d038 --- /dev/null +++ b/dev-tools/build-packages/rpm/builder.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# Wazuh package builder +# Copyright (C) 2021, Wazuh Inc. +# +# This program is a free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public +# License (version 2) as published by the FSF - Free Software +# Foundation. + +set -e + +# Script parameters to build the package +target="wazuh-dashboard" +architecture=$1 +revision=$2 +version=$3 +directory_base="/usr/share/wazuh-dashboard" + +# Build directories +build_dir=/build +rpm_build_dir=${build_dir}/rpmbuild +pkg_name=${target}-${version} +pkg_path="${rpm_build_dir}/RPMS/${architecture}" +file_name="${target}-${version}-${revision}" +rpm_file="${file_name}.${architecture}.rpm" + +mkdir -p ${rpm_build_dir}/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} + +# Prepare the sources directory to build the source tar.gz +mkdir ${build_dir}/${pkg_name} + +# Including spec file +cp /root/build-packages/rpm/${target}.spec ${rpm_build_dir}/SPECS/${pkg_name}.spec + +# Generating source tar.gz +cd ${build_dir} && tar czf "${rpm_build_dir}/SOURCES/${pkg_name}.tar.gz" "${pkg_name}" + +# Building RPM +/usr/bin/rpmbuild -v \ + --define "_topdir ${rpm_build_dir}" \ + --define "_version ${version}" \ + --define "_release ${revision}" \ + --define "_localstatedir ${directory_base}" \ + --target ${architecture} \ + -ba ${rpm_build_dir}/SPECS/${pkg_name}.spec + +cd ${pkg_path} && sha512sum ${rpm_file} >/tmp/${rpm_file}.sha512 + +find ${pkg_path}/ -maxdepth 3 -type f -name "${file_name}*" -exec mv {} /tmp/ \; diff --git a/dev-tools/build-packages/rpm/docker/x86_64/Dockerfile b/dev-tools/build-packages/rpm/docker/x86_64/Dockerfile new file mode 100644 index 000000000000..eb6493d15878 --- /dev/null +++ b/dev-tools/build-packages/rpm/docker/x86_64/Dockerfile @@ -0,0 +1,21 @@ +FROM rockylinux:8.5 + +# Install all the necessary tools to build the packages +RUN yum clean all && yum update -y +RUN yum install -y openssh-clients sudo gnupg \ + yum-utils epel-release redhat-rpm-config rpm-devel \ + zlib zlib-devel rpm-build autoconf automake \ + glibc-devel libtool perl + +#RUN yum install -y --nobest https://repo.ius.io/ius-release-el7.rpm + +RUN yum update -y && yum install -y python3 + +RUN ln -fs /usr/bin/python3.6 /usr/bin/python + +# Add the scripts to build the RPM package +ADD builder.sh /usr/local/bin/builder +RUN chmod +x /usr/local/bin/builder + +# Set the entrypoint +ENTRYPOINT ["/usr/local/bin/builder"] diff --git a/dev-tools/build-packages/rpm/launcher.sh b/dev-tools/build-packages/rpm/launcher.sh new file mode 100755 index 000000000000..ca9a67d4c1c4 --- /dev/null +++ b/dev-tools/build-packages/rpm/launcher.sh @@ -0,0 +1,198 @@ +#!/bin/bash + +# Wazuh package generator +# Copyright (C) 2021, Wazuh Inc. +# +# This program is a free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public +# License (version 2) as published by the FSF - Free Software +# Foundation. + +# Inputs +package="" +version="" +revision="1" +architecture="x86_64" +build_base="yes" +build_docker="yes" + +# Constants +rpm_x86_builder="rpm_dashboard_builder_x86" +rpm_builder_dockerfile="${current_path}/docker" + +# Paths +current_path="$( cd $(dirname $0) ; pwd -P )" +config_path=$(realpath $current_path/../config) + +# Folders +out_dir="${current_path}/output" +tmp_dir="${current_path}/tmp" + +trap ctrl_c INT + +clean() { + exit_code=$1 + echo + echo "Cleaning temporary files..." + echo + # Clean the files + rm -r $tmp_dir + rm $current_path/docker/x86_64/*.sh + + if [ $exit_code != 0 ]; then + rm $out_dir/* + rmdir $out_dir + fi + + exit ${exit_code} +} + +ctrl_c() { + clean 1 +} + +build_rpm() { + container_name="$1" + dockerfile_path="$2" + + # Validate and download files to build the package + valid_url='(https?|ftp|file)://[-[:alnum:]\+&@#/%?=~_|!:,.;]*[-[:alnum:]\+&@#/%=~_|]' + + echo + echo "Downloading files..." + echo + + mkdir -p $tmp_dir + cd $tmp_dir + + if [[ $package =~ $valid_url ]]; then + if ! curl --output wazuh-dashboard.tar.gz --silent --fail "${package}"; then + echo "The given URL or Path to the Wazuh Dashboard package is not working: ${package}" + clean 1 + fi + else + echo "The given URL or Path to the Wazuh Dashboard package is not valid: ${package}" + clean 1 + fi + + echo + echo Building the package... + echo + + # Prepare the package + directory_name=$(tar tf wazuh-dashboard.tar.gz | head -1 | sed 's#/.*##' | sort -u) + tar -zxf wazuh-dashboard.tar.gz + rm wazuh-dashboard.tar.gz + mv $directory_name wazuh-dashboard-base + mkdir -p wazuh-dashboard-base/etc/services + cp $config_path/* wazuh-dashboard-base/etc/services + echo ${version} >wazuh-dashboard-base/VERSION + tar -czf ./wazuh-dashboard.tar.gz wazuh-dashboard-base + + # Copy the necessary files + cp ${current_path}/builder.sh ${dockerfile_path} + + # Build the Docker image + if [[ ${build_docker} == "yes" ]]; then + docker build -t ${container_name} ${dockerfile_path} || return 1 + fi + + # Build the RPM package with a Docker container + + if [ ! -d "$out_dir" ]; then + mkdir -p $out_dir + fi + volumes="-v ${out_dir}/:/tmp:Z -v ${tmp_dir}/wazuh-dashboard.tar.gz:/opt/wazuh-dashboard.tar.gz" + docker run -t --rm ${volumes} \ + -v ${current_path}/../..:/root:Z \ + ${container_name} ${architecture} \ + ${revision} ${version} || return 1 + + echo "Package $(ls -Art ${out_dir} | tail -n 1) added to ${out_dir}." + + echo + echo DONE! + echo + + return 0 +} + +build() { + build_name="${rpm_x86_builder}" + file_path="../${rpm_builder_dockerfile}/${architecture}" + build_rpm ${build_name} ${file_path} || return 1 + return 0 +} + +help() { + echo + echo "Usage: $0 [OPTIONS]" + echo + echo " -v, --version Wazuh version" + echo " -p, --package Set the location of the .tar.gz file containing the Wazuh Dashboard package." + echo " -r, --revision [Optional] Package revision. By default: 1." + echo " -o, --output [Optional] Set the destination path of package. By default, an output folder will be created." + echo " --dont-build-docker [Optional] Locally built Docker image will be used instead of generating a new one." + echo " -h, --help Show this help." + echo + exit $1 +} + +main() { + while [ -n "${1}" ]; do + case "${1}" in + "-h" | "--help") + help 0 + ;; + "-p" | "--package") + if [ -n "${2}" ]; then + package="${2}" + shift 2 + else + help 1 + fi + ;; + "-v" | "--version") + if [ -n "${2}" ]; then + version="${2}" + shift 2 + else + help 1 + fi + ;; + "-r" | "--revision") + if [ -n "${2}" ]; then + revision="${2}" + shift 2 + else + help 1 + fi + ;; + "--dont-build-docker") + build_docker="no" + shift 1 + ;; + "-o" | "--output") + if [ -n "${2}" ]; then + outdir="${2}" + shift 2 + else + help 1 + fi + ;; + *) + help 1 + ;; + esac + done + + if [ -z "$package" ] | [ -z "$version" ]; then + help 1 + fi + + build || clean 1 + + clean 0 +} + +main "$@" diff --git a/dev-tools/build-packages/rpm/wazuh-dashboard.spec b/dev-tools/build-packages/rpm/wazuh-dashboard.spec new file mode 100644 index 000000000000..39e5c924d453 --- /dev/null +++ b/dev-tools/build-packages/rpm/wazuh-dashboard.spec @@ -0,0 +1,427 @@ +# Wazuh dashboard SPEC +# Copyright (C) 2021, Wazuh Inc. +# +# This program is a free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public +# License (version 2) as published by the FSF - Free Software +# Foundation. +Summary: Wazuh dashboard is a user interface and visualization tool for security-related data. Documentation can be found at https://documentation.wazuh.com/current/getting-started/components/wazuh-dashboard.html +Name: wazuh-dashboard +Version: %{_version} +Release: %{_release} +License: GPL +Group: System Environment/Daemons +Source0: %{name}-%{version}.tar.gz +URL: https://www.wazuh.com/ +buildroot: %{_tmppath}/%{name}-%{version}-%{release}-wazuh-dashboard-%(%{__id_u} -n) +Vendor: Wazuh, Inc +Packager: Wazuh, Inc +Requires(pre): /usr/sbin/groupadd /usr/sbin/useradd +Requires(preun): /sbin/service +Requires(postun): /sbin/service +AutoReqProv: no +Requires: libcap +ExclusiveOS: linux + +# ----------------------------------------------------------------------------- + +%global USER %{name} +%global GROUP %{name} +%global CONFIG_DIR /etc/%{name} +%global PID_DIR /run/%{name} +%global INSTALL_DIR /usr/share/%{name} +%global DASHBOARD_FILE wazuh-dashboard.tar.gz +%define _source_payload w9.gzdio +%define _binary_payload w9.gzdio + +# ----------------------------------------------------------------------------- + + +%description +Wazuh dashboard is a user interface and visualization tool for security-related data. This Wazuh central component enables exploring, visualizing, and analyzing the stored security alerts generated by the Wazuh server. Wazuh dashboard enables inspecting the status and managing the configurations of the Wazuh cluster and agents as well as creating and managing users and roles. In addition, it allows testing the ruleset and making calls to the Wazuh API. Documentation can be found at https://documentation.wazuh.com/current/getting-started/components/wazuh-dashboard.html + +# ----------------------------------------------------------------------------- + +%prep + +cp /opt/%{DASHBOARD_FILE} ./ + +groupadd %{GROUP} +useradd -g %{GROUP} %{USER} + +# ----------------------------------------------------------------------------- + +%build + +tar -xf %{DASHBOARD_FILE} + +# ----------------------------------------------------------------------------- + +%install + +mkdir -p %{buildroot}%{CONFIG_DIR} +mkdir -p %{buildroot}%{INSTALL_DIR} +mkdir -p %{buildroot}/etc/systemd/system +mkdir -p %{buildroot}%{_initrddir} +mkdir -p %{buildroot}/etc/default + +cp wazuh-dashboard-base/config/node.options %{buildroot}%{CONFIG_DIR} +cp wazuh-dashboard-base/config/opensearch_dashboards.yml %{buildroot}%{CONFIG_DIR} +cp wazuh-dashboard-base/VERSION %{buildroot}%{INSTALL_DIR} + +mv wazuh-dashboard-base/* %{buildroot}%{INSTALL_DIR} + +# Set custom welcome styles + +mkdir -p %{buildroot}%{INSTALL_DIR}/config + +cp %{buildroot}%{INSTALL_DIR}/etc/services/wazuh-dashboard.service %{buildroot}/etc/systemd/system/wazuh-dashboard.service +cp %{buildroot}%{INSTALL_DIR}/etc/services/default %{buildroot}/etc/default/wazuh-dashboard + +chmod 640 %{buildroot}/etc/systemd/system/wazuh-dashboard.service +chmod 640 %{buildroot}/etc/default/wazuh-dashboard + +rm -rf %{buildroot}%{INSTALL_DIR}/etc/ + +find %{buildroot}%{INSTALL_DIR} -exec chown %{USER}:%{GROUP} {} \; +find %{buildroot}%{CONFIG_DIR} -exec chown %{USER}:%{GROUP} {} \; + +chown root:root %{buildroot}/etc/systemd/system/wazuh-dashboard.service + +find %{buildroot}%{INSTALL_DIR}/plugins/wazuh/ -exec chown %{USER}:%{GROUP} {} \; +find %{buildroot}%{INSTALL_DIR}/plugins/wazuh/ -type f -perm 644 -exec chmod 640 {} \; +find %{buildroot}%{INSTALL_DIR}/plugins/wazuh/ -type f -perm 755 -exec chmod 750 {} \; +find %{buildroot}%{INSTALL_DIR}/plugins/wazuh/ -type d -exec chmod 750 {} \; +find %{buildroot}%{INSTALL_DIR}/plugins/wazuh/ -type f -perm 744 -exec chmod 740 {} \; + +# ----------------------------------------------------------------------------- + +%pre +# Create the wazuh-dashboard group if it doesn't exists +if [ $1 = 1 ]; then + if command -v getent > /dev/null 2>&1 && ! getent group %{GROUP} > /dev/null 2>&1; then + groupadd -r %{GROUP} + elif ! getent group %{GROUP} > /dev/null 2>&1; then + groupadd -r %{GROUP} + fi + # Create the wazuh-dashboard user if it doesn't exists + if ! getent passwd %{USER} > /dev/null 2>&1; then + useradd -g %{GROUP} -G %{USER} -d %{INSTALL_DIR}/ -r -s /sbin/nologin wazuh-dashboard + fi +fi +# Stop the services to upgrade the package +if [ $1 = 2 ]; then + if command -v systemctl > /dev/null 2>&1 && systemctl > /dev/null 2>&1 && systemctl is-active --quiet wazuh-dashboard > /dev/null 2>&1; then + systemctl stop wazuh-dashboard.service > /dev/null 2>&1 + touch %{INSTALL_DIR}/wazuh-dashboard.restart + # Check for SysV + elif command -v service > /dev/null 2>&1 && service wazuh-dashboard status 2>/dev/null | grep "is running" > /dev/null 2>&1; then + service wazuh-dashboard stop > /dev/null 2>&1 + touch %{INSTALL_DIR}/wazuh-dashboard.restart + fi +fi + +# ----------------------------------------------------------------------------- + +%post +setcap 'cap_net_bind_service=+ep' %{INSTALL_DIR}/node/bin/node + +if [ ! -f %{INSTALLATION_DIR}/config/opensearch_dashboards.keystore ]; then + runuser %{USER} --shell="/bin/bash" --command="%{INSTALL_DIR}/bin/opensearch-dashboards-keystore create" > /dev/null 2>&1 + runuser %{USER} --shell="/bin/bash" --command="echo kibanaserver | %{INSTALL_DIR}/bin/opensearch-dashboards-keystore add opensearch.username --stdin" > /dev/null 2>&1 + runuser %{USER} --shell="/bin/bash" --command="echo kibanaserver | %{INSTALL_DIR}/bin/opensearch-dashboards-keystore add opensearch.password --stdin" > /dev/null 2>&1 +fi + +# ----------------------------------------------------------------------------- + +%preun +if [ $1 = 0 ];then # Remove + echo -n "Stopping wazuh-dashboard service..." + if command -v systemctl > /dev/null 2>&1 && systemctl > /dev/null 2>&1; then + systemctl stop wazuh-dashboard.service > /dev/null 2>&1 + # Check for SysV + elif command -v service > /dev/null 2>&1; then + service wazuh-dashboard stop > /dev/null 2>&1 + fi +fi + +# ----------------------------------------------------------------------------- + +%postun +if [ $1 = 0 ];then + # If the package is been uninstalled + # Remove the wazuh-dashboard user if it exists + if getent passwd %{USER} > /dev/null 2>&1; then + userdel %{USER} >/dev/null 2>&1 + fi + # Remove the wazuh-dashboard group if it exists + if command -v getent > /dev/null 2>&1 && getent group %{GROUP} > /dev/null 2>&1; then + groupdel %{GROUP} >/dev/null 2>&1 + elif getent group %{GROUP} > /dev/null 2>&1; then + groupdel %{GROUP} >/dev/null 2>&1 + fi + + # Remove /etc/wazuh-dashboard and /usr/share/wazuh-dashboard dirs + rm -rf %{INSTALL_DIR} + if [ -d %{PID_DIR} ]; then + rm -rf %{PID_DIR} + fi +fi + +# ----------------------------------------------------------------------------- + +# posttrans code is the last thing executed in a install/upgrade +%posttrans +if [ ! -d %{PID_DIR} ]; then + mkdir -p %{PID_DIR} + chown %{USER}:%{GROUP} %{PID_DIR} +fi + +if [ -f %{INSTALL_DIR}/wazuh-dashboard.restart ]; then + rm -f %{INSTALL_DIR}/wazuh-dashboard.restart + if command -v systemctl > /dev/null 2>&1 && systemctl > /dev/null 2>&1; then + systemctl restart wazuh-dashboard.service > /dev/null 2>&1 + # Check for SysV + elif command -v service > /dev/null 2>&1; then + service wazuh-dashboard restart > /dev/null 2>&1 + fi + +fi + + +# ----------------------------------------------------------------------------- + +%clean +rm -fr %{buildroot} + +# ----------------------------------------------------------------------------- + +%files +%defattr(-,%{USER},%{GROUP}) +%dir %attr(750, %{USER}, %{GROUP}) %{CONFIG_DIR} + +%attr(0750, %{USER}, %{GROUP}) "/etc/default/wazuh-dashboard" +%config(noreplace) %attr(0640, %{USER}, %{GROUP}) "%{CONFIG_DIR}/opensearch_dashboards.yml" +%config(noreplace) %attr(0640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/config/opensearch_dashboards.yml" +%config(noreplace) %attr(0640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/config/node.options" + +%attr(440, %{USER}, %{GROUP}) %{INSTALL_DIR}/VERSION +%dir %attr(750, %{USER}, %{GROUP}) %{INSTALL_DIR} +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/core" +%attr(-, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/core/*" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/remove" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/list" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/lib" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/downloaders" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/__fixtures__" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/__fixtures__/replies" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_keystore" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_keystore/utils" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/setup_node_env" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/setup_node_env/root" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/setup_node_env/harden" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/optimize" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/optimize/bundles_route" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/optimize/bundles_route/__fixtures__" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/optimize/bundles_route/__fixtures__/plugin" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/optimize/bundles_route/__fixtures__/plugin/foo" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/plugins" +%attr(-, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/plugins/* +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli/serve" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli/serve/integration_tests" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli/serve/integration_tests/__fixtures__" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli/serve/integration_tests/__fixtures__/reload_logging_config" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/utils" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/logging" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/logging/rotate" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/core" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/i18n" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/i18n/localization" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/warnings" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/http" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/config" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/keystore" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/ui" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/ui/ui_render" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/ui/ui_render/bootstrap" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/ui/apm" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/docs" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/node_modules" +%attr(-, %{USER}, %{GROUP}) "%{INSTALL_DIR}/node_modules/*" +%attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/node_modules/.yarn-integrity" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/node" +%attr(-, %{USER}, %{GROUP}) "%{INSTALL_DIR}/node/*" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/data" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/plugins" +%attr(-, %{USER}, %{GROUP}) "%{INSTALL_DIR}/plugins/*" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/bin" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/remove/settings.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/remove/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/remove/remove.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/dev.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/list/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/list/list.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/lib/logger.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/lib/errors.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/lib/log_warnings.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/opensearch_dashboards.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/downloaders/file.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/downloaders/http.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/zip.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/download.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/install.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/settings.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/rename.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/__fixtures__/replies/invalid_name.zip" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/__fixtures__/replies/test_plugin_different_version.zip" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/__fixtures__/replies/banana.jpg" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/__fixtures__/replies/test_plugin_no_opensearch_dashboards.zip" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/__fixtures__/replies/test_plugin.zip" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/__fixtures__/replies/corrupt.zip" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/__fixtures__/replies/test_plugin_many.zip" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/cleanup.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/pack.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/install/progress.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/cli.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_plugin/dist.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_keystore/cli_keystore.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_keystore/add.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_keystore/create.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_keystore/utils/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_keystore/utils/prompt.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_keystore/dev.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_keystore/get_keystore.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_keystore/remove.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_keystore/dist.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli_keystore/list.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/apm.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/setup_node_env/root/force.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/setup_node_env/root/is_root.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/setup_node_env/root/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/setup_node_env/polyfill.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/setup_node_env/node_version_validator.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/setup_node_env/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/setup_node_env/harden/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/setup_node_env/harden/child_process.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/setup_node_env/harden/lodash_template.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/setup_node_env/no_transpilation.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/setup_node_env/exit_on_warning.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/setup_node_env/dist.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/optimize/np_ui_plugin_public_dirs.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/optimize/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/optimize/optimize_mixin.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/optimize/bundles_route/proxy_bundles_route.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/optimize/bundles_route/file_hash.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/optimize/bundles_route/file_hash_cache.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/optimize/bundles_route/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/optimize/bundles_route/__fixtures__/plugin/foo/plugin.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/optimize/bundles_route/__fixtures__/outside_output.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/optimize/bundles_route/bundles_route.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/optimize/bundles_route/dynamic_asset_response.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli/command.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli/help.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli/cli.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli/serve/serve.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli/serve/read_keystore.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli/serve/integration_tests/__fixtures__/invalid_config.yml" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli/serve/integration_tests/__fixtures__/reload_logging_config/opensearch_dashboards_log_file.test.yml" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli/serve/integration_tests/__fixtures__/reload_logging_config/opensearch_dashboards_log_console.test.yml" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli/serve/integration_tests/__fixtures__/reload_logging_config/opensearch_dashboards.test.yml" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/cli/dist.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/utils/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/utils/unset.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/utils/version.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/utils/artifact_type.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/utils/deep_clone_with_buffers.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/logging/rotate/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/logging/rotate/log_rotator.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/logging/apply_filters_to_keys.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/logging/log_format.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/logging/log_reporter.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/logging/log_format_json.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/logging/log_with_metadata.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/logging/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/logging/configuration.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/logging/log_interceptor.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/logging/log_format_string.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/core/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/i18n/localization/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/i18n/localization/telemetry_localization_collector.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/i18n/localization/file_integrity.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/i18n/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/i18n/get_translations_path.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/i18n/constants.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/osd_server.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/warnings/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/http/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/http/register_hapi_plugins.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/http/setup_base_path_provider.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/config/override.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/config/complete.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/config/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/config/schema.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/config/config.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/keystore/keystore.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/keystore/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/server/keystore/errors.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/ui/ui_mixin.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/ui/ui_render/ui_render_mixin.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/ui/ui_render/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/ui/ui_render/bootstrap/osd_bundles_loader_source.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/ui/ui_render/bootstrap/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/ui/ui_render/bootstrap/template.js.hbs" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/ui/ui_render/bootstrap/app_bootstrap.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/ui/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/legacy/ui/apm/index.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/docs/docs_repo.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/src/docs/cli.js" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/package.json" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/LICENSE.txt" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/NOTICE.txt" +%attr(640, %{USER}, %{GROUP}) "%{INSTALL_DIR}/README.txt" +%attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/bin/use_node" +%attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/bin/opensearch-dashboards" +%attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/bin/opensearch-dashboards-plugin" +%attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/bin/opensearch-dashboards-keystore" +%dir %attr(750, %{USER}, %{GROUP}) "%{INSTALL_DIR}/config" +%attr(640, %{USER}, %{GROUP}) "%{CONFIG_DIR}/node.options" +%attr(640, root, root) "/etc/systemd/system/wazuh-dashboard.service" + +%changelog +* Fri May 05 2023 support - %{version} +- More info: https://documentation.wazuh.com/current/release-notes/ +* Mon Apr 24 2023 support - 4.4.2 +- More info: https://documentation.wazuh.com/current/release-notes/ +* Mon Apr 17 2023 support - 4.4.1 +- More info: https://documentation.wazuh.com/current/release-notes/ +* Wed Jan 18 2023 support - 4.4.0 +- More info: https://documentation.wazuh.com/current/release-notes/ +* Thu Nov 10 2022 support - 4.3.10 +- More info: https://documentation.wazuh.com/current/release-notes/ +* Mon Oct 03 2022 support - 4.3.9 +- More info: https://documentation.wazuh.com/current/release-notes/ +* Mon Sep 19 2022 support - 4.3.8 +- More info: https://documentation.wazuh.com/current/release-notes/ +* Mon Aug 08 2022 support - 4.3.7 +- More info: https://documentation.wazuh.com/current/release-notes/ +* Thu Jul 07 2022 support - 4.3.6 +- More info: https://documentation.wazuh.com/current/release-notes/ +* Wed Jun 29 2022 support - 4.3.5 +- More info: https://documentation.wazuh.com/current/release-notes/ +* Tue Jun 07 2022 support - 4.3.4 +- More info: https://documentation.wazuh.com/current/release-notes/ +* Tue May 31 2022 support - 4.3.3 +- More info: https://documentation.wazuh.com/current/release-notes/ +* Mon May 30 2022 support - 4.3.2 +- More info: https://documentation.wazuh.com/current/release-notes/ +* Wed May 18 2022 support - 4.3.1 +- More info: https://documentation.wazuh.com/current/release-notes/ +* Thu May 05 2022 support - 4.3.0 +- More info: https://documentation.wazuh.com/current/release-notes/ diff --git a/dev-tools/signoff-check.sh b/dev-tools/signoff-check.sh index 683628c5664d..cb147e943cf9 100755 --- a/dev-tools/signoff-check.sh +++ b/dev-tools/signoff-check.sh @@ -5,7 +5,7 @@ # Validate input parameters if [ -z $1 ] || [ -z $2 ] then - echo usage: ./signoff-check.sh commit1 commit2 + echo usage: ./signoff_check.sh commit1 commit2 echo echo Checks all of the commits between commit1 \(exclusive\) and commit2 \(inclusive\) echo were made with the --signoff flag enabled diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 000000000000..fa199650b978 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,75 @@ +# Frontend development environments + +Install [Docker Desktop][docker-desktop] as per its instructions, available for Windows, Mac +and Linux (Ubuntu, Debian & Fedora). +This ensures that the development experience between Linux, Mac and Windows is as +similar as possible. + +> IMPORTANT: be methodic during the installation of Docker Desktop, and proceed +> step by step as described in their documentation. Make sure that your system +> meets the system requirements before installing Docker Desktop, and read any +> post-installation note, specially on Linux: [Differences between +> Docker Desktop for Linux and Docker Engine][docker-variant]. + +## Pre-requisites + +1. Assign resources to [Docker Desktop][docker-desktop]. The requirements for the + environments are: + + - 8 GB of RAM (minimum) + - 4 cores + + The more resources the better â˜ē + +2. Clone the [wazuh-dashboard][app-repo] and the [wazuh-security-dashboards-plugin][security-repo] + repositories at the same level. + +3. Set up user permissions + + The Docker volumes will be created by the internal Docker user, making them + read-only. To prevent this, a new group named `docker-desktop` and GUID 100999 + needs to be created, then added to your user and the source code folder: + + ```bash + sudo groupadd -g 100999 docker-desktop + sudo useradd -u 100999 -g 100999 -M docker-desktop + sudo chown -R docker-desktop:docker-desktop $WZD_HOME + sudo usermod -aG docker-desktop $USER + ``` + +## Understanding Docker contexts + +Before we begin starting Docker containers, we need to understand the +differences between Docker Engine and Docker Desktop, more precisely, that the +use different contexts. + +Carefully read these two sections of the Docker documentation: + +- [Differences between Docker Desktop for Linux and Docker Engine][docker-variant]. +- [Switch between Docker Desktop and Docker Engine][docker-context]. + +Docker Desktop will change to its context automatically at start, so be sure +that any existing Docker container using the default context is **stopped** +before starting Docker Desktop and any of the environments in this folder. + +## Starting up the environments + +Use the sh script to up the environment. + +Example: + +```bash +Usage: ./dev.sh {up|down|stop} [security] +``` + +Once the `wazuh-dashboard` container is up, attach a shell to it and run `yarn start --no-base-path` +to start the application. + +The dependencies of the project will be installed automatically by the `installed` container, +even for the security plugin, if the security flag is provided. + +[docker-desktop]: https://docs.docker.com/get-docker +[docker-variant]: https://docs.docker.com/desktop/install/linux-install/#differences-between-docker-desktop-for-linux-and-docker-engine +[docker-context]: https://docs.docker.com/desktop/install/linux-install/#context +[app-repo]: https://github.com/wazuh/wazuh-dashboard +[security-repo]: https://github.com/wazuh/wazuh-security-dashboards-plugin diff --git a/docker/config/opensearch_dashboards.dev.security.yml b/docker/config/opensearch_dashboards.dev.security.yml new file mode 100644 index 000000000000..5199aa789c33 --- /dev/null +++ b/docker/config/opensearch_dashboards.dev.security.yml @@ -0,0 +1,16 @@ +server.host: "0.0.0.0" + +opensearchDashboards.branding: + useExpandedHeader: false + +opensearch.hosts: ["https://indexer:9200"] +opensearch.ssl.verificationMode: none +opensearch.username: "kibanaserver" +opensearch.password: "kibanaserver" +opensearch.requestHeadersWhitelist: [ authorization,securitytenant ] +opensearch_security.multitenancy.enabled: true +opensearch_security.multitenancy.tenants.preferred: ["Private", "Global"] +opensearch_security.readonly_mode.roles: ["kibana_read_only"] + +# Use this setting if you are running opensearch-dashboards without https +opensearch_security.cookie.secure: false diff --git a/docker/config/opensearch_dashboards.dev.yml b/docker/config/opensearch_dashboards.dev.yml new file mode 100644 index 000000000000..88b30aafe3f4 --- /dev/null +++ b/docker/config/opensearch_dashboards.dev.yml @@ -0,0 +1,4 @@ +server.host: "0.0.0.0" + +opensearchDashboards.branding: + useExpandedHeader: false diff --git a/docker/dev.sh b/docker/dev.sh new file mode 100755 index 000000000000..3562d7dbbbf0 --- /dev/null +++ b/docker/dev.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# Change working directory to the root of the repository +cd "${0%/*}/.." + +COMPOSE_FILE=docker/dev.yml + +# Check if 2nd argument is security +if [ "$2" = "security" ]; then + export SECURITY_PLUGIN_REPO_PATH="../../wazuh-security-dashboards-plugin" + COMPOSE_FILE=docker/dev_security.yml + +fi + +# Common variables +export REPO_PATH=$(pwd) +export NODE_VERSION=$(cat $REPO_PATH/.nvmrc) +export OPENSEARCH_VERSION=$(bash $REPO_PATH/docker/get_version.sh) + +COMPOSE_CMD="docker compose -f $COMPOSE_FILE" + +print_variables() { + echo "NODE_VERSION: $NODE_VERSION" + echo "OPENSEARCH_VERSION: $OPENSEARCH_VERSION" +} + +case $1 in +up) + print_variables + $COMPOSE_CMD up -d + ;; +down) + echo "Cleaning up..." + $COMPOSE_CMD exec wazuh-dashboard yarn osd clean + $COMPOSE_CMD down + ;; +stop) + $COMPOSE_CMD stop + ;; +*) + echo "Usage: $0 {up|down|stop} [security]" + exit 1 + ;; +esac diff --git a/docker/dev.yml b/docker/dev.yml new file mode 100644 index 000000000000..8f41bf45eb0a --- /dev/null +++ b/docker/dev.yml @@ -0,0 +1,35 @@ +version: "3.9" + +services: + # Runs the bootstrap and exits + installer: + image: node:${NODE_VERSION} + container_name: installer-${OPENSEARCH_VERSION} + volumes: + - ${REPO_PATH}:/home/node/app + user: "1000:1000" + working_dir: /home/node/app + command: > + /bin/bash -c " + yarn osd bootstrap + " + + wazuh-dashboard: + image: node:${NODE_VERSION} + container_name: wazuh-dashboard-${OPENSEARCH_VERSION} + depends_on: + installer: + condition: service_completed_successfully + ports: + - 5601:5601 # Map host port 5601 to container port 5601 + expose: + - "5601" # Expose port 5601 for web access to Wazuh Dashboard + volumes: + - ${REPO_PATH}:/home/node/app + - ${REPO_PATH}/docker/config/opensearch_dashboards.dev.yml:/home/node/app/config/opensearch_dashboards.dev.yml + user: "1000:1000" + working_dir: /home/node/app + command: > + /bin/bash -c " + yarn opensearch snapshot + " diff --git a/docker/dev_security.yml b/docker/dev_security.yml new file mode 100755 index 000000000000..7f6b935ae3ee --- /dev/null +++ b/docker/dev_security.yml @@ -0,0 +1,85 @@ +version: "3.9" + +services: + indexer: + # Specifying the latest available image - modify if you want a specific version + image: opensearchproject/opensearch:${OPENSEARCH_VERSION} + container_name: indexer-${OPENSEARCH_VERSION} + environment: + # Name the cluster + - cluster.name=opensearch-cluster + # Name the node that will run in this container + - node.name=indexer + # Nodes to look for when discovering the cluster + - discovery.seed_hosts=indexer + # Nodes eligible to serve as cluster manager + - cluster.initial_cluster_manager_nodes=indexer + # Disable JVM heap memory swapping + - bootstrap.memory_lock=true + # Set min and max JVM heap sizes to at least 50% of system RAM + - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" + ulimits: + # Set memlock to unlimited (no soft or hard limit) + memlock: + soft: -1 + hard: -1 + # Maximum number of open files for the opensearch user - set to at least 65536 + nofile: + soft: 65536 + hard: 65536 + volumes: + # Creates volume called opensearch-data and mounts it to the container + - opensearch-data:/usr/share/opensearch/data + ports: + - 9200:9200 # REST API + - 9600:9600 # Performance Analyzer + networks: + # All of the containers will join the same Docker bridge network + - opensearch-net + + # Runs the bootstrap and exits + installer: + image: node:${NODE_VERSION} + container_name: installer-security-${OPENSEARCH_VERSION} + volumes: + - ${REPO_PATH}:/home/node/app + - ${SECURITY_PLUGIN_REPO_PATH}:/home/node/app/plugins/security + user: "1000:1000" + working_dir: /home/node/app + command: > + /bin/bash -c " + yarn osd bootstrap + cd plugins/security + yarn + " + + wazuh-dashboard: + image: node:${NODE_VERSION} + container_name: wazuh-dashboard-security-${OPENSEARCH_VERSION} + depends_on: + installer: + condition: service_completed_successfully + # indexer: + # condition: service_healthy + ports: + - 5601:5601 # Map host port 5601 to container port 5601 + expose: + - "5601" # Expose port 5601 for web access to Wazuh Dashboard + volumes: + - ${REPO_PATH}:/home/node/app + - ${SECURITY_PLUGIN_REPO_PATH}:/home/node/app/plugins/security + - ${REPO_PATH}/docker/config/opensearch_dashboards.dev.security.yml:/home/node/app/config/opensearch_dashboards.dev.yml + user: "1000" + working_dir: /home/node/app + networks: + - opensearch-net + command: > + /bin/bash -c " + tail -f /dev/null + " + +volumes: + opensearch-data: + +networks: + opensearch-net: diff --git a/docker/get_version.sh b/docker/get_version.sh new file mode 100755 index 000000000000..555dd89e9e9c --- /dev/null +++ b/docker/get_version.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Copyright OpenSearch Contributors +# SPDX-License-Identifier: Apache-2.0 + +set -e + +PACKAGE_VERSION=$(cat package.json \ +| grep version \ +| head -1 \ +| awk -F: '{ print $2 }' \ +| sed 's/[",]//g' \ +| tr -d [:space:]) + +echo "$PACKAGE_VERSION" \ No newline at end of file diff --git a/docs/docker-dev/docker-dev-setup-manual.md b/docs/docker-dev/docker-dev-setup-manual.md index 3263372a3d45..da40ab93f4a2 100644 --- a/docs/docker-dev/docker-dev-setup-manual.md +++ b/docs/docker-dev/docker-dev-setup-manual.md @@ -6,10 +6,10 @@ The following instructions demonstrate how to set up a development environment f 2. In the terminal, run the command below. * This should create a folder named `opensearch-dashboards-docker-dev` and it should contain two files: `docker-compose.yml` and `entrypoint.sh`. - * Here is the link to the installer script: `https://raw.githubusercontent.com/opensearch-project/OpenSearch-Dashboards/main/dev-tools/install-docker-dev.sh` if needed. + * Here is the link to the installer script: `https://raw.githubusercontent.com/opensearch-project/OpenSearch-Dashboards/main/dev_tools/install_docker_dev.sh` if needed. ```bash -curl -o- https://raw.githubusercontent.com/opensearch-project/OpenSearch-Dashboards/main/dev-tools/install-docker-dev.sh | bash +curl -o- https://raw.githubusercontent.com/opensearch-project/OpenSearch-Dashboards/main/dev_tools/install_docker_dev.sh | bash ``` 3. Open VS Code or [install it](https://code.visualstudio.com/download), if it's not already installed. @@ -66,7 +66,7 @@ This section explains how to run Selenium functional tests using Docker and debu 2. Make sure you have completed steps 1-5 in the [Docker Development Environment Setup](#docker-development-environment-setup). Now, ensure you have 5 files, `docker-compose.yml`, `docker-compose.selenium.yml`, `Dockerfile.selenium`, `entrypoint.sh` and `start-vnc.sh`. You can also download them by running the installer script. This time you need to pass a parameter `--ftr`. ```bash -curl -o- https://raw.githubusercontent.com/opensearch-project/OpenSearch-Dashboards/main/dev-tools/install-docker-dev.sh | bash -s -- --ftr +curl -o- https://raw.githubusercontent.com/opensearch-project/OpenSearch-Dashboards/main/dev_tools/install_docker_dev.sh | bash -s -- --ftr ``` 3. In the terminal, run the following commands to stop any running containers, build the new configuration, and start the containers: diff --git a/package.json b/package.json index 57ff878bbfd1..d09a3ab50f1b 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,10 @@ "number": 8467, "sha": "6cb7fec4e154faa0a4a3fee4b33dfef91b9870d9" }, + "wazuh": { + "version": "4.9.0", + "revision": "00" + }, "homepage": "https://opensearch.org", "bugs": { "url": "http://github.com/opensearch-project/OpenSearch-Dashboards/issues" @@ -74,7 +78,9 @@ "docs:acceptApiChanges": "scripts/use_node --max-old-space-size=6144 scripts/check_published_api_changes.js --accept", "osd:bootstrap": "scripts/use_node scripts/build_ts_refs && scripts/use_node scripts/register_git_hook", "spec_to_console": "scripts/use_node scripts/spec_to_console", - "pkg-version": "scripts/use_node -e \"console.log(require('./package.json').version)\"" + "pkg-version": "scripts/use_node -e \"console.log(require('./package.json').version)\"", + "wzd-revision": "scripts/use_node -e \"console.log(require('./package.json').wazuh.revision)\"", + "wzd-version": "scripts/use_node -e \"console.log(require('./package.json').wazuh.version)\"" }, "repository": { "type": "git", diff --git a/packages/osd-config/src/__snapshots__/env.test.ts.snap b/packages/osd-config/src/__snapshots__/env.test.ts.snap index 74a05672b5d0..a5143dd6d9ea 100644 --- a/packages/osd-config/src/__snapshots__/env.test.ts.snap +++ b/packages/osd-config/src/__snapshots__/env.test.ts.snap @@ -34,6 +34,7 @@ Env { "buildSha": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "dist": false, "version": "v1", + "wazuhVersion": "4.x.x", }, "pluginSearchPaths": Array [ "/test/opensearchDashboardsRoot/src/plugins", @@ -77,6 +78,7 @@ Env { "buildSha": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "dist": false, "version": "v1", + "wazuhVersion": "4.x.x", }, "pluginSearchPaths": Array [ "/test/opensearchDashboardsRoot/src/plugins", @@ -119,6 +121,7 @@ Env { "buildSha": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "dist": false, "version": "some-version", + "wazuhVersion": "4.x.x", }, "pluginSearchPaths": Array [ "/test/opensearchDashboardsRoot/src/plugins", @@ -161,6 +164,7 @@ Env { "buildSha": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "dist": false, "version": "some-version", + "wazuhVersion": "4.x.x", }, "pluginSearchPaths": Array [ "/test/opensearchDashboardsRoot/src/plugins", @@ -203,6 +207,7 @@ Env { "buildSha": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "dist": false, "version": "some-version", + "wazuhVersion": "4.x.x", }, "pluginSearchPaths": Array [ "/test/opensearchDashboardsRoot/src/plugins", @@ -245,6 +250,7 @@ Env { "buildSha": "feature-v1-build-sha", "dist": true, "version": "v1", + "wazuhVersion": "4.x.x", }, "pluginSearchPaths": Array [ "/test/opensearchDashboardsRoot/src/plugins", @@ -287,6 +293,7 @@ Env { "buildSha": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "dist": false, "version": "v1", + "wazuhVersion": "4.x.x", }, "pluginSearchPaths": Array [ "/test/opensearchDashboardsRoot/src/plugins", @@ -329,6 +336,7 @@ Env { "buildSha": "feature-v1-build-sha", "dist": true, "version": "v1", + "wazuhVersion": "4.x.x", }, "pluginSearchPaths": Array [ "/some/home/dir/src/plugins", diff --git a/packages/osd-config/src/config_service.test.ts b/packages/osd-config/src/config_service.test.ts index 0f634537be7e..65a06598a6ec 100644 --- a/packages/osd-config/src/config_service.test.ts +++ b/packages/osd-config/src/config_service.test.ts @@ -48,6 +48,9 @@ const packageInfos: RawPackageInfo = { number: 42, sha: 'one', }, + wazuh: { + version: '4.5.0', + }, }; const emptyArgv = getEnvOptions(); const defaultEnv = new Env('/opensearch-dashboards', packageInfos, emptyArgv); @@ -270,6 +273,9 @@ test('correctly passes context', async () => { number: 100, sha: 'feature-v1-build-sha', }, + wazuh: { + version: '4.5.0', + }, }; const env = new Env('/opensearch-dashboards', mockPackage, getEnvOptions()); diff --git a/packages/osd-config/src/env.test.ts b/packages/osd-config/src/env.test.ts index 32febbc52eb0..bffc1af4bf86 100644 --- a/packages/osd-config/src/env.test.ts +++ b/packages/osd-config/src/env.test.ts @@ -42,6 +42,9 @@ const packageInfos: RawPackageInfo = { number: 42, sha: 'one', }, + wazuh: { + version: '4.x.x', + }, }; beforeEach(() => { @@ -52,6 +55,9 @@ test('correctly creates default environment in dev mode when isDevClusterMaster mockPackage.raw = { branch: 'some-branch', version: 'some-version', + wazuh: { + version: '4.x.x', + }, }; const defaultEnv = Env.createDefault( @@ -71,6 +77,9 @@ test('correctly creates default environment in dev mode when isDevClusterManager mockPackage.raw = { branch: 'some-branch', version: 'some-version', + wazuh: { + version: '4.x.x', + }, }; const defaultEnv = Env.createDefault( @@ -90,6 +99,9 @@ test('correctly creates default environment in dev mode when isDevClusterManager mockPackage.raw = { branch: 'some-branch', version: 'some-version', + wazuh: { + version: '4.x.x', + }, }; const defaultEnv = Env.createDefault( @@ -114,6 +126,9 @@ test('correctly creates default environment in prod distributable mode.', () => number: 100, sha: 'feature-v1-build-sha', }, + wazuh: { + version: '4.x.x', + }, }; const defaultEnv = Env.createDefault( @@ -136,6 +151,9 @@ test('correctly creates default environment in prod non-distributable mode.', () number: 100, sha: 'feature-v1-build-sha', }, + wazuh: { + version: '4.x.x', + }, }; const defaultEnv = Env.createDefault( @@ -158,6 +176,9 @@ test('correctly creates default environment if `--env.name` is supplied.', () => number: 100, sha: 'feature-v1-build-sha', }, + wazuh: { + version: '4.x.x', + }, }; const defaultDevEnv = Env.createDefault( @@ -191,6 +212,9 @@ test('correctly creates environment with constructor.', () => { number: 100, sha: 'feature-v1-build-sha', }, + wazuh: { + version: '4.x.x', + }, }, getEnvOptions({ cliArgs: { dev: false }, diff --git a/packages/osd-config/src/env.ts b/packages/osd-config/src/env.ts index e27498c341a0..e82355595e99 100644 --- a/packages/osd-config/src/env.ts +++ b/packages/osd-config/src/env.ts @@ -67,6 +67,9 @@ export interface RawPackageInfo { number: number; sha: string; }; + wazuh: { + version: string; + }; } export class Env { @@ -159,6 +162,7 @@ export class Env { : 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', version: pkg.version, dist: isOpenSearchDashboardsDistributable, + wazuhVersion: pkg.wazuh.version, }); } } diff --git a/packages/osd-config/src/types.ts b/packages/osd-config/src/types.ts index c4a82f68502b..1a0927770d08 100644 --- a/packages/osd-config/src/types.ts +++ b/packages/osd-config/src/types.ts @@ -37,6 +37,7 @@ export interface PackageInfo { buildNum: number; buildSha: string; dist: boolean; + wazuhVersion: string; } /** diff --git a/src/cli_plugin/install/settings.js b/src/cli_plugin/install/settings.js index cfd576f8ff5a..3a878dcfffd1 100644 --- a/src/cli_plugin/install/settings.js +++ b/src/cli_plugin/install/settings.js @@ -36,9 +36,12 @@ import { fromRoot } from '../../core/server/utils'; const LATEST_PLUGIN_BASE_URL = 'https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards'; +const LATEST_WAZUH_PLUGIN_BASE_URL = 'https://packages-dev.wazuh.com/pre-release/ui/dashboard'; -function generateUrls({ version, plugin }) { - return [plugin, generatePluginUrl(version, plugin)]; +function generateUrls({ version, plugin, wazuhVersion }) { + return plugin.includes('wazuh') + ? [plugin, generateWazuhPluginUrl(wazuhVersion, plugin)] + : [plugin, generatePluginUrl(version, plugin)]; } function generatePluginUrl(version, plugin) { @@ -49,6 +52,10 @@ function generatePluginUrl(version, plugin) { return `${LATEST_PLUGIN_BASE_URL}/${version}/latest/${platform}/${arch}/${type}/builds/opensearch-dashboards/plugins/${plugin}-${version}.zip`; } +function generateWazuhPluginUrl(version, plugin) { + return `${LATEST_WAZUH_PLUGIN_BASE_URL}/${plugin}-${version}-1.zip`; +} + export function parseMilliseconds(val) { let result; @@ -70,6 +77,7 @@ export function parse(command, options, osdPackage) { config: options.config || '', plugin: command, version: osdPackage.version, + wazuhVersion: osdPackage.wazuh.version, pluginDir: fromRoot('plugins'), }; @@ -77,5 +85,8 @@ export function parse(command, options, osdPackage) { settings.workingPath = resolve(settings.pluginDir, '.plugin.installing'); settings.tempArchiveFile = resolve(settings.workingPath, 'archive.part'); + // Clean up. + delete settings.wazuhVersion; + return settings; } diff --git a/src/cli_plugin/install/settings.test.js b/src/cli_plugin/install/settings.test.js index 60313e3fe9b8..07b19da3ffeb 100644 --- a/src/cli_plugin/install/settings.test.js +++ b/src/cli_plugin/install/settings.test.js @@ -61,7 +61,12 @@ describe('parseMilliseconds function', function () { describe('parse function', function () { const command = 'plugin name'; const defaultOptions = { pluginDir: fromRoot('plugins') }; - const osdPackage = { version: 1234 }; + const osdPackage = { + version: 1234, + wazuh: { + version: 1234, + }, + }; afterAll(() => { Object.defineProperties(process, { diff --git a/src/core/common/logos/__snapshots__/get_logos.test.ts.snap b/src/core/common/logos/__snapshots__/get_logos.test.ts.snap index 6c7746f3533a..cfd1b9f7e3cf 100644 --- a/src/core/common/logos/__snapshots__/get_logos.test.ts.snap +++ b/src/core/common/logos/__snapshots__/get_logos.test.ts.snap @@ -512,11 +512,11 @@ colorScheme = "light" exports[`getLogos when unbranded returns the correct logos 1`] = ` AnimatedMark.dark.type = "default" -AnimatedMark.dark.url = "/mocked/base/path/ui/logos/opensearch_spinner_on_dark.svg" +AnimatedMark.dark.url = "/mocked/base/path/ui/logos/spinner_on_dark.gif" AnimatedMark.light.type = "default" -AnimatedMark.light.url = "/mocked/base/path/ui/logos/opensearch_spinner_on_light.svg" +AnimatedMark.light.url = "/mocked/base/path/ui/logos/spinner_on_light.gif" AnimatedMark.type = "default" -AnimatedMark.url = "/mocked/base/path/ui/logos/opensearch_spinner_on_light.svg" +AnimatedMark.url = "/mocked/base/path/ui/logos/spinner_on_light.gif" Application.dark.type = "default" Application.dark.url = "/mocked/base/path/ui/logos/opensearch_dashboards_on_dark.svg" Application.light.type = "default" @@ -546,11 +546,11 @@ colorScheme = "light" exports[`getLogos when unbranded returns the correct logos when dark color scheme is requested 1`] = ` AnimatedMark.dark.type = "default" -AnimatedMark.dark.url = "/mocked/base/path/ui/logos/opensearch_spinner_on_dark.svg" +AnimatedMark.dark.url = "/mocked/base/path/ui/logos/spinner_on_dark.gif" AnimatedMark.light.type = "default" -AnimatedMark.light.url = "/mocked/base/path/ui/logos/opensearch_spinner_on_light.svg" +AnimatedMark.light.url = "/mocked/base/path/ui/logos/spinner_on_light.gif" AnimatedMark.type = "default" -AnimatedMark.url = "/mocked/base/path/ui/logos/opensearch_spinner_on_dark.svg" +AnimatedMark.url = "/mocked/base/path/ui/logos/spinner_on_dark.gif" Application.dark.type = "default" Application.dark.url = "/mocked/base/path/ui/logos/opensearch_dashboards_on_dark.svg" Application.light.type = "default" @@ -580,11 +580,11 @@ colorScheme = "dark" exports[`getLogos when unbranded returns the correct logos when light color scheme is requested 1`] = ` AnimatedMark.dark.type = "default" -AnimatedMark.dark.url = "/mocked/base/path/ui/logos/opensearch_spinner_on_dark.svg" +AnimatedMark.dark.url = "/mocked/base/path/ui/logos/spinner_on_dark.gif" AnimatedMark.light.type = "default" -AnimatedMark.light.url = "/mocked/base/path/ui/logos/opensearch_spinner_on_light.svg" +AnimatedMark.light.url = "/mocked/base/path/ui/logos/spinner_on_light.gif" AnimatedMark.type = "default" -AnimatedMark.url = "/mocked/base/path/ui/logos/opensearch_spinner_on_light.svg" +AnimatedMark.url = "/mocked/base/path/ui/logos/spinner_on_light.gif" Application.dark.type = "default" Application.dark.url = "/mocked/base/path/ui/logos/opensearch_dashboards_on_dark.svg" Application.light.type = "default" diff --git a/src/core/common/logos/get_logos.ts b/src/core/common/logos/get_logos.ts index c27a5306e9e1..6517cd16ab38 100644 --- a/src/core/common/logos/get_logos.ts +++ b/src/core/common/logos/get_logos.ts @@ -21,9 +21,9 @@ export const MARK_ON_DARK = 'ui/logos/opensearch_mark_on_dark.svg'; export const CENTER_MARK_THEMED = 'ui/logos/opensearch_center_mark.svg'; export const CENTER_MARK_ON_LIGHT = 'ui/logos/opensearch_center_mark_on_light.svg'; export const CENTER_MARK_ON_DARK = 'ui/logos/opensearch_center_mark_on_dark.svg'; -export const ANIMATED_MARK_THEMED = 'ui/logos/opensearch_spinner.svg'; -export const ANIMATED_MARK_ON_LIGHT = 'ui/logos/opensearch_spinner_on_light.svg'; -export const ANIMATED_MARK_ON_DARK = 'ui/logos/opensearch_spinner_on_dark.svg'; +export const ANIMATED_MARK_THEMED = 'ui/logos/spinner.svg'; +export const ANIMATED_MARK_ON_LIGHT = 'ui/logos/spinner_on_light.gif'; +export const ANIMATED_MARK_ON_DARK = 'ui/logos/spinner_on_dark.gif'; interface AssetOption { url?: string; diff --git a/src/core/public/chrome/chrome_service.tsx b/src/core/public/chrome/chrome_service.tsx index 7994c6dcc0c0..f6ca2aa28089 100644 --- a/src/core/public/chrome/chrome_service.tsx +++ b/src/core/public/chrome/chrome_service.tsx @@ -244,13 +244,13 @@ export class ChromeService { basePath={http.basePath} breadcrumbs$={breadcrumbs$.pipe(takeUntil(this.stop$))} customNavLink$={customNavLink$.pipe(takeUntil(this.stop$))} - opensearchDashboardsDocLink={docLinks.links.opensearchDashboards.introduction} + opensearchDashboardsDocLink={docLinks.links.wazuh.index} forceAppSwitcherNavigation$={navLinks.getForceAppSwitcherNavigation$()} helpExtension$={helpExtension$.pipe(takeUntil(this.stop$))} helpSupportUrl$={helpSupportUrl$.pipe(takeUntil(this.stop$))} homeHref={http.basePath.prepend('/app/home')} isVisible$={this.isVisible$} - opensearchDashboardsVersion={injectedMetadata.getOpenSearchDashboardsVersion()} + opensearchDashboardsVersion={injectedMetadata.getWazuhVersion()} navLinks$={navLinks.getNavLinks$()} recentlyAccessed$={recentlyAccessed.get$()} navControlsLeft$={navControls.getLeft$()} diff --git a/src/core/public/chrome/constants.ts b/src/core/public/chrome/constants.ts index 5008f8b4a69a..2fa80237566e 100644 --- a/src/core/public/chrome/constants.ts +++ b/src/core/public/chrome/constants.ts @@ -28,6 +28,6 @@ * under the License. */ -export const OPENSEARCH_DASHBOARDS_ASK_OPENSEARCH_LINK = 'https://forum.opensearch.org/'; -export const GITHUB_CREATE_ISSUE_LINK = - 'https://github.com/opensearch-project/OpenSearch-Dashboards/issues/new/choose'; +export const OPENSEARCH_DASHBOARDS_FEEDBACK_LINK = 'https://wazuh.com/community/join-us-on-slack'; +export const OPENSEARCH_DASHBOARDS_ASK_OPENSEARCH_LINK = OPENSEARCH_DASHBOARDS_FEEDBACK_LINK; +export const GITHUB_CREATE_ISSUE_LINK = 'https://github.com/wazuh/wazuh/issues/new/choose'; diff --git a/src/core/public/chrome/ui/header/__snapshots__/collapsible_nav.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/collapsible_nav.test.tsx.snap index 7b4e3ba472dc..52378a456579 100644 --- a/src/core/public/chrome/ui/header/__snapshots__/collapsible_nav.test.tsx.snap +++ b/src/core/public/chrome/ui/header/__snapshots__/collapsible_nav.test.tsx.snap @@ -128,14 +128,14 @@ exports[`CollapsibleNav renders links grouped by category 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/test/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_light.svg", + "url": "/test/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_light.svg", + "url": "/test/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -2071,14 +2071,14 @@ exports[`CollapsibleNav renders the default nav 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/test/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_light.svg", + "url": "/test/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_light.svg", + "url": "/test/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -2374,14 +2374,14 @@ exports[`CollapsibleNav renders the default nav 2`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/test/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_light.svg", + "url": "/test/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_light.svg", + "url": "/test/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -2677,14 +2677,14 @@ exports[`CollapsibleNav renders the default nav 3`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/test/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_light.svg", + "url": "/test/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_light.svg", + "url": "/test/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -5503,14 +5503,14 @@ exports[`CollapsibleNav without custom branding renders the nav bar in dark mode "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/test/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_light.svg", + "url": "/test/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/test/ui/logos/spinner_on_dark.gif", }, "Application": Object { "dark": Object { @@ -6606,14 +6606,14 @@ exports[`CollapsibleNav without custom branding renders the nav bar in default m "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/test/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_light.svg", + "url": "/test/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/test/ui/logos/opensearch_spinner_on_light.svg", + "url": "/test/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { diff --git a/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap index b9da5ac37dbe..adf1d8d5b229 100644 --- a/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap +++ b/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap @@ -1431,14 +1431,14 @@ exports[`Header handles visibility and lock changes 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -2036,14 +2036,14 @@ exports[`Header handles visibility and lock changes 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -2528,14 +2528,14 @@ exports[`Header handles visibility and lock changes 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -3271,14 +3271,14 @@ exports[`Header handles visibility and lock changes 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -3500,7 +3500,7 @@ exports[`Header handles visibility and lock changes 1`] = ` data-euiicon-type="home" data-test-image-url="home" data-test-subj="homeIcon" - title="opensearch dashboards home" + title="Wazuh dashboards home" />
@@ -5941,14 +5941,14 @@ exports[`Header handles visibility and lock changes 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -8079,14 +8079,14 @@ exports[`Header renders condensed header 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -8786,14 +8786,14 @@ exports[`Header renders condensed header 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -8968,10 +8968,10 @@ exports[`Header renders condensed header 1`] = ` >
@@ -11407,14 +11407,14 @@ exports[`Header renders condensed header 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { diff --git a/src/core/public/chrome/ui/header/__snapshots__/header_help_menu.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/header_help_menu.test.tsx.snap index 036e2b4ee0ce..2173ce50c764 100644 --- a/src/core/public/chrome/ui/header/__snapshots__/header_help_menu.test.tsx.snap +++ b/src/core/public/chrome/ui/header/__snapshots__/header_help_menu.test.tsx.snap @@ -1798,7 +1798,7 @@ exports[`Header help menu hides survey link 1`] = ` - Documentation + Wazuh documentation @@ -1815,7 +1815,7 @@ exports[`Header help menu hides survey link 1`] = ` - Community + Ask Wazuh @@ -1828,7 +1828,7 @@ exports[`Header help menu hides survey link 1`] = ` /> @@ -2019,11 +2019,11 @@ exports[`Header help menu hides survey link 1`] = ` className="euiButtonEmpty__text" > - Documentation + Wazuh documentation @@ -2065,11 +2065,11 @@ exports[`Header help menu hides survey link 1`] = ` className="euiButtonEmpty__text" > - Community + Ask Wazuh @@ -2092,14 +2092,14 @@ exports[`Header help menu hides survey link 1`] = ` @@ -3958,7 +3958,7 @@ exports[`Header help menu renders survey link 1`] = ` - Documentation + Wazuh documentation @@ -3975,7 +3975,7 @@ exports[`Header help menu renders survey link 1`] = ` - Community + Ask Wazuh @@ -4008,7 +4008,7 @@ exports[`Header help menu renders survey link 1`] = ` /> @@ -4199,11 +4199,11 @@ exports[`Header help menu renders survey link 1`] = ` className="euiButtonEmpty__text" > - Documentation + Wazuh documentation @@ -4245,11 +4245,11 @@ exports[`Header help menu renders survey link 1`] = ` className="euiButtonEmpty__text" > - Community + Ask Wazuh @@ -4321,14 +4321,14 @@ exports[`Header help menu renders survey link 1`] = ` diff --git a/src/core/public/chrome/ui/header/__snapshots__/home_icon.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/home_icon.test.tsx.snap index c1a7c11b69f9..adcce5bb2e55 100644 --- a/src/core/public/chrome/ui/header/__snapshots__/home_icon.test.tsx.snap +++ b/src/core/public/chrome/ui/header/__snapshots__/home_icon.test.tsx.snap @@ -28,7 +28,7 @@ exports[`Home icon, unbranded, uses the home icon when header is expanded 1`] = data-test-image-url="home" data-test-subj="homeIcon" size="m" - title="opensearch dashboards home" + title="Wazuh dashboards home" type="home" /> `; @@ -36,10 +36,10 @@ exports[`Home icon, unbranded, uses the home icon when header is expanded 1`] = exports[`Home icon, unbranded, uses the mark logo when header is not expanded 1`] = ` `; diff --git a/src/core/public/chrome/ui/header/header_help_menu.tsx b/src/core/public/chrome/ui/header/header_help_menu.tsx index 0eba4c0c2673..33b858177118 100644 --- a/src/core/public/chrome/ui/header/header_help_menu.tsx +++ b/src/core/public/chrome/ui/header/header_help_menu.tsx @@ -208,7 +208,7 @@ class HeaderHelpMenuUI extends Component { @@ -217,7 +217,7 @@ class HeaderHelpMenuUI extends Component { diff --git a/src/core/public/chrome/ui/header/home_icon.test.tsx b/src/core/public/chrome/ui/header/home_icon.test.tsx index 05ffd5591594..62fc0d6bc8b4 100644 --- a/src/core/public/chrome/ui/header/home_icon.test.tsx +++ b/src/core/public/chrome/ui/header/home_icon.test.tsx @@ -24,7 +24,7 @@ describe('Home icon,', () => { expect(icon.prop('data-test-subj')).toEqual('homeIcon'); expect(icon.prop('type')).toEqual('home'); expect(icon.prop('size')).toEqual('m'); - expect(icon.prop('title')).toEqual('opensearch dashboards home'); + expect(icon.prop('title')).toEqual('Wazuh dashboards home'); }); it('uses the home icon when header is expanded', () => { @@ -39,7 +39,7 @@ describe('Home icon,', () => { expect(icon.prop('data-test-subj')).toEqual('homeIcon'); expect(icon.prop('type')).toEqual('home'); expect(icon.prop('size')).toEqual('m'); - expect(icon.prop('title')).toEqual('opensearch dashboards home'); + expect(icon.prop('title')).toEqual('Wazuh dashboards home'); expect(component).toMatchSnapshot(); }); @@ -53,10 +53,10 @@ describe('Home icon,', () => { }; const component = shallow(); const icon = component.find('EuiIcon'); - expect(icon.prop('data-test-subj')).toEqual('defaultMark'); - expect(icon.prop('type')).toEqual(props.logos.Mark.url); - expect(icon.prop('size')).toEqual('l'); - expect(icon.prop('title')).toEqual('opensearch dashboards home'); + expect(icon.prop('data-test-subj')).toEqual('homeIcon'); + expect(icon.prop('type')).toEqual('home'); + expect(icon.prop('size')).toEqual('m'); + expect(icon.prop('title')).toEqual('Wazuh dashboards home'); expect(component).toMatchSnapshot(); }); diff --git a/src/core/public/chrome/ui/header/home_icon.tsx b/src/core/public/chrome/ui/header/home_icon.tsx index 2c0beb5a26cb..ccb02ba2583c 100644 --- a/src/core/public/chrome/ui/header/home_icon.tsx +++ b/src/core/public/chrome/ui/header/home_icon.tsx @@ -17,7 +17,8 @@ interface Props { * Use branding configurations to render the header mark on the nav bar. */ export const HomeIcon = ({ branding, logos }: Props) => { - const { applicationTitle = 'opensearch dashboards', useExpandedHeader = true } = branding; + // Removed prop unnecessary useExpandedHeader Wazuh dashboards + const { applicationTitle = 'Wazuh dashboards' } = branding; const { url: markURL, type: markType } = logos.Mark; @@ -26,8 +27,8 @@ export const HomeIcon = ({ branding, logos }: Props) => { // Marks look better at the large size let markIconSize: IconSize = 'l'; - // If no custom branded mark was set, use `home` icon only for expanded headers - if (markType !== 'custom' && useExpandedHeader) { + // If no custom branded mark was set, use `home` icon Wazuh dashboards + if (markType !== 'custom') { markIcon = 'home'; testSubj = 'homeIcon'; // Home icon should be medium to fit in with other icons diff --git a/src/core/public/doc_links/doc_links_service.ts b/src/core/public/doc_links/doc_links_service.ts index 7dd8c6561ade..f80fb64a2c7b 100644 --- a/src/core/public/doc_links/doc_links_service.ts +++ b/src/core/public/doc_links/doc_links_service.ts @@ -62,11 +62,17 @@ export class DocLinksService { const OPENSEARCH_WEBSITE_DOCS = `${OPENSEARCH_WEBSITE_URL}docs/${DOC_LINK_VERSION}`; const OPENSEARCH_VERSIONED_DOCS = `${OPENSEARCH_WEBSITE_DOCS}/opensearch/`; const OPENSEARCH_DASHBOARDS_VERSIONED_DOCS = `${OPENSEARCH_WEBSITE_DOCS}/dashboards/`; + const WAZUH_DOC_VERSION = injectedMetadata.getWazuhDocVersion(); + const WAZUH_WEBSITE_DOCS = `https://documentation.wazuh.com/${WAZUH_DOC_VERSION}`; return deepFreeze({ DOC_LINK_VERSION, OPENSEARCH_WEBSITE_URL, + WAZUH_DOC_VERSION, links: { + wazuh: { + index: `${WAZUH_WEBSITE_DOCS}/index.html`, + }, opensearch: { // https://opensearch.org/docs/latest/opensearch/index/ introduction: `${OPENSEARCH_VERSIONED_DOCS}index/`, @@ -616,7 +622,11 @@ export class DocLinksService { export interface DocLinksStart { readonly DOC_LINK_VERSION: string; readonly OPENSEARCH_WEBSITE_URL: string; + readonly WAZUH_DOC_VERSION: string; readonly links: { + readonly wazuh: { + readonly index: string; + }; readonly opensearch: { readonly introduction: string; readonly installation: { diff --git a/src/core/public/injected_metadata/injected_metadata_service.mock.ts b/src/core/public/injected_metadata/injected_metadata_service.mock.ts index c91a4e446b1e..bcbc8b2c12cf 100644 --- a/src/core/public/injected_metadata/injected_metadata_service.mock.ts +++ b/src/core/public/injected_metadata/injected_metadata_service.mock.ts @@ -46,6 +46,8 @@ const createSetupContractMock = () => { getOpenSearchDashboardsBuildNumber: jest.fn(), getBranding: jest.fn(), getSurvey: jest.fn(), + getWazuhVersion: jest.fn(), + getWazuhDocVersion: jest.fn(), }; setupContract.getCspConfig.mockReturnValue({ warnLegacyBrowsers: true }); setupContract.getOpenSearchDashboardsVersion.mockReturnValue('opensearchDashboardsVersion'); @@ -62,6 +64,8 @@ const createSetupContractMock = () => { }, } as any); setupContract.getPlugins.mockReturnValue([]); + setupContract.getWazuhVersion.mockReturnValue('4.x.x'); + setupContract.getWazuhDocVersion.mockReturnValue('4.x'); return setupContract; }; diff --git a/src/core/public/injected_metadata/injected_metadata_service.ts b/src/core/public/injected_metadata/injected_metadata_service.ts index f4c6a7f7b91a..941a07b46984 100644 --- a/src/core/public/injected_metadata/injected_metadata_service.ts +++ b/src/core/public/injected_metadata/injected_metadata_service.ts @@ -53,6 +53,7 @@ export interface InjectedMetadataParams { version: string; buildNumber: number; branch: string; + wazuhVersion: string; basePath: string; serverBasePath: string; category?: AppCategory; @@ -88,11 +89,11 @@ export interface InjectedMetadataParams { * @internal */ export class InjectedMetadataService { - private state = deepFreeze( - this.params.injectedMetadata - ) as InjectedMetadataParams['injectedMetadata']; + private state: InjectedMetadataParams['injectedMetadata']; - constructor(private readonly params: InjectedMetadataParams) {} + constructor(params: InjectedMetadataParams) { + this.state = deepFreeze(params.injectedMetadata) as InjectedMetadataParams['injectedMetadata']; + } public start(): InjectedMetadataStart { return this.setup(); @@ -151,6 +152,14 @@ export class InjectedMetadataService { getSurvey: () => { return this.state.survey; }, + + getWazuhVersion: () => { + return this.state.wazuhVersion; + }, + + getWazuhDocVersion: () => { + return this.state.wazuhVersion?.split('.').slice(0, 2).join('.') || 'current'; + }, }; } } @@ -186,6 +195,8 @@ export interface InjectedMetadataSetup { }; getBranding: () => Branding; getSurvey: () => string | undefined; + getWazuhVersion: () => string; + getWazuhDocVersion: () => string; } /** @internal */ diff --git a/src/core/public/mocks.ts b/src/core/public/mocks.ts index e863d627c801..98dc5a60e05e 100644 --- a/src/core/public/mocks.ts +++ b/src/core/public/mocks.ts @@ -126,6 +126,7 @@ function pluginInitializerContextMock() { buildNum: 100, buildSha: 'buildSha', dist: false, + wazuhVersion: 'wazuhVersion', }, }, config: { @@ -151,6 +152,7 @@ function createCoreContext(): CoreContext { buildNum: 100, buildSha: 'buildSha', dist: false, + wazuhVersion: 'wazuhVersion', }, }, }; diff --git a/src/core/public/rendering/rendering_service.tsx b/src/core/public/rendering/rendering_service.tsx index ffb147bc39fc..d1ee00681628 100644 --- a/src/core/public/rendering/rendering_service.tsx +++ b/src/core/public/rendering/rendering_service.tsx @@ -58,9 +58,15 @@ export class RenderingService { const appUi = application.getComponent(); const bannerUi = overlays.banners.getComponent(); + /** + * This is done so that modifications to login styles are only applied to the login. + */ + const pathName = chromeUi.props.application?.history?.location?.pathname || ''; + const classContent = pathName === '/app/login' ? 'content wz-login' : 'content'; + ReactDOM.render( -
+
{chromeUi} diff --git a/src/core/server/core_app/assets/favicons/android-chrome-192x192.png b/src/core/server/core_app/assets/favicons/android-chrome-192x192.png index a256e84b28b8..5ae1721bad2f 100644 Binary files a/src/core/server/core_app/assets/favicons/android-chrome-192x192.png and b/src/core/server/core_app/assets/favicons/android-chrome-192x192.png differ diff --git a/src/core/server/core_app/assets/favicons/android-chrome-512x512.png b/src/core/server/core_app/assets/favicons/android-chrome-512x512.png index 404fbfad398f..9eb711bb795c 100644 Binary files a/src/core/server/core_app/assets/favicons/android-chrome-512x512.png and b/src/core/server/core_app/assets/favicons/android-chrome-512x512.png differ diff --git a/src/core/server/core_app/assets/favicons/apple-touch-icon.png b/src/core/server/core_app/assets/favicons/apple-touch-icon.png index 00b8c190b08c..d9e78832ef01 100644 Binary files a/src/core/server/core_app/assets/favicons/apple-touch-icon.png and b/src/core/server/core_app/assets/favicons/apple-touch-icon.png differ diff --git a/src/core/server/core_app/assets/favicons/favicon-16x16.png b/src/core/server/core_app/assets/favicons/favicon-16x16.png index f8a7a5cca077..5fde446e856a 100644 Binary files a/src/core/server/core_app/assets/favicons/favicon-16x16.png and b/src/core/server/core_app/assets/favicons/favicon-16x16.png differ diff --git a/src/core/server/core_app/assets/favicons/favicon-32x32.png b/src/core/server/core_app/assets/favicons/favicon-32x32.png index 3046f5df76f1..7d8e7ac2e9f1 100644 Binary files a/src/core/server/core_app/assets/favicons/favicon-32x32.png and b/src/core/server/core_app/assets/favicons/favicon-32x32.png differ diff --git a/src/core/server/core_app/assets/favicons/favicon.ico b/src/core/server/core_app/assets/favicons/favicon.ico index dd2d62ecec85..f5e4095b82e4 100644 Binary files a/src/core/server/core_app/assets/favicons/favicon.ico and b/src/core/server/core_app/assets/favicons/favicon.ico differ diff --git a/src/core/server/core_app/assets/favicons/mstile-144x144.png b/src/core/server/core_app/assets/favicons/mstile-144x144.png index 5a379489e086..d9e78832ef01 100644 Binary files a/src/core/server/core_app/assets/favicons/mstile-144x144.png and b/src/core/server/core_app/assets/favicons/mstile-144x144.png differ diff --git a/src/core/server/core_app/assets/favicons/mstile-150x150.png b/src/core/server/core_app/assets/favicons/mstile-150x150.png index b064558a1eda..32afe9a267e2 100644 Binary files a/src/core/server/core_app/assets/favicons/mstile-150x150.png and b/src/core/server/core_app/assets/favicons/mstile-150x150.png differ diff --git a/src/core/server/core_app/assets/favicons/mstile-310x150.png b/src/core/server/core_app/assets/favicons/mstile-310x150.png index d938be9ee090..e6d3ee3cce9d 100644 Binary files a/src/core/server/core_app/assets/favicons/mstile-310x150.png and b/src/core/server/core_app/assets/favicons/mstile-310x150.png differ diff --git a/src/core/server/core_app/assets/favicons/mstile-310x310.png b/src/core/server/core_app/assets/favicons/mstile-310x310.png index 0790cc1a7f5f..55aa51f1a264 100644 Binary files a/src/core/server/core_app/assets/favicons/mstile-310x310.png and b/src/core/server/core_app/assets/favicons/mstile-310x310.png differ diff --git a/src/core/server/core_app/assets/favicons/mstile-70x70.png b/src/core/server/core_app/assets/favicons/mstile-70x70.png index 5155640f0976..0083278ceb1f 100644 Binary files a/src/core/server/core_app/assets/favicons/mstile-70x70.png and b/src/core/server/core_app/assets/favicons/mstile-70x70.png differ diff --git a/src/core/server/core_app/assets/favicons/safari-pinned-tab.svg b/src/core/server/core_app/assets/favicons/safari-pinned-tab.svg index 5f8b7cfd8576..71f62271cac9 100644 --- a/src/core/server/core_app/assets/favicons/safari-pinned-tab.svg +++ b/src/core/server/core_app/assets/favicons/safari-pinned-tab.svg @@ -1 +1,13 @@ - + + + + + + + + + diff --git a/src/core/server/core_app/assets/legacy_light_theme.css b/src/core/server/core_app/assets/legacy_light_theme.css index 9f9a0dc118d1..9b2868f96d99 100644 --- a/src/core/server/core_app/assets/legacy_light_theme.css +++ b/src/core/server/core_app/assets/legacy_light_theme.css @@ -931,7 +931,8 @@ table th[class*="col-"] { .table > thead > tr.info > th, .table > tbody > tr.info > th, .table > tfoot > tr.info > th { - background-color: #006BB4; + /* Wazuh's color palette */ + background-color: #3595F9; } .table-hover > tbody > tr > td.info:hover, .table-hover > tbody > tr > th.info:hover, @@ -1050,7 +1051,8 @@ table th[class*="col-"] { transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; } .form-control:focus { - border-color: #006BB4; + /* Wazuh's color palette */ + border-color: #3595F9; outline: 0; -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(0, 107, 180, 0.6); box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(0, 107, 180, 0.6); @@ -1493,7 +1495,8 @@ a.text-danger:focus { color: #e6e6e6; } .bg-info { - background-color: #006BB4; + /* Wazuh's color palette */ + background-color: #3595F9; } a.bg-info:hover, a.bg-info:focus { @@ -1609,9 +1612,10 @@ fieldset[disabled] a.btn { pointer-events: none; } .btn-default { + /* Wazuh's color palette */ color: #FFF; - background-color: #006BB4; - border-color: #006BB4; + background-color: #3595F9; + border-color: #3595F9; } .btn-default:focus, .btn-default.focus { @@ -1658,17 +1662,20 @@ fieldset[disabled] .btn-default:focus, .btn-default.disabled.focus, .btn-default[disabled].focus, fieldset[disabled] .btn-default.focus { - background-color: #006BB4; - border-color: #006BB4; + /* Wazuh's color palette */ + background-color: #3595F9; + border-color: #3595F9; } .btn-default .badge { - color: #006BB4; + /* Wazuh's color palette */ + color: #3595F9; background-color: #FFF; } .btn-primary { + /* Wazuh's color palette */ color: #FFF; - background-color: #006BB4; - border-color: #006BB4; + background-color: #3595F9; + border-color: #3595F9; } .btn-primary:focus, .btn-primary.focus { @@ -1715,11 +1722,13 @@ fieldset[disabled] .btn-primary:focus, .btn-primary.disabled.focus, .btn-primary[disabled].focus, fieldset[disabled] .btn-primary.focus { - background-color: #006BB4; - border-color: #006BB4; + /* Wazuh's color palette */ + background-color: #3595F9; + border-color: #3595F9; } .btn-primary .badge { - color: #006BB4; + /* Wazuh's color palette */ + color: #3595F9; background-color: #FFF; } .btn-xs { @@ -2401,7 +2410,8 @@ button.close { background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } .progress-bar-info { - background-color: #006BB4; + /* Wazuh's color palette */ + background-color: #3595F9; } .progress-striped .progress-bar-info { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); @@ -2539,8 +2549,9 @@ button.list-group-item-success.active:focus { border-color: #FFF; } .list-group-item-info { + /* Wazuh's color palette */ color: #FFF; - background-color: #006BB4; + background-color: #3595F9; } a.list-group-item-info, button.list-group-item-info { @@ -2665,8 +2676,9 @@ button.list-group-item-danger.active:focus { .nav .open > a, .nav .open > a:hover, .nav .open > a:focus { + /* Wazuh's color palette */ background-color: #D3DAE6; - border-color: #006BB4; + border-color: #3595F9; } .nav .nav-divider { height: 1px; @@ -2759,8 +2771,9 @@ button.list-group-item-danger.active:focus { .nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus { + /* Wazuh's color palette */ color: #FFF; - background-color: #006BB4; + background-color: #3595F9; } .nav-stacked > li { float: none; @@ -2869,7 +2882,8 @@ button.list-group-item-danger.active:focus { color: #e6e6e6; } .alert-info { - background-color: #006BB4; + /* Wazuh's color palette */ + background-color: #3595F9; border-color: #004d81; color: #FFF; } @@ -3503,7 +3517,8 @@ select[multiple].input-group-sm > .input-group-addon { padding: 5px 15px; line-height: 1.42857143; text-decoration: none; - color: #006BB4; + /* Wazuh's color palette */ + color: #3595F9; background-color: transparent; border: 1px solid transparent; margin-left: -1px; @@ -3524,7 +3539,8 @@ select[multiple].input-group-sm > .input-group-addon { .pagination > li > a:focus, .pagination > li > span:focus { z-index: 2; - color: #006BB4; + /* Wazuh's color palette */ + color: #3595F9; background-color: rgba(0, 0, 0, 0); border-color: transparent; } @@ -3643,7 +3659,8 @@ a.label:focus { display: none; } .label-default { - background-color: #006BB4; + /* Wazuh's color palette */ + background-color: #3595F9; } .label-default[href]:hover, .label-default[href]:focus { @@ -3664,7 +3681,8 @@ a.label:focus { background-color: #014a44; } .label-info { - background-color: #006BB4; + /* Wazuh's color palette */ + background-color: #3595F9; } .label-info[href]:hover, .label-info[href]:focus { @@ -3977,15 +3995,17 @@ a.label:focus { border-color: #004d81; } .panel-info > .panel-heading { + /* Wazuh's color palette */ color: #FFF; - background-color: #006BB4; + background-color: #3595F9; border-color: #004d81; } .panel-info > .panel-heading + .panel-collapse > .panel-body { border-top-color: #004d81; } .panel-info > .panel-heading .badge { - color: #006BB4; + /* Wazuh's color palette */ + color: #3595F9; background-color: #FFF; } .panel-info > .panel-footer + .panel-collapse > .panel-body { @@ -4305,7 +4325,8 @@ a.label:focus { } .text-info, .text-info:hover { - color: #006BB4; + /* Wazuh's color palette */ + color: #3595F9; } table .success, .table .success, @@ -4428,3 +4449,71 @@ input:focus { -webkit-box-shadow: none; box-shadow: none; } + +/* -------------------------------- WAZUH -------------------------------- */ +.wz-login { + background: url(./wazuh_login_bg.svg) !important; + width: 100% !important; + height: 100% !important; + background-size: cover !important; +} + +.login-wrapper { + text-align: center; + width: 430px!important; + top: 55px; + border-radius: 1px; + padding: 1em; +} + +#opensearch-dashboards-body > div > div.app-wrapper.hidden-chrome > div > div.application > div > ul > div.euiText.euiText--medium > div { + text-align: center; + padding-bottom: 10px; + color: #ffffff !important; + font-size: 35px !important; + font-weight: 300; +} + +#opensearch-dashboards-body > div > div.app-wrapper.hidden-chrome > div > div.application > div > ul > div.euiText.euiText--small > div { + text-align: center; + padding-bottom: 15px; + color: #ffffff !important; + font-size: 16px !important; +} + +#opensearch-dashboards-body > div > div.app-wrapper.hidden-chrome > div > div.application > div > ul > form { + padding: 16px; + box-shadow: 0 2px 2px -1px rgba(152, 162, 179, 0.3), 0 1px 5px -2px rgba(152, 162, 179, 0.3); + background-color: #FFF; + border: 1px solid #D3DAE6; + border-radius: 4px; + -webkit-box-flex: 1; + -ms-flex-positive: 1; + flex-grow: 1; + margin-top: 32px; +} + +.loginWelcome__logo { + display: inline-block; + width: 80px; + height: 80px; + line-height: 80px; + text-align: center; + background-color: #FFF; + border-radius: 100%; + padding: 16px; + box-shadow: 0 6px 12px -1px rgba(152, 162, 179, 0.2), 0 4px 4px -1px rgba(152, 162, 179, 0.2), 0 2px 2px 0 rgba(152, 162, 179, 0.2); + margin-bottom: 32px; +} + +div.euiFormRow > div.euiFormRow__fieldWrapper > button { + background-color: #3595F9!important; + border-color: #3595F9!important; + color: #fff; +} + +.loginWelcome__logo { + background: url(./wazuh_logo_circle.svg) center center no-repeat !important; +} + +/* -------------------------------- WAZUH -------------------------------- */ diff --git a/src/core/server/core_app/assets/logos/opensearch_spinner.svg b/src/core/server/core_app/assets/logos/opensearch_spinner.svg deleted file mode 100644 index 98c6f2af6189..000000000000 --- a/src/core/server/core_app/assets/logos/opensearch_spinner.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/src/core/server/core_app/assets/logos/opensearch_spinner_on_dark.svg b/src/core/server/core_app/assets/logos/opensearch_spinner_on_dark.svg deleted file mode 100644 index 8d2b16595121..000000000000 --- a/src/core/server/core_app/assets/logos/opensearch_spinner_on_dark.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/src/core/server/core_app/assets/logos/opensearch_spinner_on_light.svg b/src/core/server/core_app/assets/logos/opensearch_spinner_on_light.svg deleted file mode 100644 index 41ab3c960b94..000000000000 --- a/src/core/server/core_app/assets/logos/opensearch_spinner_on_light.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/src/core/server/core_app/assets/logos/spinner.gif b/src/core/server/core_app/assets/logos/spinner.gif new file mode 100644 index 000000000000..de9446f345c6 Binary files /dev/null and b/src/core/server/core_app/assets/logos/spinner.gif differ diff --git a/src/core/server/core_app/assets/logos/spinner_on_dark.gif b/src/core/server/core_app/assets/logos/spinner_on_dark.gif new file mode 100644 index 000000000000..bca3614c2fab Binary files /dev/null and b/src/core/server/core_app/assets/logos/spinner_on_dark.gif differ diff --git a/src/core/server/core_app/assets/logos/spinner_on_light.gif b/src/core/server/core_app/assets/logos/spinner_on_light.gif new file mode 100644 index 000000000000..de9446f345c6 Binary files /dev/null and b/src/core/server/core_app/assets/logos/spinner_on_light.gif differ diff --git a/src/core/server/core_app/assets/wazuh_login_bg.svg b/src/core/server/core_app/assets/wazuh_login_bg.svg new file mode 100644 index 000000000000..ebe5663263a8 --- /dev/null +++ b/src/core/server/core_app/assets/wazuh_login_bg.svg @@ -0,0 +1,758 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/core/server/core_app/assets/wazuh_logo.svg b/src/core/server/core_app/assets/wazuh_logo.svg new file mode 100644 index 000000000000..b74126093841 --- /dev/null +++ b/src/core/server/core_app/assets/wazuh_logo.svg @@ -0,0 +1,51 @@ + + + + + + Layer 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/core/server/http/__snapshots__/http_service.test.ts.snap b/src/core/server/http/__snapshots__/http_service.test.ts.snap index 037c8990ea77..4d757cce8d5d 100644 --- a/src/core/server/http/__snapshots__/http_service.test.ts.snap +++ b/src/core/server/http/__snapshots__/http_service.test.ts.snap @@ -12,7 +12,7 @@ exports[`spins up notReady server until started if configured with \`autoListen: Object { "body": Array [ Array [ - "OpenSearch Dashboards server is not ready yet", + "Wazuh dashboard server is not ready yet", ], ], "code": Array [ diff --git a/src/core/server/http/http_service.ts b/src/core/server/http/http_service.ts index 8627557c7332..2f2b139880fe 100644 --- a/src/core/server/http/http_service.ts +++ b/src/core/server/http/http_service.ts @@ -198,15 +198,13 @@ export class HttpService path: '/{p*}', method: '*', handler: (req, responseToolkit) => { - this.log.debug( - `OpenSearch Dashboards server is not ready yet ${req.method}:${req.url.href}.` - ); + this.log.debug(`Wazuh dashboard server is not ready yet ${req.method}:${req.url.href}.`); // If server is not ready yet, because plugins or core can perform // long running tasks (build assets, saved objects migrations etc.) // we should let client know that and ask to retry after 30 seconds. return responseToolkit - .response('OpenSearch Dashboards server is not ready yet') + .response('Wazuh dashboard server is not ready yet') .code(503) .header('Retry-After', '30'); }, diff --git a/src/core/server/mocks.ts b/src/core/server/mocks.ts index 3dd289669a01..4d19acf8d1c5 100644 --- a/src/core/server/mocks.ts +++ b/src/core/server/mocks.ts @@ -113,6 +113,7 @@ function pluginInitializerContextMock(config: T = {} as T) { buildNum: 100, buildSha: 'buildSha', dist: false, + wazuhVersion: 'wazuhVersion', }, instanceUuid: 'instance-uuid', }, diff --git a/src/core/server/opensearch_dashboards_config.ts b/src/core/server/opensearch_dashboards_config.ts index 107d02ea3377..d6ff51be837a 100644 --- a/src/core/server/opensearch_dashboards_config.ts +++ b/src/core/server/opensearch_dashboards_config.ts @@ -79,7 +79,7 @@ export const config = { defaultValue: '/', }), applicationTitle: schema.string({ - defaultValue: '', + defaultValue: 'Wazuh', }), useExpandedHeader: schema.boolean({ defaultValue: true, diff --git a/src/core/server/plugins/discovery/plugin_manifest_parser.test.ts b/src/core/server/plugins/discovery/plugin_manifest_parser.test.ts index 5ef01f88f3f7..3dedc87479f2 100644 --- a/src/core/server/plugins/discovery/plugin_manifest_parser.test.ts +++ b/src/core/server/plugins/discovery/plugin_manifest_parser.test.ts @@ -45,6 +45,7 @@ const packageInfo = { buildSha: '', version: '7.0.0-alpha1', dist: false, + wazuhVersion: '4.0.0', }; afterEach(() => { diff --git a/src/core/server/plugins/discovery/plugins_discovery.test.ts b/src/core/server/plugins/discovery/plugins_discovery.test.ts index 550acaf3f4f3..adf67dc7dfa5 100644 --- a/src/core/server/plugins/discovery/plugins_discovery.test.ts +++ b/src/core/server/plugins/discovery/plugins_discovery.test.ts @@ -82,6 +82,9 @@ const packageMock = { number: 1, sha: '', }, + wazuh: { + version: '4.x.x', + }, }; const manifestPath = (...pluginPath: string[]) => diff --git a/src/core/server/plugins/integration_tests/plugins_service.test.ts b/src/core/server/plugins/integration_tests/plugins_service.test.ts index ea400ddcd913..89280544ebca 100644 --- a/src/core/server/plugins/integration_tests/plugins_service.test.ts +++ b/src/core/server/plugins/integration_tests/plugins_service.test.ts @@ -106,6 +106,9 @@ describe('PluginsService', () => { number: 100, sha: 'feature-v1-build-sha', }, + wazuh: { + version: '4.x.x', + }, }; const env = Env.createDefault(REPO_ROOT, getEnvOptions()); diff --git a/src/core/server/plugins/plugins_service.test.ts b/src/core/server/plugins/plugins_service.test.ts index 36c594908845..baf47fd6cd4d 100644 --- a/src/core/server/plugins/plugins_service.test.ts +++ b/src/core/server/plugins/plugins_service.test.ts @@ -128,6 +128,9 @@ describe('PluginsService', () => { number: 100, sha: 'feature-v1-build-sha', }, + wazuh: { + version: '4.x.x', + }, }; coreId = Symbol('core'); diff --git a/src/core/server/rendering/__snapshots__/rendering_service.test.ts.snap b/src/core/server/rendering/__snapshots__/rendering_service.test.ts.snap index ad92d759a832..97b361a5f286 100644 --- a/src/core/server/rendering/__snapshots__/rendering_service.test.ts.snap +++ b/src/core/server/rendering/__snapshots__/rendering_service.test.ts.snap @@ -6,7 +6,7 @@ Object { "basePath": "/mock-server-basepath", "branch": Any, "branding": Object { - "applicationTitle": "OpenSearch Dashboards", + "applicationTitle": "Wazuh", "assetFolderUrl": "/mock-server-basepath/ui/default_branding", "darkMode": false, "loadingLogo": Object {}, @@ -30,6 +30,7 @@ Object { "buildSha": Any, "dist": Any, "version": Any, + "wazuhVersion": Any, }, }, "i18n": Object { @@ -50,6 +51,7 @@ Object { "uiPlugins": Array [], "vars": Object {}, "version": Any, + "wazuhVersion": "4.9.0", } `; @@ -59,7 +61,7 @@ Object { "basePath": "/mock-server-basepath", "branch": Any, "branding": Object { - "applicationTitle": "OpenSearch Dashboards", + "applicationTitle": "Wazuh", "assetFolderUrl": "/mock-server-basepath/ui/default_branding", "darkMode": false, "loadingLogo": Object {}, @@ -83,6 +85,7 @@ Object { "buildSha": Any, "dist": Any, "version": Any, + "wazuhVersion": Any, }, }, "i18n": Object { @@ -103,6 +106,7 @@ Object { "uiPlugins": Array [], "vars": Object {}, "version": Any, + "wazuhVersion": "4.9.0", } `; @@ -112,7 +116,7 @@ Object { "basePath": "/mock-server-basepath", "branch": Any, "branding": Object { - "applicationTitle": "OpenSearch Dashboards", + "applicationTitle": "Wazuh", "assetFolderUrl": "/mock-server-basepath/ui/default_branding", "darkMode": true, "loadingLogo": Object {}, @@ -136,6 +140,7 @@ Object { "buildSha": Any, "dist": Any, "version": Any, + "wazuhVersion": Any, }, }, "i18n": Object { @@ -156,6 +161,7 @@ Object { "uiPlugins": Array [], "vars": Object {}, "version": Any, + "wazuhVersion": "4.9.0", } `; @@ -165,7 +171,7 @@ Object { "basePath": "/mock-server-basepath", "branch": Any, "branding": Object { - "applicationTitle": "OpenSearch Dashboards", + "applicationTitle": "Wazuh", "assetFolderUrl": "/mock-server-basepath/ui/default_branding", "darkMode": true, "loadingLogo": Object {}, @@ -189,6 +195,7 @@ Object { "buildSha": Any, "dist": Any, "version": Any, + "wazuhVersion": Any, }, }, "i18n": Object { @@ -213,6 +220,7 @@ Object { "uiPlugins": Array [], "vars": Object {}, "version": Any, + "wazuhVersion": "4.9.0", } `; @@ -222,7 +230,7 @@ Object { "basePath": "", "branch": Any, "branding": Object { - "applicationTitle": "OpenSearch Dashboards", + "applicationTitle": "Wazuh", "assetFolderUrl": "/ui/default_branding", "darkMode": false, "loadingLogo": Object {}, @@ -246,6 +254,7 @@ Object { "buildSha": Any, "dist": Any, "version": Any, + "wazuhVersion": Any, }, }, "i18n": Object { @@ -266,6 +275,7 @@ Object { "uiPlugins": Array [], "vars": Object {}, "version": Any, + "wazuhVersion": "4.9.0", } `; @@ -275,7 +285,7 @@ Object { "basePath": "/mock-server-basepath", "branch": Any, "branding": Object { - "applicationTitle": "OpenSearch Dashboards", + "applicationTitle": "Wazuh", "assetFolderUrl": "/mock-server-basepath/ui/default_branding", "darkMode": false, "loadingLogo": Object {}, @@ -299,6 +309,7 @@ Object { "buildSha": Any, "dist": Any, "version": Any, + "wazuhVersion": Any, }, }, "i18n": Object { @@ -319,6 +330,7 @@ Object { "uiPlugins": Array [], "vars": Object {}, "version": Any, + "wazuhVersion": "4.9.0", } `; @@ -328,7 +340,7 @@ Object { "basePath": "/mock-server-basepath", "branch": Any, "branding": Object { - "applicationTitle": "OpenSearch Dashboards", + "applicationTitle": "Wazuh", "assetFolderUrl": "/mock-server-basepath/ui/default_branding", "darkMode": false, "loadingLogo": Object {}, @@ -352,6 +364,7 @@ Object { "buildSha": Any, "dist": Any, "version": Any, + "wazuhVersion": Any, }, }, "i18n": Object { @@ -372,5 +385,6 @@ Object { "uiPlugins": Array [], "vars": Object {}, "version": Any, + "wazuhVersion": "4.9.0", } `; diff --git a/src/core/server/rendering/rendering_service.test.ts b/src/core/server/rendering/rendering_service.test.ts index 56a39915e73c..e2bae4f06042 100644 --- a/src/core/server/rendering/rendering_service.test.ts +++ b/src/core/server/rendering/rendering_service.test.ts @@ -56,6 +56,7 @@ const INJECTED_METADATA = { buildSha: expect.any(String), dist: expect.any(Boolean), version: expect.any(String), + wazuhVersion: expect.any(String), }, }, }; diff --git a/src/core/server/rendering/rendering_service.tsx b/src/core/server/rendering/rendering_service.tsx index d0a62555d4b2..f845f8751fd2 100644 --- a/src/core/server/rendering/rendering_service.tsx +++ b/src/core/server/rendering/rendering_service.tsx @@ -124,6 +124,7 @@ export class RenderingService { version: env.packageInfo.version, buildNumber: env.packageInfo.buildNum, branch: env.packageInfo.branch, + wazuhVersion: env.packageInfo.wazuhVersion, basePath, serverBasePath, env, diff --git a/src/core/server/rendering/types.ts b/src/core/server/rendering/types.ts index 45821c2b8228..12144ef14bac 100644 --- a/src/core/server/rendering/types.ts +++ b/src/core/server/rendering/types.ts @@ -51,6 +51,7 @@ export interface RenderingMetadata { version: string; buildNumber: number; branch: string; + wazuhVersion: string; basePath: string; serverBasePath: string; env: { diff --git a/src/core/server/rendering/views/__snapshots__/template.test.tsx.snap b/src/core/server/rendering/views/__snapshots__/template.test.tsx.snap index 36d073992ec8..f7b85f7929fe 100644 --- a/src/core/server/rendering/views/__snapshots__/template.test.tsx.snap +++ b/src/core/server/rendering/views/__snapshots__/template.test.tsx.snap @@ -66,7 +66,7 @@ Array [ data="{\\"strictCsp\\":true}" />, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
, ,
= ({ theme, darkMode }) => { .osdWelcomeText { display: inline-block; - font-size: 14px; + font-size: 24px; /* Wazuh */ + font-family: sans-serif; line-height: 40px !important; height: 40px !important; color: ${themeDefinition.euiColorDarkShade}; @@ -134,8 +135,8 @@ export const Styles: FunctionComponent = ({ theme, darkMode }) => { } .osdLoaderWrap svg { - width: 64px; - height: 64px; + width: 384px; /* Wazuh */ + height: 112px; /* Wazuh */ margin: auto; line-height: 1; } @@ -147,8 +148,8 @@ export const Styles: FunctionComponent = ({ theme, darkMode }) => { .osdProgress { display: inline-block; position: relative; - width: 32px; - height: 4px; + width: 256px; /* Wazuh */ + height: 10px; overflow: hidden; background-color: ${themeDefinition.euiColorLightestShade}; line-height: 1; @@ -157,7 +158,7 @@ export const Styles: FunctionComponent = ({ theme, darkMode }) => { .osdProgress:before { position: absolute; content: ''; - height: 4px; + height: 10px; /* Wazuh */ width: 100%; top: 0; bottom: 0; @@ -168,8 +169,8 @@ export const Styles: FunctionComponent = ({ theme, darkMode }) => { } .loadingLogoContainer { - height: 80px; - padding: 8px; + height: 150px; /* Wazuh */ + padding: 10px 10px 10px 10px; } .loadingLogo { diff --git a/src/core/server/rendering/views/template.test.tsx b/src/core/server/rendering/views/template.test.tsx index 39a3e1401ea3..dcc571384d72 100644 --- a/src/core/server/rendering/views/template.test.tsx +++ b/src/core/server/rendering/views/template.test.tsx @@ -25,6 +25,7 @@ function mockProps() { version: injectedMetadata.getOpenSearchDashboardsVersion(), buildNumber: 1, branch: injectedMetadata.getBasePath(), + wazuhVersion: injectedMetadata.getWazuhVersion(), basePath: '', serverBasePath: '', env: { @@ -34,6 +35,7 @@ function mockProps() { buildNum: 1, buildSha: '', dist: true, + wazuhVersion: '', }, mode: { name: 'production' as 'development' | 'production', diff --git a/src/core/server/rendering/views/template.tsx b/src/core/server/rendering/views/template.tsx index 8aa7903d8df1..5d3709283bd5 100644 --- a/src/core/server/rendering/views/template.tsx +++ b/src/core/server/rendering/views/template.tsx @@ -154,7 +154,9 @@ export const Template: FunctionComponent = ({ })} > {i18n('core.ui.welcomeMessage', { - defaultMessage: `Loading ${applicationTitle}`, + // Wazuh: change the default message to avoid + // showing the "Loading Wazuh" message twice. + defaultMessage: 'Loading ...', })}
{/* Show a progress bar if a static custom branded logo is used */} diff --git a/src/core/server/status/routes/integration_tests/status.test.ts b/src/core/server/status/routes/integration_tests/status.test.ts index 1045ca939c05..d52c895fa6b6 100644 --- a/src/core/server/status/routes/integration_tests/status.test.ts +++ b/src/core/server/status/routes/integration_tests/status.test.ts @@ -79,6 +79,7 @@ describe('GET /api/status', () => { buildSha: 'xsha', dist: true, version: '9.9.9-SNAPSHOT', + wazuhVersion: '4.2.0', }, serverName: 'xopensearchDashboards', uuid: 'xxxx-xxxxx', diff --git a/src/dev/build/lib/config.ts b/src/dev/build/lib/config.ts index 6af5b8e6901a..9a7307dddd4a 100644 --- a/src/dev/build/lib/config.ts +++ b/src/dev/build/lib/config.ts @@ -55,6 +55,7 @@ interface Package { workspaces: { packages: string[]; }; + wazuh: { version: string }; [key: string]: unknown; } diff --git a/src/dev/build/tasks/create_package_json_task.ts b/src/dev/build/tasks/create_package_json_task.ts index 8f9b41738eea..7b8d2a311a0b 100644 --- a/src/dev/build/tasks/create_package_json_task.ts +++ b/src/dev/build/tasks/create_package_json_task.ts @@ -51,6 +51,9 @@ export const CreatePackageJson: Task = { distributable: true, release: config.isRelease, }, + wazuh: { + version: pkg.wazuh.version, + }, repository: pkg.repository, engines: { node: pkg.engines.node, diff --git a/src/dev/precommit_hook/casing_check_config.js b/src/dev/precommit_hook/casing_check_config.js index 53dc1869bd52..eb3ceff6f9e8 100644 --- a/src/dev/precommit_hook/casing_check_config.js +++ b/src/dev/precommit_hook/casing_check_config.js @@ -66,7 +66,7 @@ export const IGNORE_FILE_GLOBS = [ 'packages/opensearch-safer-lodash-set/**/*', // TODO fix file names in APM to remove these - + 'dev-tools/**/*', // packages for the ingest manager's api integration tests could be valid semver which has dashes ]; @@ -102,6 +102,7 @@ export const IGNORE_DIRECTORY_GLOBS = [ 'test/functional/fixtures/opensearch_archiver/visualize_source-filters', 'packages/osd-pm/src/utils/__fixtures__/*', 'src/dev/build/tasks/__fixtures__/*', + 'dev-tools/*', ]; /** diff --git a/src/plugins/advanced_settings/public/management_app/components/call_outs/__snapshots__/call_outs.test.tsx.snap b/src/plugins/advanced_settings/public/management_app/components/call_outs/__snapshots__/call_outs.test.tsx.snap index 1bef984d56dd..c8d90d009555 100644 --- a/src/plugins/advanced_settings/public/management_app/components/call_outs/__snapshots__/call_outs.test.tsx.snap +++ b/src/plugins/advanced_settings/public/management_app/components/call_outs/__snapshots__/call_outs.test.tsx.snap @@ -15,7 +15,7 @@ exports[`CallOuts should render normally 1`] = ` >

diff --git a/src/plugins/advanced_settings/public/management_app/components/call_outs/call_outs.tsx b/src/plugins/advanced_settings/public/management_app/components/call_outs/call_outs.tsx index c2a0d93612f2..efeca4b7cf45 100644 --- a/src/plugins/advanced_settings/public/management_app/components/call_outs/call_outs.tsx +++ b/src/plugins/advanced_settings/public/management_app/components/call_outs/call_outs.tsx @@ -50,11 +50,11 @@ export const CallOuts = () => {

diff --git a/src/plugins/dashboard/public/application/components/dashboard_listing/__snapshots__/dashboard_listing.test.tsx.snap b/src/plugins/dashboard/public/application/components/dashboard_listing/__snapshots__/dashboard_listing.test.tsx.snap index 1b3c486615c8..d6f3a12fee7e 100644 --- a/src/plugins/dashboard/public/application/components/dashboard_listing/__snapshots__/dashboard_listing.test.tsx.snap +++ b/src/plugins/dashboard/public/application/components/dashboard_listing/__snapshots__/dashboard_listing.test.tsx.snap @@ -151,14 +151,14 @@ exports[`dashboard listing hideWriteControls 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -479,6 +479,7 @@ exports[`dashboard listing hideWriteControls 1`] = ` "docLinks": Object { "DOC_LINK_VERSION": "mocked-test-branch", "OPENSEARCH_WEBSITE_URL": "https://opensearch.org/", + "WAZUH_DOC_VERSION": "4.x", "links": Object { "noDocumentation": Object { "addData": "https://opensearch.org/docs/mocked-test-branch", @@ -824,6 +825,9 @@ exports[`dashboard listing hideWriteControls 1`] = ` "guide": "https://opensearch.org/docs/mocked-test-branchvisualize/viz-index/", }, }, + "wazuh": Object { + "index": "https://documentation.wazuh.com/4.x/index.html", + }, }, }, "embeddable": Object { @@ -1243,14 +1247,14 @@ exports[`dashboard listing render table listing with initial filters from URL 1` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -1571,6 +1575,7 @@ exports[`dashboard listing render table listing with initial filters from URL 1` "docLinks": Object { "DOC_LINK_VERSION": "mocked-test-branch", "OPENSEARCH_WEBSITE_URL": "https://opensearch.org/", + "WAZUH_DOC_VERSION": "4.x", "links": Object { "noDocumentation": Object { "addData": "https://opensearch.org/docs/mocked-test-branch", @@ -1916,6 +1921,9 @@ exports[`dashboard listing render table listing with initial filters from URL 1` "guide": "https://opensearch.org/docs/mocked-test-branchvisualize/viz-index/", }, }, + "wazuh": Object { + "index": "https://documentation.wazuh.com/4.x/index.html", + }, }, }, "embeddable": Object { @@ -2396,14 +2404,14 @@ exports[`dashboard listing renders call to action when no dashboards exist 1`] = "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -2724,6 +2732,7 @@ exports[`dashboard listing renders call to action when no dashboards exist 1`] = "docLinks": Object { "DOC_LINK_VERSION": "mocked-test-branch", "OPENSEARCH_WEBSITE_URL": "https://opensearch.org/", + "WAZUH_DOC_VERSION": "4.x", "links": Object { "noDocumentation": Object { "addData": "https://opensearch.org/docs/mocked-test-branch", @@ -3069,6 +3078,9 @@ exports[`dashboard listing renders call to action when no dashboards exist 1`] = "guide": "https://opensearch.org/docs/mocked-test-branchvisualize/viz-index/", }, }, + "wazuh": Object { + "index": "https://documentation.wazuh.com/4.x/index.html", + }, }, }, "embeddable": Object { @@ -3549,14 +3561,14 @@ exports[`dashboard listing renders table rows 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -3877,6 +3889,7 @@ exports[`dashboard listing renders table rows 1`] = ` "docLinks": Object { "DOC_LINK_VERSION": "mocked-test-branch", "OPENSEARCH_WEBSITE_URL": "https://opensearch.org/", + "WAZUH_DOC_VERSION": "4.x", "links": Object { "noDocumentation": Object { "addData": "https://opensearch.org/docs/mocked-test-branch", @@ -4222,6 +4235,9 @@ exports[`dashboard listing renders table rows 1`] = ` "guide": "https://opensearch.org/docs/mocked-test-branchvisualize/viz-index/", }, }, + "wazuh": Object { + "index": "https://documentation.wazuh.com/4.x/index.html", + }, }, }, "embeddable": Object { @@ -4702,14 +4718,14 @@ exports[`dashboard listing renders warning when listingLimit is exceeded 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -5030,6 +5046,7 @@ exports[`dashboard listing renders warning when listingLimit is exceeded 1`] = ` "docLinks": Object { "DOC_LINK_VERSION": "mocked-test-branch", "OPENSEARCH_WEBSITE_URL": "https://opensearch.org/", + "WAZUH_DOC_VERSION": "4.x", "links": Object { "noDocumentation": Object { "addData": "https://opensearch.org/docs/mocked-test-branch", @@ -5375,6 +5392,9 @@ exports[`dashboard listing renders warning when listingLimit is exceeded 1`] = ` "guide": "https://opensearch.org/docs/mocked-test-branchvisualize/viz-index/", }, }, + "wazuh": Object { + "index": "https://documentation.wazuh.com/4.x/index.html", + }, }, }, "embeddable": Object { diff --git a/src/plugins/dashboard/public/application/components/dashboard_top_nav/__snapshots__/dashboard_top_nav.test.tsx.snap b/src/plugins/dashboard/public/application/components/dashboard_top_nav/__snapshots__/dashboard_top_nav.test.tsx.snap index 101e0e520304..2b224d434e89 100644 --- a/src/plugins/dashboard/public/application/components/dashboard_top_nav/__snapshots__/dashboard_top_nav.test.tsx.snap +++ b/src/plugins/dashboard/public/application/components/dashboard_top_nav/__snapshots__/dashboard_top_nav.test.tsx.snap @@ -139,14 +139,14 @@ exports[`Dashboard top nav render in embed mode 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -371,6 +371,7 @@ exports[`Dashboard top nav render in embed mode 1`] = ` "docLinks": Object { "DOC_LINK_VERSION": "mocked-test-branch", "OPENSEARCH_WEBSITE_URL": "https://opensearch.org/", + "WAZUH_DOC_VERSION": "4.x", "links": Object { "noDocumentation": Object { "addData": "https://opensearch.org/docs/mocked-test-branch", @@ -716,6 +717,9 @@ exports[`Dashboard top nav render in embed mode 1`] = ` "guide": "https://opensearch.org/docs/mocked-test-branchvisualize/viz-index/", }, }, + "wazuh": Object { + "index": "https://documentation.wazuh.com/4.x/index.html", + }, }, }, "embeddable": Object { @@ -1056,14 +1060,14 @@ exports[`Dashboard top nav render in embed mode, and force hide filter bar 1`] = "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -1288,6 +1292,7 @@ exports[`Dashboard top nav render in embed mode, and force hide filter bar 1`] = "docLinks": Object { "DOC_LINK_VERSION": "mocked-test-branch", "OPENSEARCH_WEBSITE_URL": "https://opensearch.org/", + "WAZUH_DOC_VERSION": "4.x", "links": Object { "noDocumentation": Object { "addData": "https://opensearch.org/docs/mocked-test-branch", @@ -1633,6 +1638,9 @@ exports[`Dashboard top nav render in embed mode, and force hide filter bar 1`] = "guide": "https://opensearch.org/docs/mocked-test-branchvisualize/viz-index/", }, }, + "wazuh": Object { + "index": "https://documentation.wazuh.com/4.x/index.html", + }, }, }, "embeddable": Object { @@ -1973,14 +1981,14 @@ exports[`Dashboard top nav render in embed mode, components can be forced show b "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -2205,6 +2213,7 @@ exports[`Dashboard top nav render in embed mode, components can be forced show b "docLinks": Object { "DOC_LINK_VERSION": "mocked-test-branch", "OPENSEARCH_WEBSITE_URL": "https://opensearch.org/", + "WAZUH_DOC_VERSION": "4.x", "links": Object { "noDocumentation": Object { "addData": "https://opensearch.org/docs/mocked-test-branch", @@ -2550,6 +2559,9 @@ exports[`Dashboard top nav render in embed mode, components can be forced show b "guide": "https://opensearch.org/docs/mocked-test-branchvisualize/viz-index/", }, }, + "wazuh": Object { + "index": "https://documentation.wazuh.com/4.x/index.html", + }, }, }, "embeddable": Object { @@ -2890,14 +2902,14 @@ exports[`Dashboard top nav render in full screen mode with appended URL param bu "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -3122,6 +3134,7 @@ exports[`Dashboard top nav render in full screen mode with appended URL param bu "docLinks": Object { "DOC_LINK_VERSION": "mocked-test-branch", "OPENSEARCH_WEBSITE_URL": "https://opensearch.org/", + "WAZUH_DOC_VERSION": "4.x", "links": Object { "noDocumentation": Object { "addData": "https://opensearch.org/docs/mocked-test-branch", @@ -3467,6 +3480,9 @@ exports[`Dashboard top nav render in full screen mode with appended URL param bu "guide": "https://opensearch.org/docs/mocked-test-branchvisualize/viz-index/", }, }, + "wazuh": Object { + "index": "https://documentation.wazuh.com/4.x/index.html", + }, }, }, "embeddable": Object { @@ -3807,14 +3823,14 @@ exports[`Dashboard top nav render in full screen mode, no componenets should be "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -4039,6 +4055,7 @@ exports[`Dashboard top nav render in full screen mode, no componenets should be "docLinks": Object { "DOC_LINK_VERSION": "mocked-test-branch", "OPENSEARCH_WEBSITE_URL": "https://opensearch.org/", + "WAZUH_DOC_VERSION": "4.x", "links": Object { "noDocumentation": Object { "addData": "https://opensearch.org/docs/mocked-test-branch", @@ -4384,6 +4401,9 @@ exports[`Dashboard top nav render in full screen mode, no componenets should be "guide": "https://opensearch.org/docs/mocked-test-branchvisualize/viz-index/", }, }, + "wazuh": Object { + "index": "https://documentation.wazuh.com/4.x/index.html", + }, }, }, "embeddable": Object { @@ -4724,14 +4744,14 @@ exports[`Dashboard top nav render with all components 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -4956,6 +4976,7 @@ exports[`Dashboard top nav render with all components 1`] = ` "docLinks": Object { "DOC_LINK_VERSION": "mocked-test-branch", "OPENSEARCH_WEBSITE_URL": "https://opensearch.org/", + "WAZUH_DOC_VERSION": "4.x", "links": Object { "noDocumentation": Object { "addData": "https://opensearch.org/docs/mocked-test-branch", @@ -5301,6 +5322,9 @@ exports[`Dashboard top nav render with all components 1`] = ` "guide": "https://opensearch.org/docs/mocked-test-branchvisualize/viz-index/", }, }, + "wazuh": Object { + "index": "https://documentation.wazuh.com/4.x/index.html", + }, }, }, "embeddable": Object { diff --git a/src/plugins/home/opensearch_dashboards.json b/src/plugins/home/opensearch_dashboards.json index 40351c0dd83c..35a81bc7adb9 100644 --- a/src/plugins/home/opensearch_dashboards.json +++ b/src/plugins/home/opensearch_dashboards.json @@ -6,6 +6,6 @@ "requiredPlugins": ["data", "urlForwarding"], "optionalPlugins": ["usageCollection", "telemetry", "dataSource"], "requiredBundles": [ - "opensearchDashboardsReact", "dataSourceManagement" + "opensearchDashboardsReact" ] } diff --git a/src/plugins/home/public/application/components/__snapshots__/home.test.js.snap b/src/plugins/home/public/application/components/__snapshots__/home.test.js.snap index 31df3b66efb5..ecf88b90b6bd 100644 --- a/src/plugins/home/public/application/components/__snapshots__/home.test.js.snap +++ b/src/plugins/home/public/application/components/__snapshots__/home.test.js.snap @@ -26,12 +26,6 @@ exports[`home change home route should render a link to change the default route - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ +`; + +exports[`home welcome stores skip welcome setting if skipped 1`] = ` +
+ + } + /> +
+ - - - - diff --git a/src/plugins/home/public/application/components/home.test.js b/src/plugins/home/public/application/components/home.test.js index 0c0953dbd63f..6bdd659e5f7c 100644 --- a/src/plugins/home/public/application/components/home.test.js +++ b/src/plugins/home/public/application/components/home.test.js @@ -90,7 +90,7 @@ describe('home', () => { expect(path).toMatch(/home:(welcome|newThemeModal):show/); return 'false'; }), - setItem: sinon.mock(), + setItem: jest.fn(), }, urlBasePath: 'goober', onOptInSeen() { @@ -305,23 +305,20 @@ describe('home', () => { expect(component).toMatchSnapshot(); }); - - test('stores skip welcome setting if skipped', async () => { + // Skip test because it is not used in Wazuh dashboards + test.skip('stores skip welcome setting if skipped', async () => { defaultProps.localStorage.getItem = sinon.spy(() => 'true'); const component = await renderHome({ find: () => Promise.resolve({ total: 0 }), }); - component.instance().skipWelcome(); - component.update(); - sinon.assert.calledWith(defaultProps.localStorage.setItem, 'home:welcome:show', 'false'); expect(component).toMatchSnapshot(); }); - - test('should show the normal home page if loading fails', async () => { + // Skip test because it is not used in Wazuh dashboards + test.skip('should show the normal home page if loading fails', async () => { defaultProps.localStorage.getItem = sinon.spy(() => 'true'); const component = await renderHome({ @@ -376,7 +373,7 @@ describe('home', () => { sinon.assert.calledWith(defaultProps.localStorage.getItem, 'home:newThemeModal:show'); - expect(component.find(NewThemeModal).exists()).toBeTruthy(); + expect(component.find(NewThemeModal).exists()).toBeFalsy(); expect(component).toMatchSnapshot(); }); test('should not show the new theme modal if v7 theme in use', async () => { diff --git a/src/plugins/home/public/application/components/home_app.js b/src/plugins/home/public/application/components/home_app.js index 4e8dd16dd998..ac10eeedb454 100644 --- a/src/plugins/home/public/application/components/home_app.js +++ b/src/plugins/home/public/application/components/home_app.js @@ -33,11 +33,7 @@ import { I18nProvider } from '@osd/i18n/react'; import PropTypes from 'prop-types'; import { Home } from './home'; import { FeatureDirectory } from './feature_directory'; -import { TutorialDirectory } from './tutorial_directory'; -import { Tutorial } from './tutorial/tutorial'; import { HashRouter as Router, Switch, Route } from 'react-router-dom'; -import { getTutorial } from '../load_tutorials'; -import { replaceTemplateStrings } from './tutorial/replace_template_strings'; import { getServices } from '../opensearch_dashboards_services'; import { useMount } from 'react-use'; @@ -50,45 +46,12 @@ const RedirectToDefaultApp = () => { }; export function HomeApp({ directories, solutions }) { - const { - savedObjectsClient, - getBasePath, - addBasePath, - environmentService, - telemetry, - } = getServices(); - const environment = environmentService.getEnvironment(); - const isCloudEnabled = environment.cloud; - - const renderTutorialDirectory = (props) => { - return ( - - ); - }; - - const renderTutorial = (props) => { - return ( - - ); - }; + const { savedObjectsClient, getBasePath, addBasePath, telemetry } = getServices(); return ( - - diff --git a/src/plugins/home/public/application/components/solutions_section/__snapshots__/solution_title.test.tsx.snap b/src/plugins/home/public/application/components/solutions_section/__snapshots__/solution_title.test.tsx.snap index c88537eac658..4c4943d47882 100644 --- a/src/plugins/home/public/application/components/solutions_section/__snapshots__/solution_title.test.tsx.snap +++ b/src/plugins/home/public/application/components/solutions_section/__snapshots__/solution_title.test.tsx.snap @@ -11,7 +11,7 @@ exports[`SolutionTitle renders correctly by default 1`] = ` diff --git a/src/plugins/home/public/application/components/solutions_section/solution_title.test.tsx b/src/plugins/home/public/application/components/solutions_section/solution_title.test.tsx index 9d8f7662f8fb..132159b8e784 100644 --- a/src/plugins/home/public/application/components/solutions_section/solution_title.test.tsx +++ b/src/plugins/home/public/application/components/solutions_section/solution_title.test.tsx @@ -64,7 +64,7 @@ describe('SolutionTitle ', () => { expect(elements.length).toEqual(1); const img = elements.first(); - expect(img.prop('iconType')).toEqual(props.logos.Mark.url); + expect(img.prop('iconType')).toEqual('/ui/favicons/safari-pinned-tab.svg'); const titles = component.find('EuiTitle > h3'); expect(titles.length).toEqual(1); diff --git a/src/plugins/home/public/application/components/solutions_section/solution_title.tsx b/src/plugins/home/public/application/components/solutions_section/solution_title.tsx index f2a7af96d715..a0254d4cc142 100644 --- a/src/plugins/home/public/application/components/solutions_section/solution_title.tsx +++ b/src/plugins/home/public/application/components/solutions_section/solution_title.tsx @@ -76,8 +76,9 @@ export const SolutionTitle: FC = ({ subtitle, branding, logos }) => ( />
) : ( + // Wazuh logo in the overview card { category: 'data', icon: 'indexOpen', id: 'home_tutorial_directory', - showOnHomePage: true, + showOnHomePage: false, }) ); }); diff --git a/src/plugins/home/public/plugin.ts b/src/plugins/home/public/plugin.ts index 1538156a801e..db0c3e18b117 100644 --- a/src/plugins/home/public/plugin.ts +++ b/src/plugins/home/public/plugin.ts @@ -133,7 +133,8 @@ export class HomePublicPlugin urlForwarding.forwardApp('home', 'home'); const featureCatalogue = { ...this.featuresCatalogueRegistry.setup() }; - + // Disable sample data in home/view app directory + // To activate it again, remove visible() and change showOnHomePage to true. featureCatalogue.register({ id: 'home_tutorial_directory', title: i18n.translate('home.tutorialDirectory.featureCatalogueTitle', { @@ -143,9 +144,12 @@ export class HomePublicPlugin defaultMessage: 'Get started with sample data, visualizations, and dashboards.', }), icon: 'indexOpen', - showOnHomePage: true, + showOnHomePage: false, path: `${HOME_APP_BASE_PATH}#/tutorial_directory`, category: 'data' as FeatureCatalogueCategory.DATA, + visible() { + return false; + }, order: 500, }); diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/__snapshots__/empty_state.test.tsx.snap b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/__snapshots__/empty_state.test.tsx.snap index a617fa0511e2..8a36dc08a89e 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/__snapshots__/empty_state.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/__snapshots__/empty_state.test.tsx.snap @@ -29,35 +29,7 @@ exports[`EmptyState should render normally 1`] = ` className="inpEmptyState__cardGrid" columns={3} responsive={true} - > - - - } - icon={ - - } - onClick={[Function]} - title={ - - } - /> - - + /> diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.tsx b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.tsx index 96862e59ffa5..4a1d7f518e05 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.tsx +++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.tsx @@ -172,25 +172,6 @@ export const EmptyState = ({ /> */} {getMlCardState() !== MlCardState.HIDDEN ? mlCard : <>} - - navigateToApp('home', { path: '#/tutorial_directory/sampleData' })} - icon={} - title={ - - } - description={ - - } - /> -
diff --git a/src/plugins/management/public/components/landing/landing.tsx b/src/plugins/management/public/components/landing/landing.tsx index 5557eb7e9019..5ec74dc538bc 100644 --- a/src/plugins/management/public/components/landing/landing.tsx +++ b/src/plugins/management/public/components/landing/landing.tsx @@ -68,7 +68,7 @@ export const ManagementLandingPage = ({ setBreadcrumbs }: ManagementLandingPageP
diff --git a/src/plugins/opensearch_dashboards_overview/common/index.ts b/src/plugins/opensearch_dashboards_overview/common/index.ts index 79a90f2794c1..69c0977dce5e 100644 --- a/src/plugins/opensearch_dashboards_overview/common/index.ts +++ b/src/plugins/opensearch_dashboards_overview/common/index.ts @@ -30,5 +30,5 @@ export const PLUGIN_ID = 'opensearchDashboardsOverview'; export const PLUGIN_NAME = 'Overview'; -export const PLUGIN_PATH = `/app/opensearch_dashboards_overview`; +export const PLUGIN_PATH = `/app/home/`; export const PLUGIN_ICON = 'inputOutput'; diff --git a/src/plugins/opensearch_dashboards_overview/public/components/getting_started/__snapshots__/getting_started.test.tsx.snap b/src/plugins/opensearch_dashboards_overview/public/components/getting_started/__snapshots__/getting_started.test.tsx.snap index 9df3bb12caec..f2a26c2fa3b1 100644 --- a/src/plugins/opensearch_dashboards_overview/public/components/getting_started/__snapshots__/getting_started.test.tsx.snap +++ b/src/plugins/opensearch_dashboards_overview/public/components/getting_started/__snapshots__/getting_started.test.tsx.snap @@ -168,19 +168,6 @@ exports[`GettingStarted dark mode on 1`] = ` - - - - -
- - - - -
= ({ addBasePath, isDarkTheme, apps }) => - - - - - -
diff --git a/src/plugins/opensearch_dashboards_overview/public/components/overview/__snapshots__/overview.test.tsx.snap b/src/plugins/opensearch_dashboards_overview/public/components/overview/__snapshots__/overview.test.tsx.snap index 6d92c8759243..00f7723c3436 100644 --- a/src/plugins/opensearch_dashboards_overview/public/components/overview/__snapshots__/overview.test.tsx.snap +++ b/src/plugins/opensearch_dashboards_overview/public/components/overview/__snapshots__/overview.test.tsx.snap @@ -76,14 +76,14 @@ exports[`Overview renders with solutions and features 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -423,7 +423,7 @@ exports[`Overview renders with solutions and features 1`] = ` ], } } - path="/app/opensearch_dashboards_overview" + path="/app/home/" />
@@ -561,14 +561,14 @@ exports[`Overview renders with solutions and without features 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -964,7 +964,7 @@ exports[`Overview renders with solutions and without features 1`] = ` ], } } - path="/app/opensearch_dashboards_overview" + path="/app/home/" />
@@ -1046,14 +1046,14 @@ exports[`Overview renders without solutions and with features 1`] = ` "AnimatedMark": Object { "dark": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_dark.svg", + "url": "/ui/logos/spinner_on_dark.gif", }, "light": Object { "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "type": "default", - "url": "/ui/logos/opensearch_spinner_on_light.svg", + "url": "/ui/logos/spinner_on_light.gif", }, "Application": Object { "dark": Object { @@ -1200,75 +1200,6 @@ exports[`Overview renders without solutions and with features 1`] = ` - - -
diff --git a/src/plugins/opensearch_dashboards_overview/public/components/overview/overview.tsx b/src/plugins/opensearch_dashboards_overview/public/components/overview/overview.tsx index 30df4dbe8146..6cfcc7ec4f29 100644 --- a/src/plugins/opensearch_dashboards_overview/public/components/overview/overview.tsx +++ b/src/plugins/opensearch_dashboards_overview/public/components/overview/overview.tsx @@ -56,7 +56,6 @@ import { } from '../../../../../../src/plugins/home/public'; import { PLUGIN_ID, PLUGIN_PATH } from '../../../common'; import { AppPluginStartDependencies } from '../../types'; -import { AddData } from '../add_data'; import { GettingStarted } from '../getting_started'; import { ManageData } from '../manage_data'; import { NewsFeed } from '../news_feed'; @@ -264,10 +263,6 @@ export const Overview: FC = ({ newsFetchResult, solutions, features, logo : 'osdOverviewData--expanded' }`} > - - - - diff --git a/src/plugins/opensearch_dashboards_overview/public/plugin.ts b/src/plugins/opensearch_dashboards_overview/public/plugin.ts index e38282ff06d6..d8ac61c6d7e2 100644 --- a/src/plugins/opensearch_dashboards_overview/public/plugin.ts +++ b/src/plugins/opensearch_dashboards_overview/public/plugin.ts @@ -77,13 +77,13 @@ export class OpenSearchDashboardsOverviewPlugin return hasOpenSearchDashboardsApp; }), distinct(), - map((hasOpenSearchDashboardsApp) => { + map(() => { return () => { - if (!hasOpenSearchDashboardsApp) { - return { status: AppStatus.inaccessible, navLinkStatus: AppNavLinkStatus.hidden }; - } else { - return { status: AppStatus.accessible, navLinkStatus: AppNavLinkStatus.default }; - } + // Wazuh: Hide the OpenSearch Dashboards Overview app + return { + status: AppStatus.inaccessible, + navLinkStatus: AppNavLinkStatus.hidden, + }; }; }) ); diff --git a/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.test.tsx b/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.test.tsx index 2e27ebd0cb6b..11983e7b067d 100644 --- a/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.test.tsx +++ b/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.test.tsx @@ -121,8 +121,8 @@ describe('OverviewPageHeader ', () => { expect(head.length).toBe(1); expect(head.first().text()).toEqual(mockTitle); }); - - it('renders with the toolbar by default', () => { + // Skip test because it is not used in Wazuh dashboards + it.skip('renders with the toolbar by default', () => { const props = { ...mockProps(), }; @@ -141,8 +141,8 @@ describe('OverviewPageHeader ', () => { // Would contain only the "Add Data" button expect(component).toMatchSnapshot(); }); - - it('renders with the toolbar when it is explicitly asked not to be hidden', () => { + // Skip test because it is not used in Wazuh dashboards + it.skip('renders with the toolbar when it is explicitly asked not to be hidden', () => { const props = { ...mockProps(), hideToolbar: false, diff --git a/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.tsx b/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.tsx index a636f7ecdb7d..8208b851a8a1 100644 --- a/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.tsx +++ b/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.tsx @@ -111,24 +111,6 @@ export const OverviewPageHeader: FC = ({ {!hideToolbar && ( - - - - {i18n.translate( - 'opensearch-dashboards-react.osdOverviewPageHeader.addDataButtonLabel', - { - defaultMessage: 'Add data', - } - )} - - - - {showManagementLink && isManagementEnabled ? ( diff --git a/test/functional/apps/home/_sample_data.ts b/test/functional/apps/home/_sample_data.ts index 4c1cf4f69ce1..8a61b35bab45 100644 --- a/test/functional/apps/home/_sample_data.ts +++ b/test/functional/apps/home/_sample_data.ts @@ -42,7 +42,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const dashboardExpect = getService('dashboardExpect'); const PageObjects = getPageObjects(['common', 'header', 'home', 'dashboard', 'timePicker']); - describe('sample data', function describeIndexTests() { + /** + * This test suite is skipped because the seccion of the sample data set is not available in the UI. + */ + describe.skip('sample data', function describeIndexTests() { before(async () => { await security.testUser.setRoles([ 'opensearch_dashboards_admin', diff --git a/test/functional/apps/visualize/_custom_branding.ts b/test/functional/apps/visualize/_custom_branding.ts index 37f07e932ee5..9b161da01718 100644 --- a/test/functional/apps/visualize/_custom_branding.ts +++ b/test/functional/apps/visualize/_custom_branding.ts @@ -28,7 +28,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const expectedWelcomeMessage = 'Welcome to OpenSearch'; describe('OpenSearch Dashboards branding configuration', function customHomeBranding() { - describe('should render overview page', async () => { + /** + * This test is skipped because the overview page is not available. + */ + describe.skip('should render overview page', async () => { this.tags('includeFirefox'); before(async function () { @@ -81,7 +84,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); - it('with customized logo', async () => { + /** + * This test is omitted because the welcome page has been removed. + */ + it.skip('with customized logo', async () => { await testSubjects.existOrFail('welcomeCustomLogo'); const actualLabel = await testSubjects.getAttribute( 'welcomeCustomLogo', @@ -90,7 +96,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(actualLabel.toUpperCase()).to.equal(expectedMarkLogo.toUpperCase()); }); - it('with customized title', async () => { + it.skip('with customized title', async () => { await testSubjects.existOrFail('welcomeCustomTitle'); const actualLabel = await testSubjects.getAttribute( 'welcomeCustomTitle', @@ -99,7 +105,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(actualLabel.toUpperCase()).to.equal(expectedWelcomeMessage.toUpperCase()); }); - it('with customized logo in dark mode', async () => { + it.skip('with customized logo in dark mode', async () => { await PageObjects.common.navigateToApp('management/opensearch-dashboards/settings'); await PageObjects.settings.toggleAdvancedSettingCheckbox('theme:darkMode'); await PageObjects.common.navigateToApp('home');