From 9387e1ba4c125058ba4959672ba8e373bbcd8c78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Thu, 4 Aug 2022 12:24:27 +0200 Subject: [PATCH 1/4] Review Wazuh.yml documentation Remove unused settings. Centralize documentation. Add missing settings. Programatic file generation. --- common/constants.ts | 1 + public/services/resolves/get-config.js | 65 +---- public/utils/config-equivalences.js | 39 +-- server/lib/initial-wazuh-config.ts | 373 ++++++++++++++----------- 4 files changed, 237 insertions(+), 241 deletions(-) diff --git a/common/constants.ts b/common/constants.ts index b50e585e94..160bae8d3d 100644 --- a/common/constants.ts +++ b/common/constants.ts @@ -224,6 +224,7 @@ export const WAZUH_DEFAULT_APP_CONFIG = { hideManagerAlerts: false, 'logs.level': 'info', 'enrollment.dns': '', + 'enrollment.password': '', 'customization.logo.app': '', 'customization.logo.sidebar': '', 'customization.logo.healthcheck':'', diff --git a/public/services/resolves/get-config.js b/public/services/resolves/get-config.js index 6eeebb287d..d39b304a5d 100644 --- a/public/services/resolves/get-config.js +++ b/public/services/resolves/get-config.js @@ -10,71 +10,10 @@ * Find more information about this on the LICENSE file. */ -import { - WAZUH_ALERTS_PATTERN, - WAZUH_MONITORING_DEFAULT_INDICES_SHARDS, - WAZUH_MONITORING_DEFAULT_INDICES_REPLICAS, - WAZUH_MONITORING_PATTERN, - WAZUH_SAMPLE_ALERT_PREFIX, - WAZUH_STATISTICS_DEFAULT_INDICES_SHARDS, - WAZUH_STATISTICS_DEFAULT_INDICES_REPLICAS, -} from "../../../common/constants"; +import { WAZUH_DEFAULT_APP_CONFIG } from '../../../common/constants'; export async function getWzConfig($q, genericReq, wazuhConfig) { - // Remember to keep this values equal to default wazuh.yml values - const defaultConfig = { - pattern: WAZUH_ALERTS_PATTERN, - 'checks.pattern': true, - 'checks.template': true, - 'checks.api': true, - 'checks.setup': true, - 'checks.fields': true, - 'checks.metaFields': true, - 'checks.timeFilter': true, - 'checks.maxBuckets': true, - 'extensions.pci': true, - 'extensions.gdpr': true, - 'extensions.hipaa': true, - 'extensions.nist': true, - 'extensions.tsc': true, - 'extensions.audit': true, - 'extensions.oscap': false, - 'extensions.ciscat': false, - 'extensions.aws': false, - 'extensions.gcp': false, - 'extensions.virustotal': false, - 'extensions.osquery': false, - 'extensions.docker': false, - 'extensions.office': false, - 'extensions.github': false, - timeout: 20000, - 'ip.selector': true, - 'ip.ignore': [], - 'xpack.rbac.enabled': true, - 'wazuh.monitoring.enabled': true, - 'wazuh.monitoring.frequency': 900, - 'wazuh.monitoring.shards': WAZUH_MONITORING_DEFAULT_INDICES_SHARDS, - 'wazuh.monitoring.replicas': WAZUH_MONITORING_DEFAULT_INDICES_REPLICAS, - 'wazuh.monitoring.creation': 'w', - 'wazuh.monitoring.pattern': WAZUH_MONITORING_PATTERN, - 'cron.prefix': 'wazuh', - 'cron.statistics.status': true, - 'cron.statistics.apis': [], - 'cron.statistics.interval': '0 */5 * * * *', - 'cron.statistics.index.name': 'statistics', - 'cron.statistics.index.creation': 'w', - 'cron.statistics.index.shards': WAZUH_STATISTICS_DEFAULT_INDICES_SHARDS, - 'cron.statistics.index.replicas': WAZUH_STATISTICS_DEFAULT_INDICES_REPLICAS, - 'alerts.sample.prefix': WAZUH_SAMPLE_ALERT_PREFIX, - hideManagerAlerts: false, - 'logs.level': 'info', - 'enrollment.dns': '', - 'enrollment.password': '', - 'customization.logo.app':'', - 'customization.logo.sidebar':'', - 'customization.logo.healthcheck':'', - 'customization.logo.reports':'' - }; + const defaultConfig = WAZUH_DEFAULT_APP_CONFIG; try { const config = await genericReq.request('GET', '/utils/configuration', {}); diff --git a/public/utils/config-equivalences.js b/public/utils/config-equivalences.js index 34d066ae2d..b2044e89db 100644 --- a/public/utils/config-equivalences.js +++ b/public/utils/config-equivalences.js @@ -1,11 +1,11 @@ import { ASSETS_PUBLIC_URL, PLUGIN_PLATFORM_NAME } from "../../common/constants"; export const configEquivalences = { - pattern: 'Default index pattern to use on the app.', - 'customization.logo.app':`Define the name of the app logo saved in the path ${ASSETS_PUBLIC_URL}`, - 'customization.logo.sidebar':`Define the name of the sidebar logo saved in the path ${ASSETS_PUBLIC_URL}`, - 'customization.logo.healthcheck':`Define the name of the health-check logo saved in the path ${ASSETS_PUBLIC_URL}`, - 'customization.logo.reports':`Define the name of the reports logo (.png) saved in the path ${ASSETS_PUBLIC_URL}`, + pattern: "Default index pattern to use on the app. If there's no valid index pattern, the app will automatically create one with the name indicated in this option.", + 'customization.logo.app':`Set the name of the app logo stored at ${ASSETS_PUBLIC_URL}`, + 'customization.logo.sidebar':`Set the name of the sidebar logo stored at ${ASSETS_PUBLIC_URL}`, + 'customization.logo.healthcheck':`Set the name of the health-check logo stored at ${ASSETS_PUBLIC_URL}`, + 'customization.logo.reports':`Set the name of the reports logo (.png) stored at ${ASSETS_PUBLIC_URL}`, 'checks.pattern': 'Enable or disable the index pattern health check when opening the app.', 'checks.template': @@ -23,6 +23,9 @@ export const configEquivalences = { `Change the default value of the ${PLUGIN_PLATFORM_NAME} max buckets configuration`, 'extensions.pci': 'Enable or disable the PCI DSS tab on Overview and Agents.', 'extensions.gdpr': 'Enable or disable the GDPR tab on Overview and Agents.', + 'extensions.hipaa': 'Enable or disable the HIPAA tab on Overview and Agents.', + 'extensions.nist': 'Enable or disable the NIST 800-53 tab on Overview and Agents.', + 'extensions.tsc': 'Enable or disable the TSC tab on Overview and Agents.', 'extensions.audit': 'Enable or disable the Audit tab on Overview and Agents.', 'extensions.oscap': 'Enable or disable the Open SCAP tab on Overview and Agents.', @@ -38,41 +41,43 @@ export const configEquivalences = { 'extensions.docker': 'Enable or disable the Docker listener tab on Overview and Agents.', timeout: - 'Defines the maximum time the app will wait for an API response when making requests to it.', + 'Maximum time, in milliseconds, the app will wait for an API response when making requests to it. It will be ignored if the value is set under 1500 milliseconds.', 'ip.selector': - 'Defines if the user is allowed to change the selected index pattern directly from the top menu bar.', + 'Define if the user is allowed to change the selected index pattern directly from the top menu bar.', 'ip.ignore': 'Disable certain index pattern names from being available in index pattern selector from the Wazuh app.', 'wazuh.monitoring.enabled': 'Enable or disable the wazuh-monitoring index creation and/or visualization.', 'wazuh.monitoring.frequency': - 'Define in seconds the frequency the app generates a new document on the wazuh-monitoring index.', + 'Frequency, in seconds, of API requests to get the state of the agents and create a new document in the wazuh-monitoring index with this data.', 'wazuh.monitoring.shards': 'Define the number of shards to use for the wazuh-monitoring-* indices.', 'wazuh.monitoring.replicas': 'Define the number of replicas to use for the wazuh-monitoring-* indices.', 'wazuh.monitoring.creation': - 'Define the interval in which the wazuh-monitoring index will be created.', + 'Define the interval in which a new wazuh-monitoring index will be created.', 'wazuh.monitoring.pattern': - 'Default index pattern to use on the app for Wazuh monitoring.', + 'Default index pattern to use for Wazuh monitoring.', hideManagerAlerts: - 'Hide the alerts of the manager in all dashboards.', + 'Hide the alerts of the manager in every dashboard.', 'logs.level': - 'Set the app logging level, allowed values are info and debug. Default is info.', + 'Logging level of the App.', 'enrollment.dns': - 'Set the Wazuh server address in the agent deployment.', + 'Specifies the Wazuh registration server, used for the agent enrollment.', + 'enrollment.password': + 'Specifies the password used to authenticate during the agent enrollment.', 'cron.prefix': 'Define the index prefix of predefined jobs.', 'cron.statistics.status': 'Enable or disable the statistics tasks.', 'cron.statistics.apis': - 'Enter the ID of the APIs you want to save data from, leave this empty to run the task on all configured APIs.', + 'Enter the ID of the hosts you want to save data from, leave this empty to run the task on every host.', 'cron.statistics.interval': 'Define the frequency of task execution using cron schedule expressions.', - 'cron.statistics.index.name': 'Define the name of the index in which the documents are to be saved.', - 'cron.statistics.index.creation': 'Define the interval in which the index will be created.', + 'cron.statistics.index.name': 'Define the name of the index in which the documents will be saved.', + 'cron.statistics.index.creation': 'Define the interval in which a new index will be created.', 'cron.statistics.index.shards': 'Define the number of shards to use for the statistics indices.', 'cron.statistics.index.replicas': 'Define the number of replicas to use for the statistics indices.', - 'alerts.sample.prefix': 'Define the index name prefix of sample alerts. It must match with the template used by the index pattern to avoid unknown fields in dashboards.', + 'alerts.sample.prefix': 'Define the index name prefix of sample alerts. It must match the template used by the index pattern to avoid unknown fields in dashboards.', }; export const nameEquivalence = { diff --git a/server/lib/initial-wazuh-config.ts b/server/lib/initial-wazuh-config.ts index 15d482ef2f..66957291fb 100644 --- a/server/lib/initial-wazuh-config.ts +++ b/server/lib/initial-wazuh-config.ts @@ -1,5 +1,5 @@ /* - * Wazuh app - Initial basic configuration file + * Wazuh app - App configuration file * Copyright (C) 2015-2022 Wazuh, Inc. * * This program is free software; you can redistribute it and/or modify @@ -10,8 +10,44 @@ * Find more information about this on the LICENSE file. */ -import { ASSETS_PUBLIC_URL, WAZUH_MONITORING_DEFAULT_INDICES_REPLICAS, WAZUH_MONITORING_DEFAULT_INDICES_SHARDS, WAZUH_STATISTICS_DEFAULT_INDICES_REPLICAS, WAZUH_STATISTICS_DEFAULT_INDICES_SHARDS } from "../../common/constants"; -import { webDocumentationLink } from "../../common/services/web_documentation"; +import { + WAZUH_ALERTS_PATTERN, + WAZUH_DEFAULT_APP_CONFIG, + WAZUH_MONITORING_DEFAULT_CREATION, + WAZUH_MONITORING_DEFAULT_ENABLED, + WAZUH_MONITORING_DEFAULT_FREQUENCY, + WAZUH_MONITORING_DEFAULT_INDICES_REPLICAS, + WAZUH_MONITORING_DEFAULT_INDICES_SHARDS, + WAZUH_MONITORING_PATTERN, + WAZUH_SAMPLE_ALERT_PREFIX, + WAZUH_STATISTICS_DEFAULT_CREATION, + WAZUH_STATISTICS_DEFAULT_CRON_FREQ, + WAZUH_STATISTICS_DEFAULT_INDICES_REPLICAS, + WAZUH_STATISTICS_DEFAULT_INDICES_SHARDS, + WAZUH_STATISTICS_DEFAULT_NAME, + WAZUH_STATISTICS_DEFAULT_PREFIX, + WAZUH_STATISTICS_DEFAULT_STATUS, +} from '../../common/constants'; +import { webDocumentationLink } from '../../common/services/web_documentation'; +import { configEquivalences } from '../../public/utils/config-equivalences'; + +/** + * Given a string, this function builds a multine string, each line about 70 + * characters long, splitted at the closest whitespace character to that lentgh. + * + * This function is used to transform the settings description stored in the + * configEquivalences map into a multiline string to be used as the setting + * documentation. + * + * The # character is also appended to the beginning of each line. + * + * @param text + * @returns multine string + */ +function splitDescription(text: string = ''): string { + const lines = text.match(/.{1,80}(?=\s|$)/g) || []; + return lines.map((z) => '# ' + z.trim()).join('\n'); +} export const initialWazuhConfig: string = `--- # @@ -27,211 +63,226 @@ export const initialWazuhConfig: string = `--- # # ======================== Wazuh app configuration file ======================== # -# Please check the documentation for more information on configuration options: -# ${webDocumentationLink('installation-guide/index.html')} +# Please check the documentation for more information about configuration options: +# ${webDocumentationLink('user-manual/wazuh-dashboard/config-file.html')} # # Also, you can check our repository: # https://github.com/wazuh/wazuh-kibana-app # -# ------------------------------- Disable roles ------------------------------- +# ---------------------------- Unauthorized roles ------------------------------ # -# Defines which Elasticsearch roles disable Wazuh -# disabled_roles: -# - wazuh_disabled +# Disable Wazuh for the Elasticsearch / OpenSearch roles defined here. +# disabled_roles: +# - wazuh_disabled # # ------------------------------- Index patterns ------------------------------- # -# Default index pattern to use. -#pattern: wazuh-alerts-* +${splitDescription(configEquivalences.pattern)} +# pattern: ${WAZUH_ALERTS_PATTERN} # # ----------------------------------- Checks ----------------------------------- # -# Defines which checks must to be consider by the healthcheck -# step once the Wazuh app starts. Values must to be true or false. -#checks.pattern : true -#checks.template: true -#checks.fields : true -#checks.api : true -#checks.setup : true -#checks.metaFields: true -#checks.timeFilter: true -#checks.maxBuckets: true +# Define which checks will be executed by the App's HealthCheck. +# Allowed values are: true, false +# +${splitDescription(configEquivalences['checks.pattern'])} +# checks.pattern: ${WAZUH_DEFAULT_APP_CONFIG['checks.pattern']} +# +${splitDescription(configEquivalences['checks.template'])} +# checks.template: ${WAZUH_DEFAULT_APP_CONFIG['checks.template']} +# +${splitDescription(configEquivalences['checks.api'])} +# checks.api: ${WAZUH_DEFAULT_APP_CONFIG['checks.api']} +# +${splitDescription(configEquivalences['checks.setup'])} +# checks.setup: ${WAZUH_DEFAULT_APP_CONFIG['checks.setup']} +# +${splitDescription(configEquivalences['checks.fields'])} +# checks.fields: ${WAZUH_DEFAULT_APP_CONFIG['checks.fields']} +# +${splitDescription(configEquivalences['checks.metaFields'])} +# checks.metaFields: ${WAZUH_DEFAULT_APP_CONFIG['checks.metaFields']} +# +${splitDescription(configEquivalences['checks.timeFilter'])} +# checks.timeFilter: ${WAZUH_DEFAULT_APP_CONFIG['checks.timeFilter']} +# +${splitDescription(configEquivalences['checks.maxBuckets'])} +# checks.maxBuckets: ${WAZUH_DEFAULT_APP_CONFIG['checks.maxBuckets']} # # --------------------------------- Extensions --------------------------------- # -# Defines which extensions should be activated when you add a new API entry. -# You can change them after Wazuh app starts. -# Values must to be true or false. -#extensions.pci : true -#extensions.gdpr : true -#extensions.hipaa : true -#extensions.nist : true -#extensions.tsc : true -#extensions.audit : true -#extensions.oscap : false -#extensions.ciscat : false -#extensions.aws : false -#extensions.gcp : false -#extensions.virustotal: false -#extensions.osquery : false -#extensions.docker : false -# -# ---------------------------------- Timeout ---------------------------------- -# -# Defines maximum timeout to be used on the Wazuh app requests. -# It will be ignored if it is bellow 1500. -# It means milliseconds before we consider a request as failed. -# Default: 20000 -#timeout: 20000 -# -# -------------------------------- API selector -------------------------------- -# -# Defines if the user is allowed to change the selected -# API directly from the Wazuh app top menu. -# Default: true -#api.selector: true +# Define the initial state of the extensions (enabled / disabled) for recently +# added hosts. The extensions can be enabled or disabled anytime using the UI. +# Allowed values are: true, false +# +${splitDescription(configEquivalences['extensions.pci'])} +# extensions.pci: ${WAZUH_DEFAULT_APP_CONFIG['extensions.pci']} +# +${splitDescription(configEquivalences['extensions.gdpr'])} +# extensions.gdpr: ${WAZUH_DEFAULT_APP_CONFIG['extensions.gdpr']} +# +${splitDescription(configEquivalences['extensions.hipaa'])} +# extensions.hipaa: ${WAZUH_DEFAULT_APP_CONFIG['extensions.hipaa']} +# +${splitDescription(configEquivalences['extensions.nist'])} +# extensions.nist: ${WAZUH_DEFAULT_APP_CONFIG['extensions.nist']} +# +${splitDescription(configEquivalences['extensions.tsc'])} +# extensions.tsc: ${WAZUH_DEFAULT_APP_CONFIG['extensions.tsc']} +# +${splitDescription(configEquivalences['extensions.audit'])} +# extensions.audit: ${WAZUH_DEFAULT_APP_CONFIG['extensions.audit']} +# +${splitDescription(configEquivalences['extensions.oscap'])} +# extensions.oscap: ${WAZUH_DEFAULT_APP_CONFIG['extensions.oscap']} +# +${splitDescription(configEquivalences['extensions.ciscat'])} +# extensions.ciscat: ${WAZUH_DEFAULT_APP_CONFIG['extensions.ciscat']} +# +${splitDescription(configEquivalences['extensions.aws'])} +# extensions.aws: ${WAZUH_DEFAULT_APP_CONFIG['extensions.aws']} +# +${splitDescription(configEquivalences['extensions.gcp'])} +# extensions.gcp: ${WAZUH_DEFAULT_APP_CONFIG['extensions.gcp']} +# +${splitDescription(configEquivalences['extensions.virustotal'])} +# extensions.virustotal: ${WAZUH_DEFAULT_APP_CONFIG['extensions.virustotal']} +# +${splitDescription(configEquivalences['extensions.osquery'])} +# extensions.osquery: ${WAZUH_DEFAULT_APP_CONFIG['extensions.osquery']} +# +${splitDescription(configEquivalences['extensions.docker'])} +# extensions.docker: ${WAZUH_DEFAULT_APP_CONFIG['extensions.docker']} +# +# ------------------------------- Timeout -------------------------------------- +# +${splitDescription(configEquivalences.timeout)} +# timeout: ${WAZUH_DEFAULT_APP_CONFIG.timeout} # # --------------------------- Index pattern selector --------------------------- # -# Defines if the user is allowed to change the selected -# index pattern directly from the Wazuh app top menu. -# Default: true -#ip.selector: true +${splitDescription(configEquivalences['ip.selector'])} +# ip.selector: ${WAZUH_DEFAULT_APP_CONFIG['ip.selector']} # -# List of index patterns to be ignored -#ip.ignore: [] +${splitDescription(configEquivalences['ip.ignore'])} +# ip.ignore: ${WAZUH_DEFAULT_APP_CONFIG['ip.ignore']} # -# -------------------------------- X-Pack RBAC --------------------------------- +# ------------------------------ Monitoring ------------------------------------ # -# Custom setting to enable/disable built-in X-Pack RBAC security capabilities. -# Default: enabled -#xpack.rbac.enabled: true +${splitDescription(configEquivalences['wazuh.monitoring.enabled'])} +# wazuh.monitoring.enabled: ${WAZUH_MONITORING_DEFAULT_ENABLED} # -# ------------------------------ wazuh-monitoring ------------------------------ +${splitDescription(configEquivalences['wazuh.monitoring.frequency'])} +# wazuh.monitoring.frequency: ${WAZUH_MONITORING_DEFAULT_FREQUENCY} # -# Custom setting to enable/disable wazuh-monitoring indices. -# Values: true, false, worker -# If worker is given as value, the app will show the Agents status -# visualization but won't insert data on wazuh-monitoring indices. -# Default: true -#wazuh.monitoring.enabled: true +${splitDescription(configEquivalences['wazuh.monitoring.shards'])} +# wazuh.monitoring.shards: ${WAZUH_MONITORING_DEFAULT_INDICES_SHARDS} # -# Custom setting to set the frequency for wazuh-monitoring indices cron task. -# Default: 900 (s) -#wazuh.monitoring.frequency: 900 +${splitDescription(configEquivalences['wazuh.monitoring.replicas'])} +# wazuh.monitoring.replicas: ${WAZUH_MONITORING_DEFAULT_INDICES_REPLICAS} # -# Configure wazuh-monitoring-* indices shards and replicas. -#wazuh.monitoring.shards: ${WAZUH_MONITORING_DEFAULT_INDICES_SHARDS} -#wazuh.monitoring.replicas: ${WAZUH_MONITORING_DEFAULT_INDICES_REPLICAS} +${splitDescription(configEquivalences['wazuh.monitoring.creation'])} +# Allowed values are: h (hourly), d (daily), w (weekly), m (monthly) +# wazuh.monitoring.creation: ${WAZUH_MONITORING_DEFAULT_CREATION} # -# Configure wazuh-monitoring-* indices custom creation interval. -# Values: h (hourly), d (daily), w (weekly), m (monthly) -# Default: w -#wazuh.monitoring.creation: w +${splitDescription(configEquivalences['wazuh.monitoring.pattern'])} +# wazuh.monitoring.pattern: ${WAZUH_MONITORING_PATTERN} # -# Default index pattern to use for Wazuh monitoring -#wazuh.monitoring.pattern: wazuh-monitoring-* +# --------------------------------- Sample data -------------------------------- # -# --------------------------------- wazuh-cron ---------------------------------- +${splitDescription(configEquivalences['alerts.sample.prefix'])} +# alerts.sample.prefix: ${WAZUH_SAMPLE_ALERT_PREFIX} # -# Customize the index prefix of predefined jobs -# This change is not retroactive, if you change it new indexes will be created -# cron.prefix: wazuh +# ------------------------------ Background tasks ------------------------------ # -# --------------------------------- wazuh-sample-alerts ------------------------- +${splitDescription(configEquivalences['cron.prefix'])} +# cron.prefix: ${WAZUH_STATISTICS_DEFAULT_PREFIX} # -# Customize the index name prefix of sample alerts -# This change is not retroactive, if you change it new indexes will be created -# It should match with a valid index template to avoid unknown fields on -# dashboards -#alerts.sample.prefix: wazuh-alerts-4.x- +# ------------------------------ Wazuh Statistics ------------------------------ # -# ------------------------------ wazuh-statistics ------------------------------- +${splitDescription(configEquivalences['cron.statistics.status'])} +# cron.statistics.status: ${WAZUH_STATISTICS_DEFAULT_STATUS} # -# Custom setting to enable/disable statistics tasks. -#cron.statistics.status: true +${splitDescription(configEquivalences['cron.statistics.apis'])} +# cron.statistics.apis: ${WAZUH_DEFAULT_APP_CONFIG['cron.statistics.apis']} # -# Enter the ID of the APIs you want to save data from, leave this empty to run -# the task on all configured APIs -#cron.statistics.apis: [] +${splitDescription(configEquivalences['cron.statistics.interval'])} +# cron.statistics.interval: ${WAZUH_STATISTICS_DEFAULT_CRON_FREQ} # -# Define the frequency of task execution using cron schedule expressions -#cron.statistics.interval: 0 */5 * * * * +${splitDescription(configEquivalences['cron.statistics.index.name'])} +# cron.statistics.index.name: ${WAZUH_STATISTICS_DEFAULT_NAME} # -# Define the name of the index in which the documents are to be saved. -#cron.statistics.index.name: statistics +${splitDescription(configEquivalences['cron.statistics.index.creation'])} +# cron.statistics.index.creation: ${WAZUH_STATISTICS_DEFAULT_CREATION} # -# Define the interval in which the index will be created -#cron.statistics.index.creation: w +${splitDescription(configEquivalences['cron.statistics.index.shards'])} +# cron.statistics.shards: ${WAZUH_STATISTICS_DEFAULT_INDICES_SHARDS} # -# Configure statistics indices shards and replicas. -#cron.statistics.shards: ${WAZUH_STATISTICS_DEFAULT_INDICES_SHARDS} -#cron.statistics.replicas: ${WAZUH_STATISTICS_DEFAULT_INDICES_REPLICAS} +${splitDescription(configEquivalences['cron.statistics.index.replicas'])} +# cron.statistics.replicas: ${WAZUH_STATISTICS_DEFAULT_INDICES_REPLICAS} # -# ------------------------------ wazuh-logo-customization ------------------------------- +# ------------------------------ Logo customization ---------------------------- # -#Define the name of the app logo saved in the path ${ASSETS_PUBLIC_URL} -#customization.logo.app: '' +${splitDescription(configEquivalences['customization.logo.app'])} +# customization.logo.app: ${WAZUH_DEFAULT_APP_CONFIG['customization.logo.app']} # -#Define the name of the sidebar logo saved in the path ${ASSETS_PUBLIC_URL} -#customization.logo.sidebar: '' +${splitDescription(configEquivalences['customization.logo.sidebar'])} +# customization.logo.sidebar: ${WAZUH_DEFAULT_APP_CONFIG['customization.logo.sidebar']} # -#Define the name of the health-check logo saved in the path ${ASSETS_PUBLIC_URL} -#customization.logo.healthcheck: '' +${splitDescription(configEquivalences['customization.logo.healthcheck'])} +# customization.logo.healthcheck: ${WAZUH_DEFAULT_APP_CONFIG['customization.logo.healthcheck']} # -#Define the name of the reports logo (.png) saved in the path ${ASSETS_PUBLIC_URL} -#customization.logo.reports: '' +${splitDescription(configEquivalences['customization.logo.reports'])} +# customization.logo.reports: ${WAZUH_DEFAULT_APP_CONFIG['customization.logo.reports']} # -# ---------------------------- Hide manager alerts ------------------------------ -# Hide the alerts of the manager in all dashboards and discover -#hideManagerAlerts: false +# ---------------------------- Hide manager alerts ----------------------------- # -# ------------------------------- App logging level ----------------------------- -# Set the logging level for the Wazuh App log files. -# Default value: info -# Allowed values: info, debug -#logs.level: info +${splitDescription(configEquivalences.hideManagerAlerts)} +# hideManagerAlerts: ${WAZUH_DEFAULT_APP_CONFIG.hideManagerAlerts} # -# -------------------------------- Enrollment DNS ------------------------------- -# Set the variable WAZUH_REGISTRATION_SERVER in agents deployment. -# Default value: '' -#enrollment.dns: '' +# ------------------------------- App logging level ---------------------------- # -# Wazuh registration password -# Default value: '' -#enrollment.password: '' -#-------------------------------- API entries ----------------------------------- -#The following configuration is the default structure to define an API entry. +${splitDescription(configEquivalences['logs.level'])} +# Allowed values are: info, debug +# logs.level: ${WAZUH_DEFAULT_APP_CONFIG['logs.level']} # -#hosts: -# - : - # URL - # API url - # url: http(s):// - - # Port - # API port - # port: - - # Username - # API user's username - # username: - - # Password - # API user's password - # password: +# ------------------------------- Agent enrollment ----------------------------- +# +${splitDescription(configEquivalences['enrollment.dns'])} +# enrollment.dns: ${WAZUH_DEFAULT_APP_CONFIG['enrollment.dns']} +# +${splitDescription(configEquivalences['enrollment.password'])} +# enrollment.password: ${WAZUH_DEFAULT_APP_CONFIG['enrollment.password']} +# +#-------------------------------- Wazuh hosts ---------------------------------- +# +# The following configuration is the default structure to define a host. +# +# hosts: +# # Host ID / name, +# - env-1: +# # Host URL +# url: https://env-1.example +# # Host / API port +# port: 55000 +# # Host / API username +# username: wazuh-wui +# # Host / API password +# password: wazuh-wui +# # Use RBAC or not. If set to true, the username must be "wazuh-wui". +# run_as: true +# - env-2: +# url: https://env-2.example +# port: 55000 +# username: wazuh-wui +# password: wazuh-wui +# run_as: true - # Run as - # Define how the app user gets his/her app permissions. - # Values: - # - true: use his/her authentication context. Require Wazuh API user allows run_as. - # - false or not defined: get same permissions of Wazuh API user. - # run_as: hosts: - default: - url: https://localhost - port: 55000 - username: wazuh-wui - password: wazuh-wui - run_as: false -` + url: https://localhost + port: 55000 + username: wazuh-wui + password: wazuh-wui + run_as: false +`; From e43404129d453c42b1f099e2b9ad85fa1cfddbdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Thu, 4 Aug 2022 12:35:39 +0200 Subject: [PATCH 2/4] Add Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 914480d888..898ebae1c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Fixed +- Wazuh.yml review. Fixed link to web documentation. Better in-file documentation and fixed some grammatical errors. [#4378](https://github.com/wazuh/wazuh-kibana-app/pull/4378) - Fixed path in logo customization section [#4352](https://github.com/wazuh/wazuh-kibana-app/pull/4352) ## Wazuh v4.3.6 - Kibana 7.10.2, 7.16.x, 7.17.x - Revision 4307 From 00b9f037dadbb727065f7da07fd6777941244b23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Fri, 5 Aug 2022 16:49:32 +0200 Subject: [PATCH 3/4] Fix indentation for hosts in the wazuh.yml Also fixes some TS warnings --- server/controllers/wazuh-hosts.ts | 19 +++++++++----- server/lib/initial-wazuh-config.ts | 42 +++++++++++++++--------------- server/lib/manage-hosts.ts | 4 +++ server/lib/update-registry.ts | 2 ++ 4 files changed, 40 insertions(+), 27 deletions(-) diff --git a/server/controllers/wazuh-hosts.ts b/server/controllers/wazuh-hosts.ts index fe4a46848b..289370479a 100644 --- a/server/controllers/wazuh-hosts.ts +++ b/server/controllers/wazuh-hosts.ts @@ -10,15 +10,22 @@ * Find more information about this on the LICENSE file. */ +import { KibanaRequest, KibanaResponseFactory, RequestHandlerContext } from 'src/core/server'; +import { + PLUGIN_PLATFORM_INSTALLATION_USER, + PLUGIN_PLATFORM_INSTALLATION_USER_GROUP, + PLUGIN_PLATFORM_NAME, + WAZUH_DATA_PLUGIN_PLATFORM_BASE_ABSOLUTE_PATH, +} from '../../common/constants'; +import { APIUserAllowRunAs } from '../lib/cache-api-user-has-run-as'; +import { ErrorResponse } from '../lib/error-response'; +import { log } from '../lib/logger'; import { ManageHosts } from '../lib/manage-hosts'; import { UpdateRegistry } from '../lib/update-registry'; -import { log } from '../lib/logger'; -import { ErrorResponse } from '../lib/error-response'; -import { APIUserAllowRunAs } from '../lib/cache-api-user-has-run-as'; -import { KibanaRequest, RequestHandlerContext, KibanaResponseFactory } from 'src/core/server'; -import { WAZUH_DATA_PLUGIN_PLATFORM_BASE_ABSOLUTE_PATH, PLUGIN_PLATFORM_INSTALLATION_USER, PLUGIN_PLATFORM_INSTALLATION_USER_GROUP, PLUGIN_PLATFORM_NAME } from '../../common/constants'; export class WazuhHostsCtrl { + manageHosts: ManageHosts; + updateRegistry: UpdateRegistry; constructor() { this.manageHosts = new ManageHosts(); this.updateRegistry = new UpdateRegistry(); @@ -34,7 +41,7 @@ export class WazuhHostsCtrl { async getHostsEntries(context: RequestHandlerContext, request: KibanaRequest, response: KibanaResponseFactory) { try { const removePassword = true; - const hosts = await this.manageHosts.getHosts(removePassword); + const hosts = await this.manageHosts.getHosts(); const registry = await this.updateRegistry.getHosts(); const result = await this.joinHostRegistry(hosts, registry, removePassword); return response.ok({ diff --git a/server/lib/initial-wazuh-config.ts b/server/lib/initial-wazuh-config.ts index 66957291fb..fe62ecc5a4 100644 --- a/server/lib/initial-wazuh-config.ts +++ b/server/lib/initial-wazuh-config.ts @@ -259,30 +259,30 @@ ${splitDescription(configEquivalences['enrollment.password'])} # The following configuration is the default structure to define a host. # # hosts: -# # Host ID / name, +# # Host ID / name, # - env-1: -# # Host URL -# url: https://env-1.example -# # Host / API port -# port: 55000 -# # Host / API username -# username: wazuh-wui -# # Host / API password -# password: wazuh-wui -# # Use RBAC or not. If set to true, the username must be "wazuh-wui". -# run_as: true +# # Host URL +# url: https://env-1.example +# # Host / API port +# port: 55000 +# # Host / API username +# username: wazuh-wui +# # Host / API password +# password: wazuh-wui +# # Use RBAC or not. If set to true, the username must be "wazuh-wui". +# run_as: true # - env-2: -# url: https://env-2.example -# port: 55000 -# username: wazuh-wui -# password: wazuh-wui -# run_as: true +# url: https://env-2.example +# port: 55000 +# username: wazuh-wui +# password: wazuh-wui +# run_as: true hosts: - default: - url: https://localhost - port: 55000 - username: wazuh-wui - password: wazuh-wui - run_as: false + url: https://localhost + port: 55000 + username: wazuh-wui + password: wazuh-wui + run_as: false `; diff --git a/server/lib/manage-hosts.ts b/server/lib/manage-hosts.ts index b512e534d5..1f4576057d 100644 --- a/server/lib/manage-hosts.ts +++ b/server/lib/manage-hosts.ts @@ -18,6 +18,10 @@ import { WAZUH_DATA_CONFIG_APP_PATH } from '../../common/constants'; import { createDataDirectoryIfNotExists } from '../lib/filesystem'; export class ManageHosts { + busy: boolean; + file: string; + updateRegistry: UpdateRegistry; + initialConfig: string; constructor() { this.busy = false; this.file = WAZUH_DATA_CONFIG_APP_PATH; diff --git a/server/lib/update-registry.ts b/server/lib/update-registry.ts index 0aca1e7ec4..71e76ca627 100644 --- a/server/lib/update-registry.ts +++ b/server/lib/update-registry.ts @@ -14,6 +14,8 @@ import { log } from './logger'; import { WAZUH_DATA_CONFIG_REGISTRY_PATH } from '../../common/constants'; export class UpdateRegistry { + busy: boolean; + file: string; constructor() { this.busy = false; this.file = WAZUH_DATA_CONFIG_REGISTRY_PATH; From 4bb051930941e12cf430a1366692d8f948ea9658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Mon, 8 Aug 2022 14:20:58 +0200 Subject: [PATCH 4/4] Deep copy the WAZUH_DEFAULT_APP_CONFIG object --- public/services/resolves/get-config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/services/resolves/get-config.js b/public/services/resolves/get-config.js index d39b304a5d..ba4aa543c1 100644 --- a/public/services/resolves/get-config.js +++ b/public/services/resolves/get-config.js @@ -13,7 +13,7 @@ import { WAZUH_DEFAULT_APP_CONFIG } from '../../../common/constants'; export async function getWzConfig($q, genericReq, wazuhConfig) { - const defaultConfig = WAZUH_DEFAULT_APP_CONFIG; + const defaultConfig = { ...WAZUH_DEFAULT_APP_CONFIG }; try { const config = await genericReq.request('GET', '/utils/configuration', {});