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.7.0 into 4.7.1 #1035

Merged
merged 44 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
be19c70
remove goss install
vcerenu Sep 14, 2023
e9f689d
remove goss directory
vcerenu Sep 14, 2023
d1c252c
Merge pull request #996 from wazuh/979-remove-goss-from-manager-image
teddytpc1 Sep 14, 2023
2ac53b9
add custom directory and persistence
vcerenu Sep 15, 2023
37f565b
add custom directory and persistence
vcerenu Sep 15, 2023
0fbbf5a
add shuffle scripts into permanent data
vcerenu Sep 15, 2023
41515e9
Merge pull request #998 from wazuh/258-shuffle-permanent-data
teddytpc1 Sep 15, 2023
088b855
Merge pull request #997 from wazuh/990-persist-logo
teddytpc1 Sep 18, 2023
62627e3
Merge remote-tracking branch 'origin/4.5.3' into merge-4.5.3-into-4.6.0
davidcr01 Sep 22, 2023
d6b73cb
Merge pull request #1008 from wazuh/merge-4.5.3-into-4.6.0
teddytpc1 Sep 22, 2023
7d5b1c4
Revision Bump
teddytpc1 Sep 22, 2023
958e466
Merge pull request #1013 from wazuh/bump-4.6.0-revision
teddytpc1 Sep 22, 2023
5f3a048
Bump revision to 40507
davidcr01 Sep 28, 2023
93c53a7
Merge pull request #1021 from wazuh/change/1020-bump-revision-4.5.3-rc2
teddytpc1 Sep 28, 2023
d5dc67e
Fixing Wazuh indexer files permissions
c-bordon Sep 28, 2023
d9b053c
Testing with another dir for opensearch security policy
c-bordon Sep 28, 2023
8fa20ab
Fixed sed command
c-bordon Sep 28, 2023
23d34f6
Fixed OpenSearch security plugin warnings
c-bordon Oct 2, 2023
905b4de
Testing change permissions in entrypoint
c-bordon Oct 2, 2023
c3c8ea3
Changing files permissions
c-bordon Oct 3, 2023
b22fa23
Updated build image script
c-bordon Oct 3, 2023
3fd3f42
Added check for wazuh/wazuh branch
c-bordon Oct 3, 2023
36c06dc
Added validation for dev branch
c-bordon Oct 3, 2023
545ef68
Fixed validation
c-bordon Oct 3, 2023
e205c87
.env file updated
c-bordon Oct 4, 2023
a2ee29b
Updated file permissions to have the same permissions as in package i…
c-bordon Oct 4, 2023
7172c81
Update order of variables
c-bordon Oct 4, 2023
d6a72c6
Merge pull request #1024 from wazuh/bug/1017-warning-opensearchsecuri…
teddytpc1 Oct 4, 2023
893796c
Restore .env file
c-bordon Oct 4, 2023
8ac3ea1
Added final space
c-bordon Oct 4, 2023
1b41068
Updated README file
c-bordon Oct 4, 2023
c550c1a
Added validation for version in master branch
c-bordon Oct 4, 2023
9d3701f
Merge pull request #1025 from wazuh/enhancement/1016-allow-branch-par…
teddytpc1 Oct 4, 2023
61bfe58
Changed validation order for wazuh branch
c-bordon Oct 4, 2023
b4db7f1
Merge pull request #1026 from wazuh/bug/change-validation-order-for-w…
teddytpc1 Oct 4, 2023
d7e051a
Bump 4.5.3 revision
teddytpc1 Oct 5, 2023
ded91b2
Merge pull request #1029 from wazuh/bump-4.5.3-revision
teddytpc1 Oct 5, 2023
8d1c239
Merge branch '4.5.3' into merge-4.5.3-into-4.6.0
davidcr01 Oct 6, 2023
fa2f2b2
Merge pull request #1031 from wazuh/merge-4.5.3-into-4.6.0
davidcr01 Oct 6, 2023
64f0836
Bump revision to 40602
davidcr01 Oct 6, 2023
89e0fc9
Merge pull request #1033 from wazuh/bump-revision-4.6.0
teddytpc1 Oct 6, 2023
14dcc8b
Merge 4.6.0 into 4.7.0
davidcr01 Oct 9, 2023
c18a1ec
Merge pull request #1034 from wazuh/merge-4.6.0-into-4.7.0
vcerenu Oct 9, 2023
25be906
Merge branch '4.7.0' into merge-4.7.0-into-4.7.1
davidcr01 Oct 9, 2023
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
21 changes: 21 additions & 0 deletions build-docker-images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,24 @@ $ build-docker-images/build-images.sh
```

This script initializes the environment variables needed to build each of the images.

The script allows you to build images from other versions of Wazuh, to do this you must use the -v or --version argument:

```
$ build-docker-images/build-images.sh -v 4.5.2
```

To get all the available script options use the -h or --help option:

```
$ build-docker-images/build-images.sh -h

