Skip to content

Commit

Permalink
Merge pull request #2621 from wazuh/remove-report-dependencies-4.6.0
Browse files Browse the repository at this point in the history
Removed PDF report dependencies - 4.6.0
  • Loading branch information
teddytpc1 authored Nov 21, 2023
2 parents 0da9c3b + faaff08 commit e5bd17d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 109 deletions.
29 changes: 0 additions & 29 deletions unattended_installer/install_functions/dashboard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -216,32 +216,3 @@ function dashboard_install() {
fi

}

function dashboard_installReportDependencies() {

# Flags that indicates that is an optional installation.
optional_installation=1
report_dependencies=1

installCommon_checkChromium

if [ "${sys_type}" == "yum" ]; then
dashboard_dependencies+=( nss xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc fontconfig freetype )
installCommon_yumInstallList "${dashboard_dependencies[@]}"

# In RHEL cases, remove the CentOS repositories configuration
if [ "${centos_repos_configured}" == 1 ]; then
installCommon_removeCentOSrepositories
fi

elif [ "${sys_type}" == "apt-get" ]; then
dashboard_dependencies+=( libnss3-dev fonts-liberation libfontconfig1 )
installCommon_aptInstallList "${dashboard_dependencies[@]}"
fi

if [ "${pdf_warning}" == 1 ]; then
common_logger -w "Wazuh dashboard dependencies skipped. PDF report generation may not work."
fi
optional_installation=0

}
88 changes: 14 additions & 74 deletions unattended_installer/install_functions/installCommon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ function installCommon_aptInstallList(){
common_logger "Installing $dep."
installCommon_aptInstall "${dep}"
if [ "${install_result}" != 0 ]; then
installCommon_checkOptionalInstallation
common_logger -e "Cannot install dependency: ${dep}."
exit 1
fi
done
fi
Expand Down Expand Up @@ -173,20 +174,6 @@ function installCommon_changePasswordApi() {

}

function installCommon_checkOptionalInstallation() {

if [ "${optional_installation}" != 1 ]; then
common_logger -e "Cannot install dependency: ${dep}."
exit 1
else
common_logger -w "Cannot install optional dependency: ${dep}."
if [ "${report_dependencies}" == 1 ]; then
pdf_warning=1
fi
fi

}

function installCommon_createCertificates() {

if [ -n "${AIO}" ]; then
Expand Down Expand Up @@ -292,37 +279,7 @@ function installCommon_changePasswords() {

}

function installCommon_checkChromium() {

if [ "${sys_type}" == "yum" ]; then
if (! yum list installed 2>/dev/null | grep -q -E ^"google-chrome-stable"\\.) && (! yum list installed 2>/dev/null | grep -q -E ^"chromium"\\.); then
if [ "${DIST_NAME}" == "amzn" ]; then
installCommon_installChrome
elif [[ "${DIST_NAME}" == "centos" ]] && [[ "${DIST_VER}" == "7" ]]; then
installCommon_installChrome
elif [[ "${DIST_NAME}" == "rhel" ]] && [[ "${DIST_VER}" == "8" || "${DIST_VER}" == "9" ]]; then
installCommon_configureCentOSRepositories
dashboard_dependencies=(chromium)
else
dashboard_dependencies=(chromium)
fi
fi

elif [ "${sys_type}" == "apt-get" ]; then
if (! apt list --installed 2>/dev/null | grep -q -E ^"google-chrome-stable"\/) && (! apt list --installed 2>/dev/null | grep -q -E ^"chromium-browser"\/); then

# Report generation doesn't work with Chromium in Ubuntu 22 and Ubuntu 20
if [[ "${DIST_NAME}" == "ubuntu" ]] && [[ "${DIST_VER}" == "22" || "${DIST_VER}" == "20" || "${DIST_VER}" == "18" ]]; then
installCommon_installChrome
else
dashboard_dependencies=(chromium-browser)
fi
fi
fi

}

# Adds the CentOS repository to install the dashboard dependencies.
# Adds the CentOS repository to install lsof.
function installCommon_configureCentOSRepositories() {

centos_repos_configured=1
Expand Down Expand Up @@ -390,8 +347,16 @@ function installCommon_installCheckDependencies() {

if [ "${sys_type}" == "yum" ]; then
dependencies=( systemd grep tar coreutils sed procps-ng gawk lsof curl openssl )
if [[ "${DIST_NAME}" == "rhel" ]] && [[ "${DIST_VER}" == "8" || "${DIST_VER}" == "9" ]]; then
installCommon_configureCentOSRepositories
fi
installCommon_yumInstallList "${dependencies[@]}"

# In RHEL cases, remove the CentOS repositories configuration
if [ "${centos_repos_configured}" == 1 ]; then
installCommon_removeCentOSrepositories
fi

elif [ "${sys_type}" == "apt-get" ]; then
eval "apt-get update -q ${debug}"
dependencies=( systemd grep tar coreutils sed procps gawk lsof curl openssl )
Expand All @@ -400,32 +365,6 @@ function installCommon_installCheckDependencies() {

}

function installCommon_installChrome() {

dep="chrome"
common_logger "Installing ${dep}."

if [ "${sys_type}" == "yum" ]; then
chrome_package="/tmp/wazuh-install-files/chrome.rpm"
common_curl -so "${chrome_package}" https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm --max-time 100 --retry 5 --retry-delay 5 --fail
eval "yum install ${chrome_package} -y ${debug}"

if [ "${PIPESTATUS[0]}" != 0 ]; then
installCommon_checkOptionalInstallation
fi

elif [ "${sys_type}" == "apt-get" ]; then
chrome_package="/tmp/wazuh-install-files/chrome.deb"
common_curl -so "${chrome_package}" https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb --max-time 100 --retry 5 --retry-delay 5 --fail
installCommon_aptInstall "${chrome_package}"

if [ "${install_result}" != 0 ]; then
installCommon_checkOptionalInstallation
fi
fi

}

function installCommon_installPrerequisites() {

if [ "${sys_type}" == "yum" ]; then
Expand Down Expand Up @@ -576,7 +515,7 @@ function installCommon_restoreWazuhrepo() {
}

function installCommon_removeCentOSrepositories() {

eval "rm -f ${centos_repo} ${debug}"
eval "rm -f ${centos_key} ${debug}"
eval "yum clean all ${debug}"
Expand Down Expand Up @@ -765,7 +704,8 @@ function installCommon_yumInstallList(){

eval "echo \${yum_output} ${debug}"
if [ "${yum_code}" != 0 ]; then
installCommon_checkOptionalInstallation
common_logger -e "Cannot install dependency: ${dep}."
exit 1
fi
done
fi
Expand Down
6 changes: 0 additions & 6 deletions unattended_installer/install_functions/installMain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,6 @@ function main() {

common_checkSystem

if [ -z "${uninstall}" ]; then
installCommon_installCheckDependencies
fi

if [ -z "${download}" ]; then
check_dist
fi
Expand Down Expand Up @@ -321,7 +317,6 @@ function main() {

if [ -n "${dashboard}" ]; then
common_logger "--- Wazuh dashboard ----"
dashboard_installReportDependencies
dashboard_install
dashboard_configure
installCommon_startService "wazuh-dashboard"
Expand Down Expand Up @@ -361,7 +356,6 @@ function main() {
filebeat_configure
installCommon_startService "filebeat"
common_logger "--- Wazuh dashboard ---"
dashboard_installReportDependencies
dashboard_install
dashboard_configure
installCommon_startService "wazuh-dashboard"
Expand Down

0 comments on commit e5bd17d

Please sign in to comment.