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

Merge 4.3 changes into 5.0-dev #983

Open
wants to merge 1 commit into
base: 5.0-dev
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ova/Config_files/filebeat.yml
*.key
*.csr
*.srl
*.pkg.tar.zst
wpk/versions
solaris/packer/builds/
solaris/packer/packer-solaris11_3-virtualbox/
Expand Down
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,41 @@
# Change Log
All notable changes to this project will be documented in this file.


## [v4.3.0]

- Update SPECS [#689](https://github.com/wazuh/wazuh-packages/pull/689)
- Fix `find` error in CentOS 5 building [#888](https://github.com/wazuh/wazuh-packages/pull/888)
- Add new SCA files to Solaris 11 [#944](https://github.com/wazuh/wazuh-packages/pull/944)

## [v4.2.2]

- Update SPECS [#846](https://github.com/wazuh/wazuh-packages/pull/846)

## [v4.2.1]

- Update SPECS [#833](https://github.com/wazuh/wazuh-packages/pull/833)

## [v4.2.0]

- Update SPECS [#556](https://github.com/wazuh/wazuh-packages/pull/556)

## [v4.1.5]

- Update SPECS [#726](https://github.com/wazuh/wazuh-packages/pull/726)

## [v4.1.4]

- Update SPECS [#684](https://github.com/wazuh/wazuh-packages/pull/684)

## [v4.1.3]

- Update SPECS [#668](https://github.com/wazuh/wazuh-packages/pull/668)

## [v4.1.2]

- Update SPECS [#656](https://github.com/wazuh/wazuh-packages/pull/656)

## [v4.1.1]

- Updated Wazuh app build script [#648](https://github.com/wazuh/wazuh-packages/pull/648)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ Wazuh packages

Wazuh is an Open Source Host-based Intrusion Detection System that performs log analysis, file integrity monitoring, policy monitoring, rootkit detection, real-time alerting, active response, vulnerability detector, etc.

In this repository, you can find the necessary tools to build a Wazuh package for Debian based OS, RPM based OS package, macOS, RPM packages for IBM AIX, the OVA, and the apps for Kibana and Splunk:
In this repository, you can find the necessary tools to build a Wazuh package for Debian based OS, RPM based OS package, Arch based OS, macOS, RPM packages for IBM AIX, the OVA, and the apps for Kibana and Splunk:

- [AIX](/aix/README.md)
- [Arch](/arch/README.md)
- [Debian](/debs/README.md)
- [HP-UX](/hp-ux/README.md)
- [KibanaApp](/wazuhapp/README.md)
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.0.0
1 change: 1 addition & 0 deletions aix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Please, visit the following link for the full AIX packages building documentatio

## More Packages

- [Arch](/arch/README.md)
- [Debian](/debs/README.md)
- [HP-UX](/hp-ux/README.md)
- [KibanaApp](/wazuhapp/README.md)
Expand Down
73 changes: 37 additions & 36 deletions aix/SPECS/5.0.0/wazuh-agent-5.0.0-aix.spec
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,38 @@ if [ $1 = 1 ]; then
fi

if [ $1 = 2 ]; then
if %{_localstatedir}/bin/wazuh-control status 2>/dev/null | grep "is running" > /dev/null 2>&1; then
if /etc/rc.d/init.d/wazuh-agent status 2>/dev/null | grep "is running" > /dev/null 2>&1; then
/etc/rc.d/init.d/wazuh-agent stop > /dev/null 2>&1 || :
touch %{_localstatedir}/tmp/wazuh.restart
fi
%{_localstatedir}/bin/ossec-control stop > /dev/null 2>&1 || %{_localstatedir}/bin/wazuh-control stop > /dev/null 2>&1
fi

%post
if [ $1 = 2 ]; then
if [ -d %{_localstatedir}/logs/ossec ]; then
rm -rf %{_localstatedir}/logs/wazuh
cp -rp %{_localstatedir}/logs/ossec %{_localstatedir}/logs/wazuh
cp -rp %{_localstatedir}/logs/ossec %{_localstatedir}/tmp/logs/wazuh > /dev/null 2>&1
rm -rf %{_localstatedir}/logs/ossec/*
rm -rf %{_localstatedir}/logs/ossec/.??*
fi

if [ -d %{_localstatedir}/queue/ossec ]; then
cp -rp %{_localstatedir}/queue/ossec %{_localstatedir}/tmp/queue/sockets > /dev/null 2>&1
rm -rf %{_localstatedir}/queue/ossec/*
rm -rf %{_localstatedir}/queue/ossec/.??*
fi
fi

%post

if [ $1 = 2 ]; then
if [ -d %{_localstatedir}/tmp/logs/wazuh ]; then
rm -rf %{_localstatedir}/logs/wazuh
mv %{_localstatedir}/tmp/logs/ossec %{_localstatedir}/logs/wazuh> /dev/null 2>&1
fi

if [ -d %{_localstatedir}/tmp/queue/sockets ]; then
rm -rf %{_localstatedir}/queue/sockets
cp -rp %{_localstatedir}/queue/ossec %{_localstatedir}/queue/sockets
mv %{_localstatedir}/tmp/queue/ossec %{_localstatedir}/queue/sockets > /dev/null 2>&1
fi
fi

Expand Down Expand Up @@ -160,17 +175,6 @@ rm -f %{_localstatedir}/tmp/add_localfiles.sh

chmod 0660 %{_localstatedir}/etc/agent.conf

# Restart wazuh-agent when manager settings are in place
if grep '<server-ip>.*</server-ip>' %{_localstatedir}/etc/agent.conf | grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$' > /dev/null 2>&1; then
/etc/rc.d/init.d/wazuh-agent restart > /dev/null 2>&1 || :
fi
if grep '<server-hostname>.*</server-hostname>' %{_localstatedir}/etc/agent.conf > /dev/null 2>&1; then
/etc/rc.d/init.d/wazuh-agent restart > /dev/null 2>&1 || :
fi
if grep '<address>.*</address>' %{_localstatedir}/etc/agent.conf | grep -v 'MANAGER_IP' > /dev/null 2>&1; then
/etc/rc.d/init.d/wazuh-agent restart > /dev/null 2>&1 || :
fi

# Remove old ossec user and group if exists and change ownwership of files

if grep "^ossec:" /etc/group > /dev/null 2>&1; then
Expand All @@ -190,6 +194,11 @@ if grep "^ossec:" /etc/group > /dev/null 2>&1; then
rmgroup ossec
fi

if [ -f %{_localstatedir}/tmp/wazuh.restart ]; then
rm -f %{_localstatedir}/tmp/wazuh.restart
/etc/rc.d/init.d/wazuh-agent restart > /dev/null 2>&1 || :
fi

%preun

if [ $1 = 0 ]; then
Expand Down Expand Up @@ -219,20 +228,6 @@ if [ $1 = 0 ];then
rm -rf %{_localstatedir}/ruleset
fi

%posttrans
if [ -f %{_localstatedir}/tmp/wazuh.restart ]; then
rm -f %{_localstatedir}/tmp/wazuh.restart
/etc/rc.d/init.d/wazuh-agent restart > /dev/null 2>&1 || :
fi

if [ -d %{_localstatedir}/logs/ossec ]; then
rm -rf %{_localstatedir}/logs/ossec/
fi

if [ -d %{_localstatedir}/queue/ossec ]; then
rm -rf %{_localstatedir}/queue/ossec/
fi

%clean
rm -fr %{buildroot}

Expand All @@ -256,7 +251,8 @@ rm -fr %{buildroot}
%attr(640, root, wazuh) %{_localstatedir}/etc/wpk_root.pem
%dir %attr(770, root, wazuh) %{_localstatedir}/etc/shared
%attr(660, root, wazuh) %config(missingok,noreplace) %{_localstatedir}/etc/shared/*
%dir %attr(750, root,system) %{_localstatedir}/lib
%dir %attr(750, root, system) %{_localstatedir}/lib
%attr(750, root, wazuh) %{_localstatedir}/lib/*
%dir %attr(770, wazuh, wazuh) %{_localstatedir}/logs
%attr(660, wazuh, wazuh) %ghost %{_localstatedir}/logs/active-responses.log
%attr(660, root, wazuh) %ghost %{_localstatedir}/logs/wazuh.log
Expand Down Expand Up @@ -291,15 +287,20 @@ rm -fr %{buildroot}
%dir %attr(770, root, wazuh) %{_localstatedir}/var/upgrade
%dir %attr(770, root, wazuh) %{_localstatedir}/var/wodles
%dir %attr(750, root, wazuh) %{_localstatedir}/wodles
%dir %attr(750, root, wazuh) %{_localstatedir}/wodles/aws
%attr(750, root, wazuh) %{_localstatedir}/wodles/aws/*
%dir %attr(750, root, wazuh) %{_localstatedir}/wodles/gcloud
%attr(750, root, wazuh) %{_localstatedir}/wodles/gcloud/*
%attr(750, root, wazuh) %{_localstatedir}/wodles/*

%changelog
* Sat Dec 04 2021 support <info@wazuh.com> - 5.0.0
- More info: https://documentation.wazuh.com/current/release-notes/
* Wed Apr 28 2021 support <info@wazuh.com> - 4.3.0
* Thu Oct 21 2021 support <info@wazuh.com> - 4.2.4
- More info: https://documentation.wazuh.com/current/release-notes/
* Wed Oct 06 2021 support <info@wazuh.com> - 4.2.3
- More info: https://documentation.wazuh.com/current/release-notes/
* Mon Nov 01 2021 support <info@wazuh.com> - 4.3.0
- More info: https://documentation.wazuh.com/current/release-notes/
* Wed Oct 06 2021 support <info@wazuh.com> - 4.2.2
- More info: https://documentation.wazuh.com/current/release-notes/
* Sat Sep 25 2021 support <info@wazuh.com> - 4.2.1
- More info: https://documentation.wazuh.com/current/release-notes/
* Mon Apr 26 2021 support <info@wazuh.com> - 4.2.0
- More info: https://documentation.wazuh.com/current/release-notes/
Expand Down
111 changes: 13 additions & 98 deletions aix/generate_wazuh_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ reference="master"
revision="1"
target_dir="${current_path}/output/"
compute_checksums="no"
build_chroot="no"
chroot_path="/usr/pkg"
checksum_dir=""

# Check if running as root
Expand All @@ -42,56 +40,12 @@ show_help() {
echo " -s, --store <path> Directory to store the resulting RPM package. By default: ${target_dir}"
echo " -p, --install-path <path> Installation path for the package. By default: ${install_path}"
echo " -c, --checksum <path> Compute the SHA512 checksum of the RPM package."
echo " --chroot Create a chroot jail to build the package in ${chroot_path}."
echo " -h, --help Shows this help"
echo
exit $1
}

build_chroot() {
# Preparing chroot environment
mkdir -p ${chroot_path}/aix
mkdir -p ${chroot_path}/bin
mkdir -p ${chroot_path}/dev
mkdir -p ${chroot_path}/etc
mkdir -p ${chroot_path}/lib
mkdir -p ${chroot_path}/opt/freeware
mkdir -p ${chroot_path}/proc
mkdir -p ${chroot_path}/sbin
mkdir -p ${chroot_path}/tmp
mkdir -p ${chroot_path}/usr
mkdir -p ${chroot_path}/var
mkdir -p ${chroot_path}/usr/bin
mkdir -p ${chroot_path}/usr/ccs
mkdir -p ${chroot_path}/usr/custom
mkdir -p ${chroot_path}/usr/include
mkdir -p ${chroot_path}/usr/lib64
mkdir -p ${chroot_path}/usr/local
mkdir -p ${chroot_path}/usr/sbin
mkdir -p ${chroot_path}/usr/tmp

cp -R ${current_path}/* ${chroot_path}/aix/
cp -R /bin/* ${chroot_path}/bin/
cp -R /dev/* ${chroot_path}/dev/
cp -R /etc/* ${chroot_path}/etc/
rsync -v -a --exclude 'nls' /lib/ ${chroot_path}/lib/
cp -R /opt/freeware/* ${chroot_path}/opt/freeware/
cp -R /sbin/* ${chroot_path}/sbin/
cp -R /usr/bin ${chroot_path}/usr/
cp -R /usr/ccs ${chroot_path}/usr/
cp -R /usr/custom ${chroot_path}/usr/
cp -R /usr/include ${chroot_path}/usr/
cp -R /usr/lib64 ${chroot_path}/usr/
cp -R /usr/lib64 ${chroot_path}/usr/
cp -R /usr/local ${chroot_path}/usr/
cp -R /usr/sbin ${chroot_path}/usr/
cp -R /usr/tmp ${chroot_path}/usr/
rsync -v -a --exclude 'nls' /usr/lib/ ${chroot_path}/usr/lib/

chroot ${chroot_path}/ /aix/$(basename $0) -c ${checksum_dir} -p ${install_path} -b ${reference} -s ${target_dir}
}

# Function to install perl 5.10 on AIX 5
# Function to install perl 5.10 on AIX
build_perl() {

wget http://www.cpan.org/src/5.0/perl-5.10.1.tar.gz
Expand All @@ -105,29 +59,14 @@ build_perl() {
return 0
}

# Function to install libssh2 on AIX 5
build_libssh2() {
wget http://packages.wazuh.com/utils/libssh2/libssh2-1.8.2.tar.gz
gunzip libssh2-1.8.2.tar.gz && tar -xvf libssh2-1.8.2.tar
cd libssh2-1.8.2 && ./configure --prefix=/usr/custom
gmake && gmake install
cd .. && rm -rf libssh2-1.8.2*
}

build_curl() {
wget http://packages.wazuh.com/utils/curl/curl-7.72.0.tar.gz
gunzip curl-7.72.0.tar.gz && tar -xvf curl-7.72.0.tar
cd curl-7.72.0 && ./configure --with-libssh2=/usr/custom
gmake && gmake install
ln -fs /usr/local/bin/curl /bin/curl
ln -fs /usr/local/bin/curl /opt/freeware/bin/curl
cd .. && rm -rf curl-7.72.0*
}

build_cmake() {
mv /opt/freeware/lib/gcc/powerpc-ibm-aix6.1.1.0/6.3.0/include-fixed/sys/socket.h /opt/freeware/lib/gcc/powerpc-ibm-aix6.1.1.0/6.3.0/include-fixed/sys/socket.h.bkp
curl -OL http://packages.wazuh.com/utils/cmake/cmake-3.12.4.tar.gz
gtar -zxvf cmake-3.12.4.tar.gz && cd cmake-3.12.4
./bootstrap && gmake && gmake install && cd / && rm -rf cmake-3.12.4
gtar -zxf cmake-3.12.4.tar.gz && cd cmake-3.12.4
./bootstrap
sed ' 1 s/.*/&-Wl,-bbigtoc/' Source/CMakeFiles/ctest.dir/link.txt | tee Source/CMakeFiles/ctest.dir/link.txt
sed ' 1 s/.*/&-Wl,-bbigtoc/' Source/CMakeFiles/cpack.dir/link.txt | tee Source/CMakeFiles/cpack.dir/link.txt
gmake && gmake install && cd / && rm -rf cmake-3.12.4
ln -fs /usr/local/bin/cmake /usr/bin/cmake
}

Expand All @@ -138,9 +77,9 @@ build_environment() {
if grep 'www.siteox.com' /etc/motd > /dev/null 2>&1; then
for partition in "/home" "/opt"; do
partition_size=$(df -m | grep $partition | awk -F' ' '{print $2}' | cut -d'.' -f1)
if [[ ${partition_size} -lt "3000" ]]; then
echo "Resizing $partition partition to 3GB"
chfs -a size=3G $partition > /dev/null 2>&1
if [[ ${partition_size} -lt "3584" ]]; then
echo "Resizing $partition partition to 3.5GB"
chfs -a size=3584M $partition > /dev/null 2>&1
fi
done
fi
Expand Down Expand Up @@ -183,16 +122,8 @@ build_environment() {
$rpm http://www.oss4aix.org/download/RPMS/popt/popt-1.16-2.aix5.1.ppc.rpm || true
$rpm http://www.oss4aix.org/download/RPMS/rsync/rsync-3.1.3-1.aix5.1.ppc.rpm || true
$rpm http://www.oss4aix.org/download/RPMS/nano/nano-2.5.3-1.aix5.1.ppc.rpm || true

if [[ "${aix_major}" = "5" ]]; then
$rpm http://www.oss4aix.org/download/RPMS/gcc/gcc-4.8.2-1.aix5.3.ppc.rpm || true
$rpm http://www.oss4aix.org/download/RPMS/gcc/gcc-cpp-4.8.2-1.aix5.3.ppc.rpm || true
$rpm http://www.oss4aix.org/download/RPMS/gcc/libgcc-4.8.2-1.aix5.3.ppc.rpm || true
$rpm http://www.oss4aix.org/download/RPMS/gcc/libstdc++-4.8.2-1.aix5.3.ppc.rpm || true
$rpm http://www.oss4aix.org/download/RPMS/gcc/libstdc++-devel-4.8.2-1.aix5.3.ppc.rpm || true
$rpm http://www.oss4aix.org/download/RPMS/libmpc/libmpc-1.0.2-1.aix5.1.ppc.rpm || true
$rpm http://www.oss4aix.org/download/RPMS/mpfr/mpfr-3.0.0-1.aix5.1.ppc.rpm || true
fi
$rpm http://www.oss4aix.org/download/RPMS/curl/curl-7.72.0-1.aix5.1.ppc.rpm || true
$rpm http://www.oss4aix.org/download/RPMS/tar/tar-1.32-1.aix5.1.ppc.rpm || true

if [[ "${aix_major}" = "6" ]] || [[ "${aix_major}" = "7" ]]; then
$rpm http://www.oss4aix.org/download/RPMS/isl/isl-0.18-1.aix5.1.ppc.rpm || true
Expand Down Expand Up @@ -231,11 +162,7 @@ build_environment() {
$rpm http://www.oss4aix.org/download/RPMS/gcc/gcc-c++-6.3.0-1.aix7.2.ppc.rpm || true
fi

if [[ "${aix_major}" = "5" ]]; then
build_perl
build_libssh2
build_curl
fi
build_perl

if [[ "${aix_major}" = "6" ]] || [[ "${aix_major}" = "7" ]]; then
build_cmake
Expand Down Expand Up @@ -372,10 +299,6 @@ main() {
shift 1
fi
;;
"--chroot")
build_chroot="yes"
shift 1
;;
"-h"|"--help")
show_help
exit 0
Expand All @@ -393,18 +316,10 @@ main() {
checksum_dir="${target_dir}"
fi

if [[ "${build_chroot}" = "yes" ]]; then
build_chroot || exit 1
fi

if [[ "${build_rpm}" = "yes" ]]; then
build_package || exit 1
fi

if [[ "${build_chroot}" = "yes" ]]; then
rm -rf ${chroot_path} || exit 1
fi

return 0
}

Expand Down
16 changes: 16 additions & 0 deletions arch/Arch/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM archlinux:latest

# Installing necessary packages
RUN pacman --noconfirm -Syu && \
pacman --noconfirm -S \
curl gcc make sudo wget expect gnupg perl-base perl fakeroot python brotli \
automake autoconf libtool gawk libsigsegv nodejs base-devel inetutils cmake \
lsb-release

RUN useradd -ms /bin/bash user

# Add the script to build the Debian package
ADD build.sh /usr/local/bin/build_package

# Set the entrypoint
ENTRYPOINT ["/usr/local/bin/build_package"]
Loading