Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add specs files to build Wazuh 4.2.1 #833

Merged
merged 2 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Spec file for AIX systems
Name: wazuh-agent
Version: 4.2.0
Version: 4.2.1
Release: 1
License: GPL
URL: https://www.wazuh.com/
Expand Down Expand Up @@ -275,6 +275,8 @@ rm -fr %{buildroot}


%changelog
* Sat Sep 25 2021 support <[email protected]> - 4.2.1
- More info: https://documentation.wazuh.com/current/release-notes/
* Mon Apr 26 2021 support <[email protected]> - 4.2.0
- More info: https://documentation.wazuh.com/current/release-notes/
* Sat Apr 24 2021 support <[email protected]> - 3.13.3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
wazuh-agent (4.2.1-RELEASE) stable; urgency=low

* More info: https://documentation.wazuh.com/current/release-notes/

-- Wazuh, Inc <[email protected]> Sat, 25 Sep 2021 07:04:22 +0000

wazuh-agent (4.2.0-RELEASE) stable; urgency=low

* More info: https://documentation.wazuh.com/current/release-notes/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This work was packaged for Debian by:

Wazuh, Inc <[email protected]> on Fri, 10 Dec 2021 11:51:55 +0000
Wazuh, Inc <[email protected]> on Sat, 25 Sep 2021 07:04:22 +0000

It was downloaded from:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
wazuh-manager (4.2.1-RELEASE) stable; urgency=low

* More info: https://documentation.wazuh.com/current/release-notes/

-- Wazuh, Inc <[email protected]> Sat, 25 Sep 2021 07:04:22 +0000

wazuh-manager (4.2.0-RELEASE) stable; urgency=low

* More info: https://documentation.wazuh.com/current/release-notes/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This work was packaged for Debian by:

Wazuh, Inc <[email protected]> on Fri, 10 Dec 2021 11:51:55 +0000
Wazuh, Inc <[email protected]> on Sat, 25 Sep 2021 07:04:22 +0000

It was downloaded from:

Expand Down
79 changes: 79 additions & 0 deletions macos/package_files/4.2.1/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash
# Program to build OSX wazuh-agent
# Wazuh package generator
# Copyright (C) 2015-2020, Wazuh Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License (version 2) as published by the FSF - Free Software
# Foundation.
set -exf
DESTINATION_PATH=$1
SOURCES_PATH=$2
BUILD_JOBS=$3
INSTALLATION_SCRIPTS_DIR=${DESTINATION_PATH}/packages_files/agent_installation_scripts

function configure() {
echo USER_LANGUAGE="en" > ${CONFIG}
echo USER_NO_STOP="y" >> ${CONFIG}
echo USER_INSTALL_TYPE="agent" >> ${CONFIG}
echo USER_DIR="${DESTINATION_PATH}" >> ${CONFIG}
echo USER_DELETE_DIR="y" >> ${CONFIG}
echo USER_CLEANINSTALL="y" >> ${CONFIG}
echo USER_BINARYINSTALL="y" >> ${CONFIG}
echo USER_AGENT_SERVER_IP="MANAGER_IP" >> ${CONFIG}
echo USER_ENABLE_SYSCHECK="y" >> ${CONFIG}
echo USER_ENABLE_ROOTCHECK="y" >> ${CONFIG}
echo USER_ENABLE_OPENSCAP="n" >> ${CONFIG}
echo USER_ENABLE_CISCAT="n" >> ${CONFIG}
echo USER_ENABLE_ACTIVE_RESPONSE="y" >> ${CONFIG}
echo USER_CA_STORE="n" >> ${CONFIG}
}

