mirror of
				https://github.com/wazuh/wazuh-docker.git
				synced 2025-11-03 21:43:17 +00:00 
			
		
		
		
	add variables from wazuh version
This commit is contained in:
		
							
								
								
									
										15
									
								
								build-docker-images/build.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										15
									
								
								build-docker-images/build.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
WAZUH_IMAGE_VERSION=4.3.0
 | 
			
		||||
WAZUH_VERSION=$(echo $WAZUH_IMAGE_VERSION | sed -e 's/\.//g')
 | 
			
		||||
WAZUH_ACTUAL_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')
 | 
			
		||||
 | 
			
		||||
## If wazuh manager exists in apt dev repository, change variables, if not exit 1
 | 
			
		||||
if [ "$WAZUH_VERSION" -le "$WAZUH_ACTUAL_VERSION" ]; then
 | 
			
		||||
  IMAGE_VERSION=${WAZUH_IMAGE_VERSION}
 | 
			
		||||
else
 | 
			
		||||
  IMAGE_VERSION=${WAZUH_IMAGE_VERSION}-dev
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
echo WAZUH_VERSION=$WAZUH_IMAGE_VERSION > env
 | 
			
		||||
echo WAZUH_IMAGE_VERSION=$IMAGE_VERSION >> env
 | 
			
		||||
 | 
			
		||||
docker-compose --env-file env build --no-cache
 | 
			
		||||
@@ -3,8 +3,11 @@ version: '3.7'
 | 
			
		||||
 | 
			
		||||
services:
 | 
			
		||||
  wazuh.manager:
 | 
			
		||||
    build:  wazuh-manager/
 | 
			
		||||
    image: wazuh/wazuh-manager:4.3.0
 | 
			
		||||
    build:
 | 
			
		||||
      context: wazuh-manager/
 | 
			
		||||
      args:
 | 
			
		||||
        - WAZUH_VERSION=${WAZUH_VERSION}
 | 
			
		||||
    image: wazuh/wazuh-manager:${WAZUH_IMAGE_VERSION}
 | 
			
		||||
    hostname: wazuh.manager
 | 
			
		||||
    restart: always
 | 
			
		||||
    ports:
 | 
			
		||||
@@ -31,8 +34,11 @@ services:
 | 
			
		||||
      - filebeat_var:/var/lib/filebeat
 | 
			
		||||
 | 
			
		||||
  wazuh.indexer:
 | 
			
		||||
    build: wazuh-indexer/
 | 
			
		||||
    image: wazuh/wazuh-indexer:4.3.0
 | 
			
		||||
    build:
 | 
			
		||||
      context: wazuh-indexer/
 | 
			
		||||
      args:
 | 
			
		||||
        - WAZUH_VERSION=${WAZUH_VERSION}
 | 
			
		||||
    image: wazuh/wazuh-indexer:${WAZUH_IMAGE_VERSION}
 | 
			
		||||
    hostname: wazuh.indexer
 | 
			
		||||
    restart: always
 | 
			
		||||
    ports:
 | 
			
		||||
@@ -48,8 +54,11 @@ services:
 | 
			
		||||
        hard: 65536
 | 
			
		||||
 | 
			
		||||
  wazuh.dashboard:
 | 
			
		||||
    build: wazuh-dashboard/
 | 
			
		||||
    image: wazuh/wazuh-dashboard:4.3.0
 | 
			
		||||
    build:
 | 
			
		||||
      context: wazuh-dashboard/
 | 
			
		||||
      args:
 | 
			
		||||
        - WAZUH_VERSION=${WAZUH_VERSION}
 | 
			
		||||
    image: wazuh/wazuh-dashboard:${WAZUH_IMAGE_VERSION}
 | 
			
		||||
    hostname: wazuh.dashboard
 | 
			
		||||
    restart: always
 | 
			
		||||
    ports:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								build-docker-images/env
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								build-docker-images/env
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
WAZUH_VERSION=4.3.0
 | 
			
		||||
WAZUH_IMAGE_VERSION=4.3.0-dev
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
# Wazuh Docker Copyright (C) 2021 Wazuh Inc. (License GPLv2)
 | 
			
		||||
FROM ubuntu:focal AS builder
 | 
			
		||||
 | 
			
		||||
ARG WAZUH_VERSION=4.3.0
 | 
			
		||||
ARG WAZUH_VERSION
 | 
			
		||||
ARG INSTALL_DIR=/usr/share/wazuh-dashboard
 | 
			
		||||
 | 
			
		||||
# Update and install dependencies
 | 
			
		||||
@@ -24,8 +24,9 @@ RUN $INSTALL_DIR/bin/opensearch-dashboards-keystore create --allow-root && \
 | 
			
		||||
    echo kibanaserver | $INSTALL_DIR/bin/opensearch-dashboards-keystore add opensearch.username --stdin --allow-root && \
 | 
			
		||||
    echo kibanaserver | $INSTALL_DIR/bin/opensearch-dashboards-keystore add opensearch.password --stdin --allow-root
 | 
			
		||||
 | 
			
		||||
# Install Wazuh App
 | 
			
		||||
RUN $INSTALL_DIR/bin/opensearch-dashboards-plugin install https://packages.wazuh.com/4.x/ui/dashboard/wazuh-${WAZUH_VERSION}.zip --allow-root
 | 
			
		||||
COPY config/install_wazuh_app.sh /
 | 
			
		||||
RUN chmod 775 /install_wazuh_app.sh
 | 
			
		||||
RUN bash /install_wazuh_app.sh
 | 
			
		||||
 | 
			
		||||
# Copy and set permissions to config files
 | 
			
		||||
