Back to Wazuh

RTR

src/wazuh_modules/vulnerability_scanner/doc/rtr.md

4.14.415.2 KB
Original Source

RTR

This module, and its dependencies:

Are tested in the following wokflow.

In order to facilitate the code development, the workflow is prepared to be executed locally (see dependencies).

Dependencies

ACT

  1. Download the binary: wget -qO act.tar.gz https://github.com/nektos/act/releases/latest/download/act_Linux_x86_64.tar.gz

  2. Extract the binary into the system binaries folder: sudo tar xf act.tar.gz -C /usr/local/bin act

  3. Remove the unnecessary files: rm -rf act.tar.gz

  4. On the first execution, select the medium image

Usage

The following command will trigger the workflow and perform the exact same steps as the CI/CD pipeline:

Note: These commands must be executed from the root of the repository.

bash
# General usage
act -W <path_to_workflow> --artifact-server-path <artifacts_location> --env REF_BRANCH=<base_branch> (optional) -v (optional)

# Practical aplication
act -W .github/workflows/vulnerability-scanner-tests.yml --artifact-server-path /tmp/artifacts

Arguments

  • -W <path_to_workflow>: Path to the workflow to be executed.
  • -v: Enables the verbose mode. It's recommended to use it on the first run in order to see the progress of the docker images being pulled (it takes some time on the first run).
  • --env REF_BRANCH: The branch the changes are compared against. If not provided, the comparison is against the master branch.
  • --artifact-server-path: Path where the artifacts will be stored. This path must be accessible by the user running the workflow.
    • Note: Artifacts are compressed in a weird way (the extension of the generated files is gz__). In order to extract them, the following commands must be executed:
    bash
    find <path to the artifacts> -type f -name "*.gz__" | while read file; do mv "$file" "${file%.gz__}.gz"; done
    find <path to the artifacts> -type f -name "*.gz" -exec gunzip {} -f +
    

Examples

Failed job

<details> <summary>Last log lines</summary>
bash
| ---------------------------------
| FAILED: Clang-format check failed
| ---------------------------------
[Vulnerability Scanner/style-and-documentation]   ❌  Failure - Main Check Coding style
[Vulnerability Scanner/style-and-documentation] exitcode '1': failure
[Vulnerability Scanner/style-and-documentation]   ☁  git clone 'https://github.com/actions/upload-artifact' # ref=v3
[Vulnerability Scanner/style-and-documentation] ⭐ Run Main actions/upload-artifact@v4
[Vulnerability Scanner/style-and-documentation]   🐳  docker cp src=/home/damangold/.cache/act/actions-upload-artifact@v4/ dst=/var/run/act/actions/actions-upload-artifact@v4/
[Vulnerability Scanner/style-and-documentation]   🐳  docker exec cmd=[node /var/run/act/actions/actions-upload-artifact@v4/dist/index.js] user= workdir=
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::followSymbolicLinks 'true'
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::implicitDescendants 'true'
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::omitBrokenSymbolicLinks 'true'
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::followSymbolicLinks 'true'
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::implicitDescendants 'true'
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::matchDirectories 'true'
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::omitBrokenSymbolicLinks 'true'
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::Search path '/home/damangold/Wazuh/dev/wazuh/src/shared_modules/content_manager/clang_format_errors.txt'
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::File:/home/damangold/Wazuh/dev/wazuh/src/shared_modules/content_manager/clang_format_errors.txt was found using the provided searchPath
| With the provided path, there will be 1 file uploaded
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::Root artifact directory is /home/damangold/Wazuh/dev/wazuh/src/shared_modules/content_manager
| Starting artifact upload
| For more detailed logs during the artifact upload process, enable step-debugging: https://docs.github.com/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging#enabling-step-debug-logging
| Artifact name is valid!
[Vulnerability Scanner/style-and-documentation]   🚧  ::warning::Retention days is greater than the max value allowed by the repository setting, reduce retention to 0 days
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::Artifact Url: http://192.168.100.233:34567/_apis/pipelines/workflows/1/artifacts?api-version=6.0-preview
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::Upload Resource URL: http://192.168.100.233:34567/upload/1
| Container for artifact "Clang-format errors - content_manager" successfully created. Starting upload of file(s)
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::File Concurrency: 2, and Chunk Size: 8388608
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::/home/damangold/Wazuh/dev/wazuh/src/shared_modules/content_manager/clang_format_errors.txt is less than 64k in size. Creating a gzip file in-memory to potentially reduce the upload size
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::A gzip file created for /home/damangold/Wazuh/dev/wazuh/src/shared_modules/content_manager/clang_format_errors.txt helped with reducing the size of the original file. The file will be uploaded using gzip.
| Total size of all the files uploaded is 233 bytes
| File upload process has finished. Finalizing the artifact upload
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::Artifact Url: http://192.168.100.233:34567/_apis/pipelines/workflows/1/artifacts?api-version=6.0-preview
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::URL is http://192.168.100.233:34567/_apis/pipelines/workflows/1/artifacts?api-version=6.0-preview&artifactName=Clang-format+errors+-+content_manager
[Vulnerability Scanner/style-and-documentation]   💬  ::debug::Artifact Clang-format errors - content_manager has been successfully uploaded, total size in bytes: 994
| Artifact has been finalized. All files have been successfully uploaded!
| 
| The raw size of all the files that were specified for upload is 994 bytes
| The size of all the files that were uploaded is 233 bytes. This takes into account any gzip compression used to reduce the upload size, time and storage
| 
| Note: The size of downloaded zips can differ significantly from the reported size. For more information see: https://github.com/actions/upload-artifact#zipped-artifact-downloads 
| 
| Artifact Clang-format errors - content_manager has been successfully uploaded!
[Vulnerability Scanner/style-and-documentation]   ✅  Success - Main actions/upload-artifact@v4
[Vulnerability Scanner/style-and-documentation]   ❌  Failure - Main Content manager - Coding style
[Vulnerability Scanner/style-and-documentation] exitcode '1': failure
[Vulnerability Scanner/style-and-documentation] ⭐ Run Post Content manager - Coding style
[Vulnerability Scanner/style-and-documentation] ⭐ Run Post Install dependencies
[Vulnerability Scanner/style-and-documentation]   🐳  docker cp src=/home/damangold/.cache/act/awalsh128-cache-apt-pkgs-action@latest/ dst=/var/run/act/actions/awalsh128-cache-apt-pkgs-action@latest/
[Vulnerability Scanner/style-and-documentation]   ✅  Success - Post Install dependencies
[Vulnerability Scanner/style-and-documentation]   ✅  Success - Post Content manager - Coding style
[Vulnerability Scanner/style-and-documentation] 🏁  Job failed
Error: Job 'style-and-documentation' failed
</details> <details> <summary>How to detect a failed run</summary>
bash
[Vulnerability Scanner/style-and-documentation] 🏁  Job failed
Error: Job 'style-and-documentation' failed
</details>

