diff --git a/macos/generate_wazuh_packages.sh b/macos/generate_wazuh_packages.sh index af9ef12b49..04e5385ec9 100755 --- a/macos/generate_wazuh_packages.sh +++ b/macos/generate_wazuh_packages.sh @@ -12,9 +12,9 @@ CURRENT_PATH="$( cd $(dirname ${0}) ; pwd -P )" SOURCES_DIRECTORY="${CURRENT_PATH}/repository" WAZUH_PATH="${SOURCES_DIRECTORY}/wazuh" WAZUH_SOURCE_REPOSITORY="https://github.com/wazuh/wazuh" -AGENT_PKG_FILE="${CURRENT_PATH}/package_files/wazuh-agent.pkgproj" export CONFIG="${WAZUH_PATH}/etc/preloaded-vars.conf" ENTITLEMENTS_PATH="${CURRENT_PATH}/entitlements.plist" +ARCH="intel64" INSTALLATION_PATH="/Library/Ossec" # Installation path VERSION="" # Default VERSION (branch/tag) REVISION="1" # Package revision. @@ -150,8 +150,8 @@ function build_package() { # create package if packagesbuild ${AGENT_PKG_FILE} --build-folder ${DESTINATION} ; then - echo "The wazuh agent package for MacOS X has been successfully built." - pkg_name="wazuh-agent-${VERSION}-${REVISION}.pkg" + echo "The wazuh agent package for macOS has been successfully built." + pkg_name="wazuh-agent-${VERSION}-${REVISION}.${ARCH}.pkg" sign_pkg notarize_pkg if [[ "${CHECKSUM}" == "yes" ]]; then @@ -170,6 +170,7 @@ function help() { echo "Usage: $0 [OPTIONS]" echo echo " Build options:" + echo " -a, --architecture [Optional] Target architecture of the package [intel64/arm64]. By Default: intel64." echo " -b, --branch [Required] Select Git branch or tag e.g. $BRANCH" echo " -s, --store-path [Optional] Set the destination absolute path of package." echo " -j, --jobs [Optional] Number of parallel jobs when compiling." @@ -196,14 +197,14 @@ function get_pkgproj_specs() { VERSION=$(< "${WAZUH_PATH}/src/VERSION" cut -d "-" -f1 | cut -c 2-) - pkg_file="specs/wazuh-agent.pkgproj" + pkg_file="specs/wazuh-agent-${ARCH}.pkgproj" if [ ! -f "${pkg_file}" ]; then echo "Warning: the file ${pkg_file} does not exists. Check the version selected." exit 1 else echo "Modifiying ${pkg_file} to match revision." - sed -i -e "s:${VERSION}-.*<:${VERSION}-${REVISION}<:g" "${pkg_file}" + sed -i -e "s:${VERSION}-.*<:${VERSION}-${REVISION}.${ARCH}<:g" "${pkg_file}" cp "${pkg_file}" "${AGENT_PKG_FILE}" fi @@ -236,6 +237,10 @@ function install_deps() { echo "Something went wrong installing packagesbuild." fi + if [ "$(uname -m)" = "arm64" ]; then + echo "Installing build dependencies for arm64 architecture" + brew install gcc binutils autoconf automake libtool cmake + fi exit 0 } @@ -262,6 +267,14 @@ function main() { while [ -n "$1" ] do case "$1" in + "-a"|"--architecture") + if [ -n "$2" ]; then + ARCH="$2" + shift 2 + else + help 1 + fi + ;; "-b"|"--branch") if [ -n "$2" ]; then BRANCH_TAG="$2" @@ -382,12 +395,19 @@ function main() { testdep + if [ "${ARCH}" != "intel64" ] && [ "${ARCH}" != "arm64" ]; then + echo "Error: architecture not supported." + echo "Supported architectures: intel64, arm64" + exit 1 + fi + if [ -z "${CHECKSUMDIR}" ]; then CHECKSUMDIR="${DESTINATION}" fi if [[ "$BUILD" != "no" ]]; then check_root + AGENT_PKG_FILE="${CURRENT_PATH}/package_files/wazuh-agent-${ARCH}.pkgproj" build_package "${CURRENT_PATH}/uninstall.sh" else diff --git a/macos/specs/wazuh-agent-arm64.pkgproj b/macos/specs/wazuh-agent-arm64.pkgproj new file mode 100644 index 0000000000..b176b3e90b --- /dev/null +++ b/macos/specs/wazuh-agent-arm64.pkgproj @@ -0,0 +1,1255 @@ + + + + + PACKAGES + + + MUST-CLOSE-APPLICATION-ITEMS + + MUST-CLOSE-APPLICATIONS + + PACKAGE_FILES + + DEFAULT_INSTALL_LOCATION + / + HIERARCHY + + CHILDREN + + + CHILDREN + + GID + 80 + PATH + Applications + PATH_TYPE + 0 + PERMISSIONS + 509 + TYPE + 1 + UID + 0 + + + CHILDREN + + + CHILDREN + + GID + 80 + PATH + Application Support + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Automator + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Documentation + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Extensions + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Filesystems + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Frameworks + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Input Methods + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Internet Plug-Ins + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + LaunchAgents + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + LaunchDaemons + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/.ssh + PATH_TYPE + 0 + PERMISSIONS + 448 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/active-response + PATH_TYPE + 0 + PERMISSIONS + 488 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/agentless + PATH_TYPE + 0 + PERMISSIONS + 488 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/bin + PATH_TYPE + 0 + PERMISSIONS + 488 + TYPE + 3 + UID + 0 + + + CHILDREN + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/etc/internal_options.conf + PATH_TYPE + 0 + PERMISSIONS + 416 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/etc/localtime + PATH_TYPE + 0 + PERMISSIONS + 416 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/etc/client.keys + PATH_TYPE + 0 + PERMISSIONS + 416 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/etc/local_internal_options.conf + PATH_TYPE + 0 + PERMISSIONS + 416 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/etc/ossec.conf + PATH_TYPE + 0 + PERMISSIONS + 416 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/etc/shared + PATH_TYPE + 0 + PERMISSIONS + 504 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/etc/wpk_root.pem + PATH_TYPE + 0 + PERMISSIONS + 416 + TYPE + 3 + UID + 0 + + + EXPANDED + + GID + 0 + PATH + /Library/Ossec/etc + PATH_TYPE + 0 + PERMISSIONS + 504 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/lib + PATH_TYPE + 0 + PERMISSIONS + 488 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/logs + PATH_TYPE + 0 + PERMISSIONS + 488 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/queue + PATH_TYPE + 0 + PERMISSIONS + 488 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/tmp + PATH_TYPE + 0 + PERMISSIONS + 1000 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/packages_files + PATH_TYPE + 0 + PERMISSIONS + 488 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/var + PATH_TYPE + 0 + PERMISSIONS + 488 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/wodles + PATH_TYPE + 0 + PERMISSIONS + 488 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Library/Ossec/ruleset + PATH_TYPE + 0 + PERMISSIONS + 488 + TYPE + 3 + UID + 0 + + + EXPANDED + + GID + 0 + PATH + /Library/Ossec + PATH_TYPE + 0 + PERMISSIONS + 488 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + PreferencePanes + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Preferences + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 80 + PATH + Printers + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + PrivilegedHelperTools + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + QuickLook + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + QuickTime + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Screen Savers + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Scripts + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Services + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Widgets + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + GID + 0 + PATH + Library + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + + CHILDREN + + GID + 0 + PATH + Shared + PATH_TYPE + 0 + PERMISSIONS + 1023 + TYPE + 1 + UID + 0 + + + GID + 80 + PATH + Users + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + GID + 0 + PATH + / + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + PAYLOAD_TYPE + 0 + SHOW_INVISIBLE + + SPLIT_FORKS + + TREAT_MISSING_FILES_AS_WARNING + + VERSION + 4 + + PACKAGE_SCRIPTS + + POSTINSTALL_PATH + + PATH + postinstall.sh + PATH_TYPE + 1 + + PREINSTALL_PATH + + PATH + preinstall.sh + PATH_TYPE + 1 + + RESOURCES + + + PACKAGE_SETTINGS + + AUTHENTICATION + 1 + CONCLUSION_ACTION + 0 + FOLLOW_SYMBOLIC_LINKS + + IDENTIFIER + com.wazuh.pkg.wazuh-agent + LOCATION + 0 + NAME + agent + OVERWRITE_PERMISSIONS + + PAYLOAD_SIZE + -1 + RELOCATABLE + + USE_HFS+_COMPRESSION + + VERSION + 4.5.1-1 + + TYPE + 0 + UUID + 7BC88EDC-74AB-498A-992B-DE940686D898 + + + PROJECT + + PROJECT_COMMENTS + + NOTES + + PCFET0NUWVBFIGh0bWwgUFVCTElDICItLy9XM0MvL0RURCBIVE1M + IDQuMDEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvVFIvaHRtbDQv + c3RyaWN0LmR0ZCI+CjxodG1sPgo8aGVhZD4KPG1ldGEgaHR0cC1l + cXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7 + IGNoYXJzZXQ9VVRGLTgiPgo8bWV0YSBodHRwLWVxdWl2PSJDb250 + ZW50LVN0eWxlLVR5cGUiIGNvbnRlbnQ9InRleHQvY3NzIj4KPHRp + dGxlPjwvdGl0bGU+CjxtZXRhIG5hbWU9IkdlbmVyYXRvciIgY29u + dGVudD0iQ29jb2EgSFRNTCBXcml0ZXIiPgo8bWV0YSBuYW1lPSJD + b2NvYVZlcnNpb24iIGNvbnRlbnQ9IjE1MDQuODMiPgo8c3R5bGUg + dHlwZT0idGV4dC9jc3MiPgo8L3N0eWxlPgo8L2hlYWQ+Cjxib2R5 + Pgo8L2JvZHk+CjwvaHRtbD4K + + + PROJECT_PRESENTATION + + BACKGROUND + + INSTALLATION TYPE + + HIERARCHIES + + INSTALLER + + LIST + + + DESCRIPTION + + OPTIONS + + HIDDEN + + STATE + 0 + + PACKAGE_UUID + 7BC88EDC-74AB-498A-992B-DE940686D898 + REQUIREMENTS + + TITLE + + + LANGUAGE + English + VALUE + Wazuh Agent + + + TOOLTIP + + TYPE + 0 + UUID + B5127C49-7EF4-4B73-97D7-2819981073A4 + + + REMOVED + + + + MODE + 0 + + INSTALLATION_STEPS + + + ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS + ICPresentationViewIntroductionController + INSTALLER_PLUGIN + Introduction + LIST_TITLE_KEY + InstallerSectionTitle + + + ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS + ICPresentationViewReadMeController + INSTALLER_PLUGIN + ReadMe + LIST_TITLE_KEY + InstallerSectionTitle + + + ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS + ICPresentationViewLicenseController + INSTALLER_PLUGIN + License + LIST_TITLE_KEY + InstallerSectionTitle + + + ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS + ICPresentationViewDestinationSelectController + INSTALLER_PLUGIN + TargetSelect + LIST_TITLE_KEY + InstallerSectionTitle + + + ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS + ICPresentationViewInstallationTypeController + INSTALLER_PLUGIN + PackageSelection + LIST_TITLE_KEY + InstallerSectionTitle + + + ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS + ICPresentationViewInstallationController + INSTALLER_PLUGIN + Install + LIST_TITLE_KEY + InstallerSectionTitle + + + ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS + ICPresentationViewSummaryController + INSTALLER_PLUGIN + Summary + LIST_TITLE_KEY + InstallerSectionTitle + + + INTRODUCTION + + LOCALIZATIONS + + + LANGUAGE + English + VALUE + + PATH + introduction.txt + PATH_TYPE + 1 + + + + + LICENSE + + LOCALIZATIONS + + MODE + 0 + + README + + LOCALIZATIONS + + + TITLE + + LOCALIZATIONS + + + LANGUAGE + English + VALUE + Wazuh Agent + + + + + PROJECT_REQUIREMENTS + + LIST + + + BEHAVIOR + 3 + DICTIONARY + + IC_REQUIREMENT_CPU_ARCHITECTURE_FAMILY + 3 + IC_REQUIREMENT_CPU_INTEL_ARCHITECTURE_TYPE + 0 + IC_REQUIREMENT_CPU_MINIMUM_CPU_CORES_COUNT + 1 + IC_REQUIREMENT_CPU_MINIMUM_FREQUENCY + 866666 + IC_REQUIREMENT_CPU_POWERPC_ARCHITECTURE_TYPE + 0 + + IC_REQUIREMENT_CHECK_TYPE + 0 + IDENTIFIER + fr.whitebox.Packages.requirement.cpu + MESSAGE + + + LANGUAGE + English + SECONDARY_VALUE + + VALUE + This installer has been built for Apple Silicon architecture. It won't install in other platforms. + + + + NAME + Processor + STATE + + + + BEHAVIOR + 3 + DICTIONARY + + IC_REQUIREMENT_OS_DISK_TYPE + 0 + IC_REQUIREMENT_OS_DISTRIBUTION_TYPE + 0 + IC_REQUIREMENT_OS_MINIMUM_VERSION + 100800 + + IC_REQUIREMENT_CHECK_TYPE + 1 + IDENTIFIER + fr.whitebox.Packages.requirement.os + MESSAGE + + NAME + Operating System + STATE + + + + RESOURCES + + ROOT_VOLUME_ONLY + + + PROJECT_SETTINGS + + BUILD_FORMAT + 0 + BUILD_PATH + + PATH + build + PATH_TYPE + 1 + + EXCLUDED_FILES + + + PATTERNS_ARRAY + + + REGULAR_EXPRESSION + + STRING + .DS_Store + TYPE + 0 + + + PROTECTED + + PROXY_NAME + Remove .DS_Store files + PROXY_TOOLTIP + Remove ".DS_Store" files created by the Finder. + STATE + + + + PATTERNS_ARRAY + + + REGULAR_EXPRESSION + + STRING + .pbdevelopment + TYPE + 0 + + + PROTECTED + + PROXY_NAME + Remove .pbdevelopment files + PROXY_TOOLTIP + Remove ".pbdevelopment" files created by ProjectBuilder or Xcode. + STATE + + + + PATTERNS_ARRAY + + + REGULAR_EXPRESSION + + STRING + CVS + TYPE + 1 + + + REGULAR_EXPRESSION + + STRING + .cvsignore + TYPE + 0 + + + REGULAR_EXPRESSION + + STRING + .cvspass + TYPE + 0 + + + REGULAR_EXPRESSION + + STRING + .svn + TYPE + 1 + + + REGULAR_EXPRESSION + + STRING + .git + TYPE + 1 + + + REGULAR_EXPRESSION + + STRING + .gitignore + TYPE + 0 + + + PROTECTED + + PROXY_NAME + Remove SCM metadata + PROXY_TOOLTIP + Remove helper files and folders used by the CVS, SVN or Git Source Code Management systems. + STATE + + + + PATTERNS_ARRAY + + + REGULAR_EXPRESSION + + STRING + classes.nib + TYPE + 0 + + + REGULAR_EXPRESSION + + STRING + designable.db + TYPE + 0 + + + REGULAR_EXPRESSION + + STRING + info.nib + TYPE + 0 + + + PROTECTED + + PROXY_NAME + Optimize nib files + PROXY_TOOLTIP + Remove "classes.nib", "info.nib" and "designable.nib" files within .nib bundles. + STATE + + + + PATTERNS_ARRAY + + + REGULAR_EXPRESSION + + STRING + Resources Disabled + TYPE + 1 + + + PROTECTED + + PROXY_NAME + Remove Resources Disabled folders + PROXY_TOOLTIP + Remove "Resources Disabled" folders. + STATE + + + + SEPARATOR + + + + NAME + wazuh-agent-4.5.1-1.arm64 + PAYLOAD_ONLY + + TREAT_MISSING_PRESENTATION_DOCUMENTS_AS_WARNING + + + + TYPE + 0 + VERSION + 2 + + diff --git a/macos/specs/wazuh-agent.pkgproj b/macos/specs/wazuh-agent-intel64.pkgproj similarity index 99% rename from macos/specs/wazuh-agent.pkgproj rename to macos/specs/wazuh-agent-intel64.pkgproj index f7e4169d10..5de6f6053a 100644 --- a/macos/specs/wazuh-agent.pkgproj +++ b/macos/specs/wazuh-agent-intel64.pkgproj @@ -1239,7 +1239,7 @@ NAME - wazuh-agent-4.5.1-1 + wazuh-agent-4.5.1-1.intel64 PAYLOAD_ONLY TREAT_MISSING_PRESENTATION_DOCUMENTS_AS_WARNING