COPY config/opensearch_dashboards.yml $INSTALL_DIR/config/
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,14 @@
 | 
			
		||||
## Variables
 | 
			
		||||
WAZUH_IMAGE_VERSION=$(echo $WAZUH_VERSION | sed -e 's/\.//g')
 | 
			
		||||
WAZUH_ACTUAL_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')
 | 
			
		||||
echo $WAZUH_IMAGE_VERSION
 | 
			
		||||
echo $WAZUH_ACTUAL_VERSION
 | 
			
		||||
## If wazuh manager exists in apt dev repository, change variables, if not exit 1
 | 
			
		||||
if [ "$WAZUH_IMAGE_VERSION" -le "$WAZUH_ACTUAL_VERSION" ]; then
 | 
			
		||||
  WAZUH_APP=https://packages.wazuh.com/4.x/ui/dashboard/wazuh-${WAZUH_VERSION}.zip
 | 
			
		||||
else
 | 
			
		||||
  WAZUH_APP=https://packages-dev.wazuh.com/pre-release/ui/dashboard/wazuh-${WAZUH_VERSION}.zip
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Install Wazuh App
 | 
			
		||||
$INSTALL_DIR/bin/opensearch-dashboards-plugin install $WAZUH_APP --allow-root
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
# Wazuh Docker Copyright (C) 2021 Wazuh Inc. (License GPLv2)
 | 
			
		||||
FROM ubuntu:focal AS builder
 | 
			
		||||
 | 
			
		||||
ARG WAZUH_VERSION
 | 
			
		||||
 | 
			
		||||
RUN apt-get update -y && apt-get install curl openssl xz-utils -y
 | 
			
		||||
 | 
			
		||||
COPY config/opensearch.yml /
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ export TARGET_DIR=${CURDIR}/debian/${NAME}
 | 
			
		||||
# Package build options
 | 
			
		||||
export USER=${NAME}
 | 
			
		||||
export GROUP=${NAME}
 | 
			
		||||
export VERSION=4.3.0
 | 
			
		||||
export VERSION=${WAZUH_VERSION}
 | 
			
		||||
export LOG_DIR=/var/log/${NAME}
 | 
			
		||||
export LIB_DIR=/var/lib/${NAME}
 | 
			
		||||
export PID_DIR=/run/${NAME}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,17 +1,22 @@
 | 
			
		||||
# Wazuh Docker Copyright (C) 2021 Wazuh Inc. (License GPLv2)
 | 
			
		||||
FROM ubuntu:focal
 | 
			
		||||
 | 
			
		||||
ARG WAZUH_VERSION=4.3.0
 | 
			
		||||
ARG TEMPLATE_VERSION=4.3
 | 
			
		||||
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
 | 
			
		||||
 | 
			
		||||
ARG WAZUH_VERSION
 | 
			
		||||
ARG TEMPLATE_VERSION=4.2
 | 
			
		||||
ARG FILEBEAT_CHANNEL=filebeat-oss
 | 
			
		||||
ARG FILEBEAT_VERSION=7.10.2
 | 
			
		||||
ARG WAZUH_FILEBEAT_MODULE="wazuh-filebeat-0.1.tar.gz"
 | 
			
		||||
 | 
			
		||||
RUN apt-get update && apt install curl apt-transport-https lsb-release gnupg -y
 | 
			
		||||
 | 
			
		||||
RUN apt-key adv --fetch-keys https://packages.wazuh.com/key/GPG-KEY-WAZUH && \
 | 
			
		||||
    echo "deb https://packages.wazuh.com/4.x/apt/ stable main" | tee -a /etc/apt/sources.list.d/wazuh.list && \
 | 
			
		||||
    apt-get update && \
 | 
			
		||||
COPY config/check_repository.sh /
 | 
			
		||||
 | 
			
		||||
RUN chmod 775 /check_repository.sh
 | 
			
		||||
RUN source /check_repository.sh
 | 
			
		||||
 | 
			
		||||
RUN apt-get update && \
 | 
			
		||||
    apt-get install wazuh-manager=${WAZUH_VERSION}-1
 | 
			
		||||
 | 
			
		||||
RUN curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/${FILEBEAT_CHANNEL}-${FILEBEAT_VERSION}-amd64.deb &&\
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								build-docker-images/wazuh-manager/config/check_repository.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								build-docker-images/wazuh-manager/config/check_repository.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
## Variables
 | 
			
		||||
WAZUH_IMAGE_VERSION=$(echo $WAZUH_VERSION | sed -e 's/\.//g')
 | 
			
		||||
WAZUH_ACTUAL_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')
 | 
			
		||||
## If wazuh manager exists in apt dev repository, change variables, if not exit 1
 | 
			
		||||
if [ "$WAZUH_IMAGE_VERSION" -le "$WAZUH_ACTUAL_VERSION" ]; then
 | 
			
		||||
  APT_KEY=https://packages.wazuh.com/key/GPG-KEY-WAZUH
 | 
			
		||||
  REPOSITORY="deb https://packages.wazuh.com/4.x/apt/ stable main"
 | 
			
		||||
else
 | 
			
		||||
  APT_KEY=https://packages-dev.wazuh.com/key/GPG-KEY-WAZUH
 | 
			
		||||
  REPOSITORY="deb https://packages-dev.wazuh.com/pre-release/apt/ unstable main"
 | 
			
		||||
fi
 | 
			
		||||
apt-key adv --fetch-keys ${APT_KEY}
 | 
			
		||||
echo ${REPOSITORY} | tee -a /etc/apt/sources.list.d/wazuh.list
 | 
			
		||||
		Reference in New Issue
	
	Block a user