Skip to content

Commit

Permalink
Remove unnecessary plugin for next versions in the package build (#467)
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Yenien Serrano <[email protected]>
  • Loading branch information
yenienserrano authored Dec 27, 2024
1 parent 4be8d9c commit 8e8bb4f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 42 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/build_wazuh_dashboard_with_plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ jobs:
WAZUH_DASHBOARD_SLIM: ${{ steps.setup-variables.outputs.WAZUH_DASHBOARD_SLIM }}
WAZUH_SECURITY_PLUGIN: ${{ steps.setup-variables.outputs.WAZUH_SECURITY_PLUGIN }}
WAZUH_REPORT_PLUGIN: ${{ steps.setup-variables.outputs.WAZUH_REPORT_PLUGIN }}
WAZUH_PLUGINS_WAZUH: ${{ steps.setup-variables.outputs.WAZUH_PLUGINS_WAZUH }}
WAZUH_PLUGINS_CORE: ${{ steps.setup-variables.outputs.WAZUH_PLUGINS_CORE }}
WAZUH_PLUGINS_CHECK_UPDATES: ${{ steps.setup-variables.outputs.WAZUH_PLUGINS_CHECK_UPDATES }}
PACKAGE_NAME: ${{ steps.setup-variables.outputs.PACKAGE_NAME }}
Expand Down Expand Up @@ -168,8 +167,7 @@ jobs:
WAZUH_DASHBOARD_SLIM=wazuh-dashboard_${VERSION}-${REVISION}_${{ (inputs.ARCHITECTURE == 'x86_64' || inputs.ARCHITECTURE == 'amd64') && 'x64' || 'arm64' }}.tar.gz
WAZUH_SECURITY_PLUGIN=wazuh-security-dashboards-plugin_${VERSION}-${REVISION}_$(echo ${{ inputs.reference_security_plugins }} | sed 's/\//-/g').zip
WAZUH_REPORT_PLUGIN=reports-dashboards_${VERSION}-${REVISION}_$(echo ${{ inputs.reference_report_plugins }} | sed 's/\//-/g').zip
WAZUH_PLUGINS_WAZUH=wazuh-dashboard-plugins_wazuh_${VERSION}-${REVISION}_${{ inputs.reference_wazuh_plugins }}.zip
WAZUH_PLUGINS_CORE=wazuh-dashboard-plugins_wazuh-core_${VERSION}-${REVISION}_${{ inputs.reference_wazuh_plugins }}.zip
WAZUH_PLUGINS_CORE=wazuh-dashboard-plugins_wazuh-core_${VERSION}-${REVISION}_$(echo ${{ inputs.reference_wazuh_plugins }} | sed 's/\//-/g').zip
WAZUH_PLUGINS_CHECK_UPDATES=wazuh-dashboard-plugins_wazuh-check-updates_${VERSION}-${REVISION}_$(echo ${{ inputs.reference_wazuh_plugins }} | sed 's/\//-/g').zip
if [ "${{ inputs.system }}" = "deb" ]; then
if [ "${{ inputs.is_stage }}" = "true" ]; then
Expand Down Expand Up @@ -201,7 +199,6 @@ jobs:
echo "WAZUH_DASHBOARD_SLIM=$WAZUH_DASHBOARD_SLIM" >> $GITHUB_OUTPUT
echo "WAZUH_SECURITY_PLUGIN=$WAZUH_SECURITY_PLUGIN" >> $GITHUB_OUTPUT
echo "WAZUH_REPORT_PLUGIN=$WAZUH_REPORT_PLUGIN" >> $GITHUB_OUTPUT
echo "WAZUH_PLUGINS_WAZUH=$WAZUH_PLUGINS_WAZUH" >> $GITHUB_OUTPUT
echo "WAZUH_PLUGINS_CORE=$WAZUH_PLUGINS_CORE" >> $GITHUB_OUTPUT
echo "WAZUH_PLUGINS_CHECK_UPDATES=$WAZUH_PLUGINS_CHECK_UPDATES" >> $GITHUB_OUTPUT
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -286,11 +283,6 @@ jobs:
name: ${{ needs.setup-variables.outputs.WAZUH_SECURITY_PLUGIN }}
path: ${{ needs.setup-variables.outputs.CURRENT_DIR }}/artifacts/security-plugin

- name: Download plugins artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.setup-variables.outputs.WAZUH_PLUGINS_WAZUH }}
path: ${{ needs.setup-variables.outputs.CURRENT_DIR }}/artifacts/plugins
- name: Download plugins artifacts
uses: actions/download-artifact@v4
with:
Expand Down
47 changes: 23 additions & 24 deletions dev-tools/build-packages/deb/debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,34 @@ 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
setcap 'cap_net_bind_service=+ep' "${INSTALLATION_DIR}"/node/fallback/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
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
setcap 'cap_net_bind_service=+ep' "${INSTALLATION_DIR}"/node/fallback/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
if [ ! -f "${CONFIG_DIR}"/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
/usr/share/wazuh-dashboard/bin/opensearch-dashboards-plugin remove wazuh --allow-root >/dev/null 2>&1
;;
fi
if [ ! -f "${CONFIG_DIR}"/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
;;
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;

esac

Expand Down
2 changes: 0 additions & 2 deletions dev-tools/build-packages/deb/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ override_dh_install:
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:
Expand Down
7 changes: 0 additions & 7 deletions dev-tools/build-packages/rpm/wazuh-dashboard.spec
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,6 @@ 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
Expand Down Expand Up @@ -191,7 +185,6 @@ if [ -f %{INSTALL_DIR}/wazuh-dashboard.restart ]; then
fi

fi
/usr/share/wazuh-dashboard/bin/opensearch-dashboards-plugin remove wazuh --allow-root

# -----------------------------------------------------------------------------

Expand Down

0 comments on commit 8e8bb4f

Please sign in to comment.