Successful job

<details> <summary>Last log lines</summary>
bash
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Main Validate coverage
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Main Vulnerability scanner - Coverage
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Vulnerability scanner - Coverage
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   🐳  docker cp src=/home/vagrant/.cache/act/awalsh128-cache-apt-pkgs-action@latest/ dst=/var/run/act/actions/awalsh128-cache-apt-pkgs-action@latest/
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Vulnerability scanner - Coverage
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Vulnerability scanner - Compilation and test
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   🐳  docker cp src=/home/vagrant/.cache/act/awalsh128-cache-apt-pkgs-action@latest/ dst=/var/run/act/actions/awalsh128-cache-apt-pkgs-action@latest/
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   🐳  docker cp src=/home/vagrant/.cache/act/awalsh128-cache-apt-pkgs-action@latest/ dst=/var/run/act/actions/awalsh128-cache-apt-pkgs-action@latest/
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Vulnerability scanner - Compilation and test
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Content manager - Coverage
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   🐳  docker cp src=/home/vagrant/.cache/act/awalsh128-cache-apt-pkgs-action@latest/ dst=/var/run/act/actions/awalsh128-cache-apt-pkgs-action@latest/
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Content manager - Coverage
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Content manager - Compilation and test
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   🐳  docker cp src=/home/vagrant/.cache/act/awalsh128-cache-apt-pkgs-action@latest/ dst=/var/run/act/actions/awalsh128-cache-apt-pkgs-action@latest/
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   🐳  docker cp src=/home/vagrant/.cache/act/awalsh128-cache-apt-pkgs-action@latest/ dst=/var/run/act/actions/awalsh128-cache-apt-pkgs-action@latest/
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Content manager - Compilation and test
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Indexer connector - Coverage
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   🐳  docker cp src=/home/vagrant/.cache/act/awalsh128-cache-apt-pkgs-action@latest/ dst=/var/run/act/actions/awalsh128-cache-apt-pkgs-action@latest/
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Indexer connector - Coverage
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Indexer connector - Compilation and test
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   🐳  docker cp src=/home/vagrant/.cache/act/awalsh128-cache-apt-pkgs-action@latest/ dst=/var/run/act/actions/awalsh128-cache-apt-pkgs-action@latest/
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   🐳  docker cp src=/home/vagrant/.cache/act/awalsh128-cache-apt-pkgs-action@latest/ dst=/var/run/act/actions/awalsh128-cache-apt-pkgs-action@latest/
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Indexer connector - Compilation and test
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Router - Coverage
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   🐳  docker cp src=/home/vagrant/.cache/act/awalsh128-cache-apt-pkgs-action@latest/ dst=/var/run/act/actions/awalsh128-cache-apt-pkgs-action@latest/
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Router - Coverage
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Router - Compilation and test
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   🐳  docker cp src=/home/vagrant/.cache/act/awalsh128-cache-apt-pkgs-action@latest/ dst=/var/run/act/actions/awalsh128-cache-apt-pkgs-action@latest/
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   🐳  docker cp src=/home/vagrant/.cache/act/awalsh128-cache-apt-pkgs-action@latest/ dst=/var/run/act/actions/awalsh128-cache-apt-pkgs-action@latest/
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Install dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Router - Compilation and test
[Vulnerability Scanner/vulnerability-scanner-modules     ] ⭐ Run Post Project dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ]   ✅  Success - Post Project dependencies
[Vulnerability Scanner/vulnerability-scanner-modules     ] 🏁  Job succeeded
</details> <details> <summary>How to detect a failed run</summary>
bash
[Vulnerability Scanner/vulnerability-scanner-modules     ] 🏁  Job succeeded
</details>