function build() {

configure

if [ -z "${USER_BINARYINSTALL}" ]; then
make -C ${SOURCES_PATH}/src deps TARGET=agent

echo "Generating Wazuh executables"
make -j$JOBS -C ${SOURCES_PATH}/src DYLD_FORCE_FLAT_NAMESPACE=1 TARGET=agent build
fi

echo "Running install script"
${SOURCES_PATH}/install.sh

find ${DESTINATION_PATH}/ruleset/sca/ -type f -exec rm -f {} \;

# Add the auxiliar script used while installing the package
mkdir -p ${INSTALLATION_SCRIPTS_DIR}/
cp ${SOURCES_PATH}/gen_ossec.sh ${INSTALLATION_SCRIPTS_DIR}/
cp ${SOURCES_PATH}/add_localfiles.sh ${INSTALLATION_SCRIPTS_DIR}/

mkdir -p ${INSTALLATION_SCRIPTS_DIR}/src/init
mkdir -p ${INSTALLATION_SCRIPTS_DIR}/etc/templates/config/{generic,darwin}

cp -r ${SOURCES_PATH}/etc/templates/config/generic ${INSTALLATION_SCRIPTS_DIR}/etc/templates/config
cp -r ${SOURCES_PATH}/etc/templates/config/darwin ${INSTALLATION_SCRIPTS_DIR}/etc/templates/config

find ${SOURCES_PATH}/src/init/ -name *.sh -type f -exec install -m 0640 {} ${INSTALLATION_SCRIPTS_DIR}/src/init \;

mkdir -p ${INSTALLATION_SCRIPTS_DIR}/sca/generic
mkdir -p ${INSTALLATION_SCRIPTS_DIR}/sca/darwin/{15,16,17,18,20}

cp -r ${SOURCES_PATH}/ruleset/sca/darwin ${INSTALLATION_SCRIPTS_DIR}/sca
cp -r ${SOURCES_PATH}/ruleset/sca/generic ${INSTALLATION_SCRIPTS_DIR}/sca
cp ${SOURCES_PATH}/etc/templates/config/generic/sca.files ${INSTALLATION_SCRIPTS_DIR}/sca/generic/
cp ${SOURCES_PATH}/etc/templates/config/darwin/15/sca.files ${INSTALLATION_SCRIPTS_DIR}/sca/darwin/15/
cp ${SOURCES_PATH}/etc/templates/config/darwin/16/sca.files ${INSTALLATION_SCRIPTS_DIR}/sca/darwin/16/
cp ${SOURCES_PATH}/etc/templates/config/darwin/17/sca.files ${INSTALLATION_SCRIPTS_DIR}/sca/darwin/17/
cp ${SOURCES_PATH}/etc/templates/config/darwin/18/sca.files ${INSTALLATION_SCRIPTS_DIR}/sca/darwin/18/
cp ${SOURCES_PATH}/etc/templates/config/darwin/19/sca.files ${INSTALLATION_SCRIPTS_DIR}/sca/darwin/19/
cp ${SOURCES_PATH}/etc/templates/config/darwin/20/sca.files ${INSTALLATION_SCRIPTS_DIR}/sca/darwin/20/

cp ${SOURCES_PATH}/src/VERSION ${INSTALLATION_SCRIPTS_DIR}/src/
cp ${SOURCES_PATH}/src/REVISION ${INSTALLATION_SCRIPTS_DIR}/src/
}

build
124 changes: 124 additions & 0 deletions macos/package_files/4.2.1/postinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#! /bin/bash
# By Spransy, Derek" <DSPRANS () emory ! edu> and Charlie Scott
# Modified by Santiago Bassett (http://www.wazuh.com) - Feb 2016
# alterations by bil hays 2013
# -Switched to bash
# -Added some sanity checks
# -Added routine to find the first 3 contiguous UIDs above 100,
# starting at 600 puts this in user space
# -Added lines to append the ossec users to the group ossec
# so the the list GroupMembership works properly
GROUP="ossec"
USER="ossec"
DIR="/Library/Ossec"
INSTALLATION_SCRIPTS_DIR="${DIR}/packages_files/agent_installation_scripts"
SCA_BASE_DIR="${INSTALLATION_SCRIPTS_DIR}/sca"

if [ $(launchctl getenv WAZUH_PKG_UPGRADE) = true ]; then
rm -rf ${DIR}/etc/{ossec.conf,client.keys,local_internal_options.conf,shared}
cp -rf ${DIR}/config_files/{ossec.conf,client.keys,local_internal_options.conf,shared} ${DIR}/etc/
rm -rf ${DIR}/config_files/
fi

# Default for all directories
chmod -R 750 ${DIR}/
chown -R root:${GROUP} ${DIR}/

chown -R root:wheel ${DIR}/bin
chown -R root:wheel ${DIR}/lib

# To the ossec queue (default for agentd to read)
chown -R ${USER}:${GROUP} ${DIR}/queue/{alerts,diff,sockets,rids}

chmod -R 770 ${DIR}/queue/{alerts,sockets}
chmod -R 750 ${DIR}/queue/{diff,sockets,rids}