Usage: build-docker-images/build-images.sh [OPTIONS]

-d, --dev <ref> [Optional] Set the development stage you want to build, example rc1 or beta1, not used by default.
-f, --filebeat-module <ref> [Optional] Set Filebeat module version. By default 0.2.
-r, --revision <rev> [Optional] Package revision. By default 1
-v, --version <ver> [Optional] Set the Wazuh version should be builded. By default, 4.6.0.
-h, --help Show this help.

```
141 changes: 137 additions & 4 deletions build-docker-images/build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,141 @@ WAZUH_TAG_REVISION=1
WAZUH_CURRENT_VERSION=$(curl --silent https://api.github.com/repos/wazuh/wazuh/releases/latest | grep '\"tag_name\":' | sed -E 's/.*\"([^\"]+)\".*/\1/' | cut -c 2- | sed -e 's/\.//g')
IMAGE_VERSION=${WAZUH_IMAGE_VERSION}

echo WAZUH_VERSION=$WAZUH_IMAGE_VERSION > .env
echo WAZUH_IMAGE_VERSION=$IMAGE_VERSION >> .env
echo WAZUH_TAG_REVISION=$WAZUH_TAG_REVISION >> .env
# Wazuh package generator
# Copyright (C) 2023, 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.

docker-compose -f build-docker-images/build-images.yml --env-file .env build --no-cache
WAZUH_IMAGE_VERSION="4.6.0"
WAZUH_TAG_REVISION="1"
WAZUH_DEV_STAGE=""
FILEBEAT_MODULE_VERSION="0.2"

# -----------------------------------------------------------------------------

trap ctrl_c INT

clean() {
exit_code=$1

exit ${exit_code}
}

ctrl_c() {
clean 1
}

# -----------------------------------------------------------------------------


build() {

WAZUH_VERSION="$(echo $WAZUH_IMAGE_VERSION | sed -e 's/\.//g')"
FILEBEAT_TEMPLATE_BRANCH="${WAZUH_IMAGE_VERSION}"
WAZUH_FILEBEAT_MODULE="wazuh-filebeat-${FILEBEAT_MODULE_VERSION}.tar.gz"
WAZUH_UI_REVISION="${WAZUH_TAG_REVISION}"

if [ "${WAZUH_DEV_STAGE}" ];then
FILEBEAT_TEMPLATE_BRANCH="v${FILEBEAT_TEMPLATE_BRANCH}-${WAZUH_DEV_STAGE,,}"
if ! curl --output /dev/null --silent --head --fail "https://github.com/wazuh/wazuh/tree/${FILEBEAT_TEMPLATE_BRANCH}"; then
echo "The indicated branch does not exist in the wazuh/wazuh repository: ${FILEBEAT_TEMPLATE_BRANCH}"
clean 1
fi
else
if curl --output /dev/null --silent --head --fail "https://github.com/wazuh/wazuh/tree/v${FILEBEAT_TEMPLATE_BRANCH}"; then
FILEBEAT_TEMPLATE_BRANCH="v${FILEBEAT_TEMPLATE_BRANCH}"
elif curl --output /dev/null --silent --head --fail "https://github.com/wazuh/wazuh/tree/${FILEBEAT_TEMPLATE_BRANCH}"; then
FILEBEAT_TEMPLATE_BRANCH="${FILEBEAT_TEMPLATE_BRANCH}"
else
WAZUH_MASTER_VERSION="$(curl -s https://raw.githubusercontent.com/wazuh/wazuh/master/src/VERSION | sed -e 's/v//g')"
if [ "${FILEBEAT_TEMPLATE_BRANCH}" == "${WAZUH_MASTER_VERSION}" ]; then
FILEBEAT_TEMPLATE_BRANCH="master"
else
echo "The indicated branch does not exist in the wazuh/wazuh repository: ${FILEBEAT_TEMPLATE_BRANCH}"
clean 1
fi
fi
fi

echo WAZUH_VERSION=$WAZUH_IMAGE_VERSION > .env
echo WAZUH_IMAGE_VERSION=$WAZUH_IMAGE_VERSION >> .env
echo WAZUH_TAG_REVISION=$WAZUH_TAG_REVISION >> .env
echo FILEBEAT_TEMPLATE_BRANCH=$FILEBEAT_TEMPLATE_BRANCH >> .env
echo WAZUH_FILEBEAT_MODULE=$WAZUH_FILEBEAT_MODULE >> .env
echo WAZUH_UI_REVISION=$WAZUH_UI_REVISION >> .env

docker-compose -f build-docker-images/build-images.yml --env-file .env build --no-cache

return 0
}

# -----------------------------------------------------------------------------

help() {
echo
echo "Usage: $0 [OPTIONS]"
echo
echo " -d, --dev <ref> [Optional] Set the development stage you want to build, example rc1 or beta1, not used by default."
echo " -f, --filebeat-module <ref> [Optional] Set Filebeat module version. By default ${FILEBEAT_MODULE_VERSION}."
echo " -r, --revision <rev> [Optional] Package revision. By default ${WAZUH_TAG_REVISION}"
echo " -v, --version <ver> [Optional] Set the Wazuh version should be builded. By default, ${WAZUH_IMAGE_VERSION}."
echo " -h, --help Show this help."
echo
exit $1
}

# -----------------------------------------------------------------------------

main() {
while [ -n "${1}" ]
do
case "${1}" in
"-h"|"--help")
help 0
;;
"-d"|"--dev")
if [ -n "${2}" ]; then
WAZUH_DEV_STAGE="${2}"
shift 2
else
help 1
fi
;;
"-f"|"--filebeat-module")
if [ -n "${2}" ]; then
FILEBEAT_MODULE_VERSION="${2}"
shift 2
else
help 1
fi
;;
"-r"|"--revision")
if [ -n "${2}" ]; then
WAZUH_TAG_REVISION="${2}"
shift 2
else
help 1
fi
;;
"-v"|"--version")
if [ -n "$2" ]; then
WAZUH_IMAGE_VERSION="$2"
shift 2
else
help 1
fi
;;
*)
help 1
esac
done

build || clean 1

clean 0
}

main "$@"
3 changes: 3 additions & 0 deletions build-docker-images/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ services:
args:
WAZUH_VERSION: ${WAZUH_VERSION}
WAZUH_TAG_REVISION: ${WAZUH_TAG_REVISION}
FILEBEAT_TEMPLATE_BRANCH: ${FILEBEAT_TEMPLATE_BRANCH}
WAZUH_FILEBEAT_MODULE: ${WAZUH_FILEBEAT_MODULE}
image: wazuh/wazuh-manager:${WAZUH_IMAGE_VERSION}
hostname: wazuh.manager
restart: always
Expand Down Expand Up @@ -61,6 +63,7 @@ services:
args:
WAZUH_VERSION: ${WAZUH_VERSION}
WAZUH_TAG_REVISION: ${WAZUH_TAG_REVISION}
WAZUH_UI_REVISION: ${WAZUH_UI_REVISION}
image: wazuh/wazuh-dashboard:${WAZUH_IMAGE_VERSION}
hostname: wazuh.dashboard
restart: always
Expand Down
6 changes: 5 additions & 1 deletion build-docker-images/wazuh-dashboard/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM ubuntu:focal AS builder
ARG WAZUH_VERSION
ARG WAZUH_TAG_REVISION
ARG INSTALL_DIR=/usr/share/wazuh-dashboard
ARG WAZUH_UI_REVISION=1
ARG WAZUH_UI_REVISION

# Update and install dependencies
RUN apt-get update && apt install curl libcap2-bin xz-utils -y
Expand Down Expand Up @@ -104,6 +104,10 @@ RUN chown 1000:1000 /*.sh
# Copy Install dir from builder to current image
COPY --from=builder --chown=1000:1000 $INSTALL_DIR $INSTALL_DIR

# Create custom directory
RUN mkdir -p /usr/share/wazuh-dashboard/plugins/wazuh/public/assets/custom
RUN chown 1000:1000 /usr/share/wazuh-dashboard/plugins/wazuh/public/assets/custom

# Set workdir and user
WORKDIR $INSTALL_DIR
USER wazuh-dashboard
Expand Down
10 changes: 9 additions & 1 deletion build-docker-images/wazuh-indexer/config/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ cp -pr /wazuh-certificates/admin-key.pem ${TARGET_DIR}${CONFIG_DIR}/certs/admin-
# Delete xms and xmx parameters in jvm.options
sed '/-Xms/d' -i ${TARGET_DIR}${CONFIG_DIR}/jvm.options
sed '/-Xmx/d' -i ${TARGET_DIR}${CONFIG_DIR}/jvm.options
sed -i 's/-Djava.security.policy=file:\/\/\/etc\/wazuh-indexer\/opensearch-performance-analyzer\/opensearch_security.policy/-Djava.security.policy=file:\/\/\/usr\/share\/wazuh-indexer\/opensearch-performance-analyzer\/opensearch_security.policy/g' ${TARGET_DIR}${CONFIG_DIR}/jvm.options


chmod -R 500 ${TARGET_DIR}${CONFIG_DIR}/certs
chmod -R 400 ${TARGET_DIR}${CONFIG_DIR}/certs/*
chmod -R 400 ${TARGET_DIR}${CONFIG_DIR}/certs/*

find ${TARGET_DIR} -type d -exec chmod 750 {} \;
find ${TARGET_DIR} -type f -perm 644 -exec chmod 640 {} \;
find ${TARGET_DIR} -type f -perm 664 -exec chmod 660 {} \;
find ${TARGET_DIR} -type f -perm 755 -exec chmod 750 {} \;
find ${TARGET_DIR} -type f -perm 744 -exec chmod 740 {} \;
6 changes: 2 additions & 4 deletions build-docker-images/wazuh-manager/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG WAZUH_TAG_REVISION
ARG TEMPLATE_VERSION=v4.7.1
ARG FILEBEAT_CHANNEL=filebeat-oss
ARG FILEBEAT_VERSION=7.10.2
ARG WAZUH_FILEBEAT_MODULE="wazuh-filebeat-0.2.tar.gz"
ARG WAZUH_FILEBEAT_MODULE

RUN apt-get update && apt install curl apt-transport-https lsb-release gnupg -y

Expand All @@ -24,8 +24,6 @@ RUN curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/${FILEBEAT_
dpkg -i ${FILEBEAT_CHANNEL}-${FILEBEAT_VERSION}-amd64.deb && rm -f ${FILEBEAT_CHANNEL}-${FILEBEAT_VERSION}-amd64.deb && \
curl -s https://packages.wazuh.com/4.x/filebeat/${WAZUH_FILEBEAT_MODULE} | tar -xvz -C /usr/share/filebeat/module

RUN curl -L https://github.com/aelsabbahy/goss/releases/latest/download/goss-linux-amd64 -o /usr/local/bin/goss && chmod +rx /usr/local/bin/goss

ARG S6_VERSION="v2.2.0.3"
RUN curl --fail --silent -L https://github.com/just-containers/s6-overlay/releases/download/${S6_VERSION}/s6-overlay-amd64.tar.gz \
-o /tmp/s6-overlay-amd64.tar.gz && \
Expand All @@ -40,7 +38,7 @@ COPY config/filebeat.yml /etc/filebeat/

RUN chmod go-w /etc/filebeat/filebeat.yml

ADD https://raw.githubusercontent.com/wazuh/wazuh/$TEMPLATE_VERSION/extensions/elasticsearch/7.x/wazuh-template.json /etc/filebeat
ADD https://raw.githubusercontent.com/wazuh/wazuh/$FILEBEAT_TEMPLATE_BRANCH/extensions/elasticsearch/7.x/wazuh-template.json /etc/filebeat
RUN chmod go-w /etc/filebeat/wazuh-template.json

# Prepare permanent data
Expand Down
2 changes: 2 additions & 0 deletions build-docker-images/wazuh-manager/config/permanent_data.env
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ PERMANENT_DATA_EXCP[((i++))]="/var/ossec/integrations/slack"
PERMANENT_DATA_EXCP[((i++))]="/var/ossec/integrations/slack.py"
PERMANENT_DATA_EXCP[((i++))]="/var/ossec/integrations/virustotal"
PERMANENT_DATA_EXCP[((i++))]="/var/ossec/integrations/virustotal.py"
PERMANENT_DATA_EXCP[((i++))]="/var/ossec/integrations/shuffle"
PERMANENT_DATA_EXCP[((i++))]="/var/ossec/integrations/shuffle.py"
PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/default-firewall-drop"
PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/disable-account"
PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/firewalld-drop"
Expand Down
4 changes: 3 additions & 1 deletion multi-node/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,9 @@ services:
- ./config/wazuh_indexer_ssl_certs/wazuh.dashboard-key.pem:/usr/share/wazuh-dashboard/certs/wazuh-dashboard-key.pem
- ./config/wazuh_indexer_ssl_certs/root-ca.pem:/usr/share/wazuh-dashboard/certs/root-ca.pem
- ./config/wazuh_dashboard/opensearch_dashboards.yml:/usr/share/wazuh-dashboard/config/opensearch_dashboards.yml
- wazuh-dashboard-config:/usr/share/wazuh-dashboard/data/wazuh/config
- ./config/wazuh_dashboard/wazuh.yml:/usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml
- wazuh-dashboard-config:/usr/share/wazuh-dashboard/data/wazuh/config
- wazuh-dashboard-custom:/usr/share/wazuh-dashboard/plugins/wazuh/public/assets/custom
depends_on:
- wazuh1.indexer
links:
Expand Down Expand Up @@ -220,3 +221,4 @@ volumes:
wazuh-indexer-data-2:
wazuh-indexer-data-3:
wazuh-dashboard-config:
wazuh-dashboard-custom:
4 changes: 3 additions & 1 deletion single-node/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ services:
- ./config/wazuh_indexer_ssl_certs/wazuh.dashboard-key.pem:/usr/share/wazuh-dashboard/certs/wazuh-dashboard-key.pem
- ./config/wazuh_indexer_ssl_certs/root-ca.pem:/usr/share/wazuh-dashboard/certs/root-ca.pem
- ./config/wazuh_dashboard/opensearch_dashboards.yml:/usr/share/wazuh-dashboard/config/opensearch_dashboards.yml
- wazuh-dashboard-config:/usr/share/wazuh-dashboard/data/wazuh/config
- ./config/wazuh_dashboard/wazuh.yml:/usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml
- wazuh-dashboard-config:/usr/share/wazuh-dashboard/data/wazuh/config
- wazuh-dashboard-custom:/usr/share/wazuh-dashboard/plugins/wazuh/public/assets/custom
depends_on:
- wazuh.indexer
links:
Expand All @@ -111,3 +112,4 @@ volumes:
filebeat_var:
wazuh-indexer-data:
wazuh-dashboard-config:
wazuh-dashboard-custom:
Loading