Skip to content

Commit

Permalink
Merge pull request #2899 from wazuh/merge-4.9.0-into-master
Browse files Browse the repository at this point in the history
Merge 4.9.0 into master
  • Loading branch information
vikman90 authored Apr 3, 2024
2 parents 9f55ace + 2909d5f commit 371c0d0
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 14 deletions.
14 changes: 8 additions & 6 deletions hp-ux/generate_wazuh_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ create_package() {
VERSION=`cat /tmp/VERSION`
rm ${install_path}/wodles/oscap/content/*.xml
wazuh_version=`echo "${wazuh_version}" | cut -d v -f 2`
pkg_name="wazuh-agent-${wazuh_version}-${wazuh_revision}-hpux-11v3-ia64.tar"
tar cvpf ${target_dir}/${pkg_name} ${install_path} /sbin/init.d/wazuh-agent /sbin/rc2.d/S97wazuh-agent /sbin/rc3.d/S97wazuh-agent
pkg_tar_file="wazuh-agent-${wazuh_version}-${wazuh_revision}-hpux-11v3-ia64.tar"
tar cvpf ${target_dir}/${pkg_tar_file} ${install_path} /sbin/init.d/wazuh-agent /sbin/rc2.d/S97wazuh-agent /sbin/rc3.d/S97wazuh-agent
pkg_name="${pkg_tar_file}.gz"
gzip ${target_dir}/${pkg_tar_file}

if [ "${compute_checksums}" = "yes" ]; then
cd ${target_dir}
Expand Down Expand Up @@ -210,11 +212,11 @@ show_help() {
echo
echo "Usage: $0 [OPTIONS]"
echo
echo " -e Install all the packages necessaries to build the TAR package"
echo " -e Install all the packages necessaries to build the package"
echo " -b <branch> Select Git branch. Example v3.5.0"
echo " -s <tar_directory> Directory to store the resulting tar package. By default, an output folder will be created."
echo " -p <tar_home> Installation path for the package. By default: /var"
echo " -c, --checksum Compute the SHA512 checksum of the TAR package."
echo " -s <pkg_directory> Directory to store the resulting package. By default, an output folder will be created."
echo " -p <pkg_home> Installation path for the package. By default: /var"
echo " -c, --checksum Compute the SHA512 checksum of the package."
echo " -d <path_to_depot>, --depot Change the path to depothelper package (by default current path)."
echo " -h Shows this help"
echo
Expand Down
6 changes: 3 additions & 3 deletions rpms/SPECS/wazuh-manager.spec
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ rm -fr %{buildroot}
%attr(640, wazuh, wazuh) %ghost %{_localstatedir}/logs/integrations.log
%attr(660, wazuh, wazuh) %ghost %{_localstatedir}/logs/ossec.log
%attr(660, wazuh, wazuh) %ghost %{_localstatedir}/logs/ossec.json
%dir %attr(750, wazuh, wazuh) %{_localstatedir}/templates
%dir %attr(440, root, wazuh) %{_localstatedir}/templates
%attr(0440, root, wazuh) %{_localstatedir}/templates/vd_states_template.json
%dir %attr(750, wazuh, wazuh) %{_localstatedir}/logs/api
%dir %attr(750, wazuh, wazuh) %{_localstatedir}/logs/archives
Expand Down Expand Up @@ -761,8 +761,8 @@ rm -fr %{buildroot}
%dir %attr(770, wazuh, wazuh) %{_localstatedir}/queue/rids
%dir %attr(770, wazuh, wazuh) %{_localstatedir}/queue/tasks
%dir %attr(770, wazuh, wazuh) %{_localstatedir}/queue/sockets
%dir %attr(770, wazuh, wazuh) %{_localstatedir}/queue/vd
%dir %attr(770, wazuh, wazuh) %{_localstatedir}/queue/indexer
%dir %attr(660, root, wazuh) %{_localstatedir}/queue/vd
%dir %attr(660, root, wazuh) %{_localstatedir}/queue/indexer
%dir %attr(770, wazuh, wazuh) %{_localstatedir}/queue/router
%dir %attr(750, wazuh, wazuh) %{_localstatedir}/queue/logcollector
%dir %attr(750, wazuh, wazuh) %{_localstatedir}/queue/keystore
Expand Down
6 changes: 5 additions & 1 deletion rpms/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ src_file="${file_name}.src.rpm"
pkg_path="${rpm_build_dir}/RPMS/${architecture_target}"
src_path="${rpm_build_dir}/SRPMS"
extract_path="${pkg_path}"
ssl_flag=""
mkdir -p ${rpm_build_dir}/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}

# Prepare the sources directory to build the source tar.gz
Expand All @@ -68,7 +69,10 @@ cp -R wazuh-* ${build_dir}/${package_name}
if [ "${use_local_specs}" = "no" ]; then
specs_path="/downloaded_tmp_specs"
mkdir -p "${specs_path}"
curl -L "https://raw.githubusercontent.com/wazuh/wazuh-packages/${wazuh_packages_branch}/rpms/SPECS/wazuh-${build_target}.spec" -o "${specs_path}/wazuh-${build_target}.spec"
if [ "${legacy}" = "yes" ]; then
ssl_flag+="-k"
fi
curl -L "https://raw.githubusercontent.com/wazuh/wazuh-packages/${wazuh_packages_branch}/rpms/SPECS/wazuh-${build_target}.spec" -o "${specs_path}/wazuh-${build_target}.spec" ${ssl_flag}
else
specs_path="/specs"
fi
Expand Down
4 changes: 2 additions & 2 deletions stack/dashboard/base/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ sed -i "s/navigateToApp(\"home\")/navigateToApp(\"${app_home}\")/g" ./src/core/t
# Define categories
category_explore='{id:"explore",label:"Explore",order:100,euiIconType:"search"}'
category_indexer_management='{id:"management",label:"Indexer management",order:5e3,euiIconType:"managementApp"}'
category_dashboard_management='{id:"wz-category-dashboard-management",label:"Dashboard management",order:700,euiIconType:"dashboardApp"}'
category_dashboard_management='{id:"wz-category-dashboard-management",label:"Dashboard management",order:6e3,euiIconType:"dashboardApp"}'

# Add custom categories (explore) to the built-in
sed -i -e "s|DEFAULT_APP_CATEGORIES=Object.freeze({|DEFAULT_APP_CATEGORIES=Object.freeze({explore:${category_explore},|" ./src/core/target/public/core.entry.js
Expand Down Expand Up @@ -239,7 +239,7 @@ app_order_dev_tools=9050
sed -i -e "s|order:9070|order:${app_order_dev_tools}|g" ./src/plugins/dev_tools/target/public/devTools.plugin.js

# Replace app order to Dashboard management app
app_order_dashboard_management=701
app_order_dashboard_management=10001
sed -i -e "s|order:9030|order:${app_order_dashboard_management}|g" ./src/plugins/management/target/public/management.plugin.js

# Replace app order to Security app
Expand Down
3 changes: 2 additions & 1 deletion unattended_installer/install_functions/dashboard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function dashboard_changePort() {

chosen_port="$1"
http_port="${chosen_port}"
wazuh_dashboard_ports=( "${http_port}" )
wazuh_dashboard_port=( "${http_port}" )
wazuh_aio_ports=(9200 9300 1514 1515 1516 55000 "${http_port}")

sed -i 's/server\.port: [0-9]\+$/server.port: '"${chosen_port}"'/' "$0"
Expand Down Expand Up @@ -85,6 +85,7 @@ function dashboard_copyCertificates() {
common_logger -d "Wazuh dashboard certificate setup finished."
else
common_logger -e "No certificates found. Wazuh dashboard could not be initialized."
installCommon_rollBack
exit 1
fi

Expand Down
1 change: 1 addition & 0 deletions unattended_installer/install_functions/filebeat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function filebeat_copyCertificates() {
eval "chown root:root ${filebeat_cert_path}/* ${debug}"
else
common_logger -e "No certificates found. Could not initialize Filebeat"
installCommon_rollBack
exit 1
fi

Expand Down
3 changes: 3 additions & 0 deletions unattended_installer/install_functions/installCommon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ function installCommon_aptInstallList(){
installCommon_aptInstall "${dep}"
if [ "${install_result}" != 0 ]; then
common_logger -e "Cannot install dependency: ${dep}."
installCommon_rollBack
exit 1
fi
done
Expand Down Expand Up @@ -277,6 +278,7 @@ function installCommon_changePasswords() {
installCommon_readPasswordFileUsers
else
common_logger -e "Cannot find passwords file. Exiting"
installCommon_rollBack
exit 1
fi
if [ -n "${start_indexer_cluster}" ] || [ -n "${AIO}" ]; then
Expand Down Expand Up @@ -801,6 +803,7 @@ function installCommon_yumInstallList(){
eval "echo \${yum_output} ${debug}"
if [ "${yum_code}" != 0 ]; then
common_logger -e "Cannot install dependency: ${dep}."
installCommon_rollBack
exit 1
fi
done
Expand Down
11 changes: 10 additions & 1 deletion unattended_installer/passwords_tool/passwordsFunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ function passwords_createBackUp() {
eval "JAVA_HOME=/usr/share/wazuh-indexer/jdk/ OPENSEARCH_CONF_DIR=/etc/wazuh-indexer /usr/share/wazuh-indexer/plugins/opensearch-security/tools/securityadmin.sh -backup /etc/wazuh-indexer/backup -icl -p 9200 -nhnv -cacert ${capem} -cert ${adminpem} -key ${adminkey} -h ${IP} ${debug}"
if [ "${PIPESTATUS[0]}" != 0 ]; then
common_logger -e "The backup could not be created"
if [[ $(type -t installCommon_rollBack) == "function" ]]; then
installCommon_rollBack
fi
exit 1;
fi
common_logger -d "Password backup created in /etc/wazuh-indexer/backup."
Expand All @@ -202,6 +205,9 @@ function passwords_generateHash() {
nhash=$(bash /usr/share/wazuh-indexer/plugins/opensearch-security/tools/hash.sh -p "${passwords[i]}" | grep -A 2 'issues' | tail -n 1)
if [ "${PIPESTATUS[0]}" != 0 ]; then
common_logger -e "Hash generation failed."
if [[ $(type -t installCommon_rollBack) == "function" ]]; then
installCommon_rollBack
fi
exit 1;
fi
hashes+=("${nhash}")
Expand All @@ -212,6 +218,9 @@ function passwords_generateHash() {
hash=$(bash /usr/share/wazuh-indexer/plugins/opensearch-security/tools/hash.sh -p "${password}" | grep -A 2 'issues' | tail -n 1)
if [ "${PIPESTATUS[0]}" != 0 ]; then
common_logger -e "Hash generation failed."
if [[ $(type -t installCommon_rollBack) == "function" ]]; then
installCommon_rollBack
fi
exit 1;
fi
common_logger -d "Password hash generated."
Expand Down Expand Up @@ -402,7 +411,7 @@ For Wazuh API users, the file must have this format:
api_password: <password>
"
exit 1
exit 1
fi

sfileusers=$(grep indexer_username: "${p_file}" | awk '{ print substr( $2, 1, length($2) ) }' | sed -e "s/[\'\"]//g")
Expand Down

0 comments on commit 371c0d0

Please sign in to comment.