# For the logging user
chmod 770 ${DIR}/logs
chown -R ${USER}:${GROUP} ${DIR}/logs
find ${DIR}/logs/ -type d -exec chmod 750 {} \;
find ${DIR}/logs/ -type f -exec chmod 660 {} \;

chown -R root:${GROUP} ${DIR}/tmp
chmod 1750 ${DIR}/tmp

chmod 770 ${DIR}/etc
chown ${USER}:${GROUP} ${DIR}/etc
chmod 640 ${DIR}/etc/internal_options.conf
chown root:${GROUP} ${DIR}/etc/internal_options.conf
chmod 640 ${DIR}/etc/local_internal_options.conf
chown root:${GROUP} ${DIR}/etc/local_internal_options.conf
chmod 640 ${DIR}/etc/client.keys
chown root:${GROUP} ${DIR}/etc/client.keys
chmod 640 ${DIR}/etc/localtime
chmod 770 ${DIR}/etc/shared # ossec must be able to write to it
chown -R root:${GROUP} ${DIR}/etc/shared
find ${DIR}/etc/shared/ -type f -exec chmod 660 {} \;
chown root:${GROUP} ${DIR}/etc/ossec.conf
chmod 660 ${DIR}/etc/ossec.conf


chmod 770 ${DIR}/.ssh

# For the /var/run
chmod -R 770 ${DIR}/var
chown -R root:${GROUP} ${DIR}/var

. ${INSTALLATION_SCRIPTS_DIR}/src/init/dist-detect.sh

upgrade=$(launchctl getenv WAZUH_PKG_UPGRADE)
restart=$(launchctl getenv WAZUH_RESTART)

launchctl unsetenv WAZUH_PKG_UPGRADE
launchctl unsetenv WAZUH_RESTART

if [ "${upgrade}" = "false" ]; then
${INSTALLATION_SCRIPTS_DIR}/gen_ossec.sh conf agent ${DIST_NAME} ${DIST_VER}.${DIST_SUBVER} ${DIR} > ${DIR}/etc/ossec.conf
chown root:ossec ${DIR}/etc/ossec.conf
chmod 0640 ${DIR}/etc/ossec.conf
fi

SCA_DIR="${DIST_NAME}/${DIST_VER}"
mkdir -p ${DIR}/ruleset/sca

SCA_TMP_DIR="${SCA_BASE_DIR}/${SCA_DIR}"

# Install the configuration files needed for this hosts
if [ -r "${SCA_BASE_DIR}/${DIST_NAME}/${DIST_VER}/${DIST_SUBVER}/sca.files" ]; then
SCA_TMP_DIR="${SCA_BASE_DIR}/${DIST_NAME}/${DIST_VER}/${DIST_SUBVER}"
elif [ -r "${SCA_BASE_DIR}/${DIST_NAME}/${DIST_VER}/sca.files" ]; then
SCA_TMP_DIR="${SCA_BASE_DIR}/${DIST_NAME}/${DIST_VER}"
elif [ -r "${SCA_BASE_DIR}/${DIST_NAME}/sca.files" ]; then
SCA_TMP_DIR="${SCA_BASE_DIR}/${DIST_NAME}"
else
SCA_TMP_DIR="${SCA_BASE_DIR}/generic"
fi

SCA_TMP_FILE="${SCA_TMP_DIR}/sca.files"

if [ -r ${SCA_TMP_FILE} ]; then

rm -f ${DIR}/ruleset/sca/* || true

for sca_file in $(cat ${SCA_TMP_FILE}); do
mv ${SCA_BASE_DIR}/${sca_file} ${DIR}/ruleset/sca
done
fi

# Register and configure agent if Wazuh environment variables are defined
${INSTALLATION_SCRIPTS_DIR}/src/init/register_configure_agent.sh ${DIR} > /dev/null || :

# Install the service
${INSTALLATION_SCRIPTS_DIR}/src/init/darwin-init.sh ${DIR}

# Remove temporary directory
rm -rf ${DIR}/packages_files

# Remove 4.1.5 patch
if [ -f ${DIR}/queue/alerts/sockets ]; then
rm ${DIR}/queue/alerts/sockets
fi

if ${upgrade} && ${restart}; then
${DIR}/bin/wazuh-control restart
fi
Loading