Skip to content

Commit

Permalink
Update generate_base.sh to support Wazuh applications and use package…
Browse files Browse the repository at this point in the history
…s downloaded from github actions
  • Loading branch information
yenienserrano committed Nov 21, 2023
1 parent f3b228c commit 2614d2f
Showing 1 changed file with 36 additions and 8 deletions.
44 changes: 36 additions & 8 deletions dev_tools/build_packages/base/generate_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,51 @@ build() {
echo
mkdir -p $tmp_dir
cd $tmp_dir
mkdir -p applications
if [[ $app =~ $valid_url ]]; then
if ! curl --output app.zip --silent --fail "${app}"; then
echo "The given URL or Path to the Wazuh App is not working: ${app}"
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

if [[ $base =~ $valid_url ]]; then
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
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 .
rm wazuh-dashboard.zip
mv $(ls | grep opensearch-dashboard) 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

if [[ $security =~ $valid_url ]]; then
if ! curl --output security.zip --silent --fail "${security}"; 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}"
Expand All @@ -104,8 +125,15 @@ build() {
bin/opensearch-dashboards-plugin install indexManagementDashboards
bin/opensearch-dashboards-plugin install notificationsDashboards
bin/opensearch-dashboards-plugin install reportsDashboards
bin/opensearch-dashboards-plugin install file:../security.zip
bin/opensearch-dashboards-plugin install file:../app.zip
# 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
Expand Down

0 comments on commit 2614d2f

Please sign in to comment.