Ei kuvausta

wazuh_app_config.sh 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. # Wazuh Docker Copyright (C) 2017, Wazuh Inc. (License GPLv2)
  3. wazuh_url="${WAZUH_API_URL:-https://wazuh}"
  4. wazuh_port="${API_PORT:-55000}"
  5. api_username="${API_USERNAME:-wazuh-wui}"
  6. api_password="${API_PASSWORD:-wazuh-wui}"
  7. api_run_as="${RUN_AS:-true}"
  8. dashboard_config_file="/usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml"
  9. declare -A CONFIG_MAP=(
  10. [pattern]=$PATTERN
  11. [checks.pattern]=$CHECKS_PATTERN
  12. [checks.template]=$CHECKS_TEMPLATE
  13. [checks.api]=$CHECKS_API
  14. [checks.setup]=$CHECKS_SETUP
  15. [timeout]=$APP_TIMEOUT
  16. [api.selector]=$API_SELECTOR
  17. [ip.selector]=$IP_SELECTOR
  18. [ip.ignore]=$IP_IGNORE
  19. [wazuh.monitoring.enabled]=$WAZUH_MONITORING_ENABLED
  20. [wazuh.monitoring.frequency]=$WAZUH_MONITORING_FREQUENCY
  21. [wazuh.monitoring.shards]=$WAZUH_MONITORING_SHARDS
  22. [wazuh.monitoring.replicas]=$WAZUH_MONITORING_REPLICAS
  23. )
  24. for i in "${!CONFIG_MAP[@]}"
  25. do
  26. if [ "${CONFIG_MAP[$i]}" != "" ]; then
  27. sed -i 's/.*#'"$i"'.*/'"$i"': '"${CONFIG_MAP[$i]}"'/' $dashboard_config_file
  28. fi
  29. done
  30. grep -q 1513629884013 $dashboard_config_file
  31. _config_exists=$?
  32. if [[ $_config_exists -ne 0 ]]; then
  33. cat << EOF >> $dashboard_config_file
  34. hosts:
  35. - 1513629884013:
  36. url: $wazuh_url
  37. port: $wazuh_port
  38. username: $api_username
  39. password: $api_password
  40. run_as: $api_run_as
  41. EOF
  42. else
  43. echo "Wazuh APP already configured"
  44. fi