Compare commits

...

36 Commits

Author SHA1 Message Date
havidarou
c74ac89592 Fixing ELASTICSEARCH_URL sed for filebeat 2019-08-14 21:17:38 +02:00
Jose M
d47009f8dc Bump image version 2019-08-14 12:29:53 +02:00
Jose M
4c8dd65f1b Bump version 2019-08-14 11:54:52 +02:00
Jose M
69671b7c78 Update docker-compose.yml 2019-08-14 11:53:38 +02:00
Jose M
5da96004dd Add sed blocks to modify Filebeat.yml 2019-08-14 11:52:52 +02:00
Jose M
95124980b1 Include filebeat SSL settings in filebeat.yml 2019-08-14 11:52:35 +02:00
Jose M
386ad3200b Add Filebeat module installation 2019-08-12 15:21:49 +02:00
manuasir
029cbfecfe Updated docker compose 2019-08-07 17:13:55 +02:00
manuasir
95b4f9a69e Removed demo files 2019-08-07 17:12:29 +02:00
manuasir
9d38fd7d64 Demo certificates and open distro security plugin 2019-08-06 16:40:03 +02:00
Manuel J. Bernal
c811d01a64 Bump version 2019-08-01 20:30:07 +02:00
Manuel J. Bernal
2f2ce0c809 Removed unused settings 2019-08-01 20:29:41 +02:00
Manuel J. Bernal
50b6e7ff0f Uninstall open distro kibana security plugin 2019-08-01 20:29:31 +02:00
Manuel J. Bernal
335c103b2d Disabling opendistro security plugin 2019-08-01 20:28:56 +02:00
Manuel J. Bernal
95c473e7d4 Merge pull request #220 from wazuh/3.9.4_7.2.0_oss
Added OSS images and deleting every XPACK occurrence
2019-07-29 18:31:35 +02:00
manuasir
4a0ff2895f Updated CHANGELOG 2019-07-29 18:25:59 +02:00
manuasir
611e113d52 Added OSS images to docker-compose 2019-07-29 18:25:06 +02:00
manuasir
3cd812ad8e Added OSS images and deleting every XPACK occurrence 2019-07-29 16:24:13 +02:00
Manuel J. Bernal
b0782505e1 Merge pull request #218 from wazuh/issue-217
Adapt Kibana image to v7.2.0
2019-07-22 16:35:47 +02:00
manuasir
507d27a448 Updated Kibana RESTful API version to v2 2019-07-22 16:30:26 +02:00
manuasir
40bb635036 Allowing install Wazuh plugin as root 2019-07-22 16:19:41 +02:00
Manuel J. Bernal
61b1f45bc4 Updated docker-compose 2019-07-20 18:33:04 +02:00
Manuel J. Bernal
881a0abfa5 Bump version 2019-07-20 18:32:33 +02:00
manuasir
d8c14e108c Merge branch '3.9.3_7.2.0' of https://github.com/wazuh/wazuh-docker into 3.9.3_7.2.0 2019-07-20 18:24:29 +02:00
Manuel J. Bernal
60b32d0d21 Improve cluster configuration 2019-07-20 18:23:33 +02:00
Manuel J. Bernal
a481d9c376 Merge pull request #213 from wazuh/3.9.3_fix_cluster_config
Fixed duplicated cluster configuration
2019-07-20 00:00:31 +02:00
Manuel J. Bernal
9740ddcf3e Added more fixes to configuration files 2019-07-19 23:03:11 +02:00
manuasir
5db7509b52 Fixed cluster configuration 2019-07-19 18:06:27 +02:00
Jose M
e00cd1081a Fix Bash syntax error with multiple conditions on ES and Kibana 2019-07-17 15:20:06 +02:00
Manuel J. Bernal
3aff6de0d0 Merge pull request #192 from wazuh/issue-191
Changing Filebeat configuration if environment variable is set
2019-06-18 19:11:46 +02:00
manuasir
8a6225856d Change Elasticsearch output in Filebeat if env var was set 2019-06-18 18:56:41 +02:00
manuasir
e6cddf8e1d Removed Logstash occurrences 2019-06-18 18:56:21 +02:00
Manuel J. Bernal
ad4084a8da Updated docker-compose 2019-06-12 19:57:28 +02:00
Manuel J. Bernal
11b926ffa3 Updated changelog 2019-06-12 19:53:34 +02:00
Manuel J. Bernal
d81ab1e304 Bump version 2019-06-12 17:04:42 +02:00
Manuel J. Bernal
a6b453b9df Bump version 2019-06-12 17:03:30 +02:00
18 changed files with 188 additions and 316 deletions

View File

@@ -1,6 +1,35 @@
# Change Log
All notable changes to this project will be documented in this file.
## Wazuh Docker v3.9.3_7.2.0-oss
### Added
- Support for OSS Elastic Docker images.
## Wazuh Docker v3.9.3_7.2.0
### Fixed
- Wazuh-docker reinserts cluster settings after resuming containers ([@manuasir](https://github.com/manuasir)) [#213](https://github.com/wazuh/wazuh-docker/pull/213)
## Wazuh Docker v3.9.3_7.1.1-opendistro
### Added
- Support for Amazon Open Distro Docker images.
## Wazuh Docker v3.9.2_7.1.1
### Added
- Update to Wazuh version 3.9.2_7.1.1
## Wazuh Docker v3.9.2_6.8.0
### Added
- Update to Wazuh version 3.9.2_6.8.0
## Wazuh Docker v3.9.1_7.1.0
### Added

View File

@@ -57,7 +57,7 @@ In addition, a docker-compose file is provided to launch the containers mentione
* `stable` branch on correspond to the latest Wazuh-Docker stable version.
* `master` branch contains the latest code, be aware of possible bugs on this branch.
* `Wazuh.Version_ElasticStack.Version` (for example 3.9.1_6.8.2) branch. This branch contains the current release referenced in Docker Hub. The container images are installed under the current version of this branch.
* `Wazuh.Version_ElasticStack.Version` (for example 3.9.4_7.1.1-opendistro) branch. This branch contains the current release referenced in Docker Hub. The container images are installed under the current version of this branch.
## Credits and Thank you

View File

@@ -1,2 +1,2 @@
WAZUH-DOCKER_VERSION="3.9.1_7.1.0"
REVISION="3911"
WAZUH-DOCKER_VERSION="3.9.4_7.1.1"
REVISION="3940"

View File

@@ -1,54 +1,26 @@
# Wazuh Docker Copyright (C) 2019 Wazuh Inc. (License GPLv2)
version: '2'
version: '3'
services:
wazuh:
build: wazuh
image: wazuh/wazuh:3.9.4_7.1.1-opendistro-security
hostname: wazuh-manager
restart: always
ports:
- '1514:1514/udp'
- '1515:1515'
- '514:514/udp'
- '55000:55000'
elasticsearch:
build: elasticsearch
hostname: elasticsearch
restart: always
ports:
- '9200:9200'
environment:
- node.name=node-1
- cluster.name=wazuh
- network.host=localhost
- discovery.type=single-node
- bootstrap.memory_lock=true
- 'ES_JAVA_OPTS=-Xms1g -Xmx1g'
ulimits:
memlock:
soft: -1
hard: -1
mem_limit: 2g
kibana:
build: kibana
hostname: kibana
restart: always
depends_on:
- elasticsearch
links:
- elasticsearch:elasticsearch
- wazuh:wazuh
nginx:
build: nginx
hostname: nginx
container_name: wazuh
restart: always
environment:
- NGINX_PORT=443
- NGINX_CREDENTIALS
- SSL_CERTIFICATE_AUTHORITIES=/etc/filebeat/CA.PEM
- SSL_CERTIFICATE=/etc/filebeat/node.pem
- SSL_KEY=/etc/filebeat/key.pem
- USERNAME=usertest
- PASSWORD=passwordtest
ports:
- '80:80'
- '443:443'
depends_on:
- kibana
links:
- kibana:kibana
- "1514:1514/udp"
- "1515:1515"
- "514:514/udp"
- "55000:55000"
networks:
- odfe-net
volumes:
odfe-data1:
networks:
odfe-net:

View File

@@ -1,29 +1,26 @@
# Wazuh Docker Copyright (C) 2019 Wazuh Inc. (License GPLv2)
FROM docker.elastic.co/elasticsearch/elasticsearch:7.1.0
ARG ELASTIC_VERSION=7.1.1
FROM amazon/opendistro-for-elasticsearch:1.1.0
ARG S3_PLUGIN_URL="https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-${ELASTIC_VERSION}.zip"
ENV ELASTICSEARCH_URL="http://elasticsearch:9200"
ENV ALERTS_SHARDS="1" \
ALERTS_REPLICAS="0"
ENV API_USER="foo" \
API_PASS="bar"
ENV XPACK_ML="true"
ENV ENABLE_CONFIGURE_S3="false"
ENV TEMPLATE_VERSION=v3.9.1
# Elasticearch cluster configuration environment variables
# If ELASTIC_CLUSTER is set to "true" the following variables will be added to the Elasticsearch configuration
# CLUSTER_INITIAL_MASTER_NODES set to own node by default.
ENV ELASTIC_CLUSTER="false" \
CLUSTER_NAME="wazuh" \
CLUSTER_NODE_MASTER="true" \
CLUSTER_NODE_MASTER="false" \
CLUSTER_NODE_DATA="true" \
CLUSTER_NODE_INGEST="true" \
CLUSTER_NODE_NAME="wazuh-elasticsearch" \
CLUSTER_MASTER_NODE_NAME="master-node" \
CLUSTER_MEMORY_LOCK="true" \
CLUSTER_DISCOVERY_SERVICE="wazuh-elasticsearch" \
CLUSTER_NUMBER_OF_MASTERS="2" \
@@ -31,8 +28,6 @@ ENV ELASTIC_CLUSTER="false" \
CLUSTER_DELAYED_TIMEOUT="1m" \
CLUSTER_INITIAL_MASTER_NODES="wazuh-elasticsearch"
ADD https://raw.githubusercontent.com/wazuh/wazuh/$TEMPLATE_VERSION/extensions/elasticsearch/7.x/wazuh-template.json /usr/share/elasticsearch/config
COPY config/entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh
@@ -41,13 +36,10 @@ COPY --chown=elasticsearch:elasticsearch ./config/load_settings.sh ./
RUN chmod +x ./load_settings.sh
RUN bin/elasticsearch-plugin install --batch https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-7.1.0.zip
RUN ${bin/elasticsearch-plugin install --batch S3_PLUGIN_URL}
COPY config/configure_s3.sh ./config/configure_s3.sh
RUN chmod 755 ./config/configure_s3.sh
COPY --chown=elasticsearch:elasticsearch ./config/config_cluster.sh ./
RUN chmod +x ./config_cluster.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["elasticsearch"]

View File

@@ -3,39 +3,57 @@
elastic_config_file="/usr/share/elasticsearch/config/elasticsearch.yml"
# Disable the Open distro security plugin
# If Elasticsearch cluster is enable
if [[ $ELASTIC_CLUSTER == "true" ]]
then
# Set the cluster.name and discovery.zen.minimun_master_nodes variables
sed -i 's:cluster.name\: "docker-cluster":cluster.name\: "'$CLUSTER_NAME'":g' $elastic_config_file
#sed -i 's:discovery.zen.minimum_master_nodes\: 1:discovery.zen.minimum_master_nodes\: '$CLUSTER_NUMBER_OF_MASTERS':g' $elastic_config_file
remove_single_node_conf(){
if grep -Fq "discovery.type" $1; then
sed -i '/discovery.type\: /d' $1
fi
}
# Add the cluster configuration
echo "
#cluster node
node:
master: ${CLUSTER_NODE_MASTER}
data: ${CLUSTER_NODE_DATA}
ingest: ${CLUSTER_NODE_INGEST}
name: ${CLUSTER_NODE_NAME}
max_local_storage_nodes: ${CLUSTER_MAX_NODES}
remove_cluster_config(){
sed -i '/# cluster node/,/# end cluster config/d' $1
}
bootstrap:
memory_lock: ${CLUSTER_MEMORY_LOCK}
# If Elasticsearch cluster is enable, then set up the elasticsearch.yml
if [[ $ELASTIC_CLUSTER == "true" && $CLUSTER_NODE_MASTER != "" && $CLUSTER_NODE_DATA != "" && $CLUSTER_NODE_INGEST != "" && $CLUSTER_MASTER_NODE_NAME != "" ]]; then
# Remove the old configuration
remove_single_node_conf $elastic_config_file
remove_cluster_config $elastic_config_file
cluster.initial_master_nodes:
- '${CLUSTER_INITIAL_MASTER_NODES}'
" >> $elastic_config_file
else
cat >> $elastic_config_file <<'EOF'
cluster.initial_master_nodes:
- 'elasticsearch'
if [[ $CLUSTER_NODE_MASTER == "true" ]]; then
# Add the master configuration
# cluster.initial_master_nodes for bootstrap the cluster
cat > $elastic_config_file << EOF
# cluster node
network.host: 0.0.0.0
node.name: $CLUSTER_MASTER_NODE_NAME
node.master: $CLUSTER_NODE_MASTER
cluster.initial_master_nodes:
- $CLUSTER_MASTER_NODE_NAME
# end cluster config"
EOF
# echo 'discovery.type: single-node'
elif [[ $CLUSTER_NODE_NAME != "" ]];then
# Remove the old configuration
remove_single_node_conf $elastic_config_file
remove_cluster_config $elastic_config_file
cat > $elastic_config_file << EOF
# cluster node
network.host: 0.0.0.0
node.name: $CLUSTER_NODE_NAME
node.master: false
discovery.seed_hosts:
- $CLUSTER_MASTER_NODE_NAME
- $CLUSTER_NODE_NAME
# end cluster config"
EOF
fi
# If the cluster is disabled, then set a single-node configuration
else
# Remove the old configuration
remove_single_node_conf $elastic_config_file
remove_cluster_config $elastic_config_file
echo "discovery.type: single-node" >> $elastic_config_file
fi

View File

@@ -19,32 +19,8 @@ run_as_other_user_if_needed() {
fi
}
#Disabling xpack features
elasticsearch_config_file="/usr/share/elasticsearch/config/elasticsearch.yml"
if grep -Fq "#xpack features" "$elasticsearch_config_file";
then
declare -A CONFIG_MAP=(
[xpack.ml.enabled]=$XPACK_ML
)
for i in "${!CONFIG_MAP[@]}"
do
if [ "${CONFIG_MAP[$i]}" != "" ]; then
sed -i 's/.'"$i"'.*/'"$i"': '"${CONFIG_MAP[$i]}"'/' $elasticsearch_config_file
fi
done
else
echo "
#xpack features
xpack.ml.enabled: $XPACK_ML
" >> $elasticsearch_config_file
fi
# Run load settings script.
./config_cluster.sh
./load_settings.sh &
# Execute elasticsearch

View File

@@ -11,13 +11,8 @@ else
wazuh_url="${WAZUH_API_URL}"
fi
if [[ ${ENABLED_XPACK} != "true" || "x${ELASTICSEARCH_USERNAME}" = "x" || "x${ELASTICSEARCH_PASSWORD}" = "x" ]]; then
auth=""
else
auth="--user ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}"
fi
until curl ${auth} -XGET $el_url; do
until curl -XGET $el_url; do
>&2 echo "Elastic is unavailable - sleeping"
sleep 5
done
@@ -50,10 +45,10 @@ API_USER_Q=`echo "$API_USER" | tr -d '"'`
API_PASSWORD=`echo -n $API_PASS_Q | base64`
echo "Setting API credentials into Wazuh APP"
CONFIG_CODE=$(curl -s -o /dev/null -w "%{http_code}" -XGET $el_url/.wazuh/_doc/1513629884013 ${auth})
CONFIG_CODE=$(curl -s -o /dev/null -w "%{http_code}" -XGET $el_url/.wazuh/_doc/1513629884013)
if [ "x$CONFIG_CODE" != "x200" ]; then
curl -s -XPOST $el_url/.wazuh/_doc/1513629884013 ${auth} -H 'Content-Type: application/json' -d'
curl -s -XPOST $el_url/.wazuh/_doc/1513629884013 -H 'Content-Type: application/json' -d'
{
"api_user": "'"$API_USER_Q"'",
"api_password": "'"$API_PASSWORD"'",
@@ -82,14 +77,6 @@ else
fi
sleep 5
curl -XPUT "$el_url/_cluster/settings" ${auth} -H 'Content-Type: application/json' -d'
{
"persistent": {
"xpack.monitoring.collection.enabled": true
}
}
'
# Set cluster delayed timeout when node falls
curl -X PUT "$el_url/_all/_settings" -H 'Content-Type: application/json' -d'
{

View File

@@ -1,6 +1,9 @@
# Wazuh Docker Copyright (C) 2019 Wazuh Inc. (License GPLv2)
FROM docker.elastic.co/kibana/kibana:7.1.0
ARG WAZUH_APP_VERSION=3.9.1_7.1.0
FROM amazon/opendistro-for-elasticsearch-kibana:1.1.0
ARG ELASTIC_VERSION=7.1.1
ARG WAZUH_VERSION=3.9.4
ARG WAZUH_APP_VERSION="${WAZUH_VERSION}_${ELASTIC_VERSION}"
USER root
ADD https://packages.wazuh.com/wazuhapp/wazuhapp-${WAZUH_APP_VERSION}.zip /tmp
@@ -33,21 +36,12 @@ ENV PATTERN="" \
WAZUH_VERSION_REPLICAS="" \
IP_SELECTOR="" \
IP_IGNORE="" \
XPACK_RBAC_ENABLED="" \
WAZUH_MONITORING_ENABLED="" \
WAZUH_MONITORING_FREQUENCY="" \
WAZUH_MONITORING_SHARDS="" \
WAZUH_MONITORING_REPLICAS="" \
ADMIN_PRIVILEGES=""
ARG XPACK_CANVAS="true"
ARG XPACK_LOGS="true"
ARG XPACK_INFRA="true"
ARG XPACK_ML="true"
ARG XPACK_DEVTOOLS="true"
ARG XPACK_MONITORING="true"
ARG XPACK_APM="true"
ARG CHANGE_WELCOME="false"
COPY --chown=kibana:kibana ./config/wazuh_app_config.sh ./
@@ -58,12 +52,6 @@ COPY --chown=kibana:kibana ./config/kibana_settings.sh ./
RUN chmod +x ./kibana_settings.sh
COPY --chown=kibana:kibana ./config/xpack_config.sh ./
RUN chmod +x ./xpack_config.sh
RUN ./xpack_config.sh
COPY --chown=kibana:kibana ./config/welcome_wazuh.sh ./
RUN chmod +x ./welcome_wazuh.sh
@@ -72,4 +60,6 @@ RUN ./welcome_wazuh.sh
RUN /usr/local/bin/kibana-docker --optimize
ENV ELASTICSEARCH_URL "--cacert /usr/share/elasticsearch/config/root-ca.pem -u admin:admin -k https://elasticsearch:9200"
ENTRYPOINT ./entrypoint.sh

View File

@@ -13,13 +13,7 @@ else
el_url="${ELASTICSEARCH_URL}"
fi
if [ ${ENABLED_XPACK} != "true" || "x${ELASTICSEARCH_USERNAME}" = "x" || "x${ELASTICSEARCH_PASSWORD}" = "x" ]; then
auth=""
else
auth="--user ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}"
fi
until curl -XGET $el_url ${auth}; do
until curl -XGET $el_url; do
>&2 echo "Elastic is unavailable - sleeping"
sleep 5
done

View File

@@ -17,9 +17,12 @@ WAZUH_MAJOR=3
##############################################################################
# Customize elasticsearch ip
##############################################################################
sed -i 's|https://localhost:9200|http://elasticsearch:9200|g' /usr/share/kibana/config/kibana.yml
if [ "$ELASTICSEARCH_KIBANA_IP" != "" ]; then
sed -i "s:#elasticsearch.hosts:elasticsearch.hosts:g" /usr/share/kibana/config/kibana.yml
sed -i 's|http://elasticsearch:9200|'$ELASTICSEARCH_KIBANA_IP'|g' /usr/share/kibana/config/kibana.yml
sed -i '/elasticsearch.hosts/d' /usr/share/kibana/config/kibana.yml
echo "elasticsearch.hosts: $ELASTICSEARCH_KIBANA_IP" >> /usr/share/kibana/config/kibana.yml
sed -i 's|https://elasticsearch:9200|'$ELASTICSEARCH_KIBANA_IP'|g' /usr/share/kibana/config/kibana.yml
fi
# If KIBANA_INDEX was set, then change the default index in kibana.yml configuration file. If there was an index, then delete it and recreate.
@@ -30,14 +33,6 @@ if [ "$KIBANA_INDEX" != "" ]; then
echo "kibana.index: $KIBANA_INDEX" >> /usr/share/kibana/config/kibana.yml
fi
# If XPACK_SECURITY_ENABLED was set, then change the xpack.security.enabled option from true (default) to false.
if [ "$XPACK_SECURITY_ENABLED" != "" ]; then
if grep -q 'xpack.security.enabled' /usr/share/kibana/config/kibana.yml; then
sed -i '/xpack.security.enabled/d' /usr/share/kibana/config/kibana.yml
fi
echo "xpack.security.enabled: $XPACK_SECURITY_ENABLED" >> /usr/share/kibana/config/kibana.yml
fi
if [ "$KIBANA_IP" != "" ]; then
kibana_ip="$KIBANA_IP"
else
@@ -74,6 +69,6 @@ curl -POST "http://$kibana_ip:5601/api/kibana/settings" -H "Content-Type: applic
sleep 5
# Do not ask user to help providing usage statistics to Elastic
curl -POST "http://$kibana_ip:5601/api/telemetry/v1/optIn" -H "Content-Type: application/json" -H "kbn-xsrf: true" -d '{"enabled":false}'
curl -POST "http://$kibana_ip:5601/api/telemetry/v2/optIn" -H "Content-Type: application/json" -H "kbn-xsrf: true" -d '{"enabled":false}'
echo "End settings"

View File

@@ -24,7 +24,6 @@ declare -A CONFIG_MAP=(
[wazuh-version.replicas]=$WAZUH_VERSION_REPLICAS
[ip.selector]=$IP_SELECTOR
[ip.ignore]=$IP_IGNORE
[xpack.rbac.enabled]=$XPACK_RBAC_ENABLED
[wazuh.monitoring.enabled]=$WAZUH_MONITORING_ENABLED
[wazuh.monitoring.frequency]=$WAZUH_MONITORING_FREQUENCY
[wazuh.monitoring.shards]=$WAZUH_MONITORING_SHARDS

View File

@@ -1,37 +0,0 @@
#!/bin/bash
# Wazuh Docker Copyright (C) 2019 Wazuh Inc. (License GPLv2)
kibana_config_file="/usr/share/kibana/config/kibana.yml"
if grep -Fq "#xpack features" "$kibana_config_file";
then
declare -A CONFIG_MAP=(
[xpack.apm.ui.enabled]=$XPACK_APM
[xpack.grokdebugger.enabled]=$XPACK_DEVTOOLS
[xpack.searchprofiler.enabled]=$XPACK_DEVTOOLS
[xpack.ml.enabled]=$XPACK_ML
[xpack.canvas.enabled]=$XPACK_CANVAS
[xpack.logstash.enabled]=$XPACK_LOGS
[xpack.infra.enabled]=$XPACK_INFRA
[xpack.monitoring.enabled]=$XPACK_MONITORING
[console.enabled]=$XPACK_DEVTOOLS
)
for i in "${!CONFIG_MAP[@]}"
do
if [ "${CONFIG_MAP[$i]}" != "" ]; then
sed -i 's/.'"$i"'.*/'"$i"': '"${CONFIG_MAP[$i]}"'/' $kibana_config_file
fi
done
else
echo "
#xpack features
xpack.apm.ui.enabled: $XPACK_APM
xpack.grokdebugger.enabled: $XPACK_DEVTOOLS
xpack.searchprofiler.enabled: $XPACK_DEVTOOLS
xpack.ml.enabled: $XPACK_ML
xpack.canvas.enabled: $XPACK_CANVAS
xpack.logstash.enabled: $XPACK_LOGS
xpack.infra.enabled: $XPACK_INFRA
xpack.monitoring.enabled: $XPACK_MONITORING
console.enabled: $XPACK_DEVTOOLS
" >> $kibana_config_file
fi

View File

@@ -1,19 +0,0 @@
# Wazuh Docker Copyright (C) 2019 Wazuh Inc. (License GPLv2)
FROM nginx:latest
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y openssl apache2-utils
COPY config/entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
VOLUME ["/etc/nginx/conf.d"]
ENV NGINX_NAME="foo" \
NGINX_PWD="bar"
ENTRYPOINT /entrypoint.sh

View File

@@ -1,79 +0,0 @@
#!/bin/bash
# Wazuh Docker Copyright (C) 2019 Wazuh Inc. (License GPLv2)
set -e
# Generating certificates.
if [ ! -d /etc/nginx/conf.d/ssl ]; then
echo "Generating SSL certificates"
mkdir -p /etc/nginx/conf.d/ssl/certs /etc/nginx/conf.d/ssl/private
openssl req -x509 -batch -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/conf.d/ssl/private/kibana-access.key -out /etc/nginx/conf.d/ssl/certs/kibana-access.pem >/dev/null
else
echo "SSL certificates already present"
fi
# Setting users credentials.
# In order to set NGINX_CREDENTIALS, before "docker-compose up -d" run (a or b):
#
# a) export NGINX_CREDENTIALS="user1:pass1;user2:pass2;" or
# export NGINX_CREDENTIALS="user1:pass1;user2:pass2"
#
# b) Set NGINX_CREDENTIALS in docker-compose.yml:
# NGINX_CREDENTIALS=user1:pass1;user2:pass2; or
# NGINX_CREDENTIALS=user1:pass1;user2:pass2
#
if [ ! -f /etc/nginx/conf.d/kibana.htpasswd ]; then
echo "Setting users credentials"
if [ ! -z "$NGINX_CREDENTIALS" ]; then
IFS=';' read -r -a users <<< "$NGINX_CREDENTIALS"
for index in "${!users[@]}"
do
IFS=':' read -r -a credentials <<< "${users[index]}"
if [ $index -eq 0 ]; then
echo ${credentials[1]}|htpasswd -i -c /etc/nginx/conf.d/kibana.htpasswd ${credentials[0]} >/dev/null
else
echo ${credentials[1]}|htpasswd -i /etc/nginx/conf.d/kibana.htpasswd ${credentials[0]} >/dev/null
fi
done
else
# NGINX_PWD and NGINX_NAME are declared in nginx/Dockerfile
echo $NGINX_PWD|htpasswd -i -c /etc/nginx/conf.d/kibana.htpasswd $NGINX_NAME >/dev/null
fi
else
echo "Kibana credentials already configured"
fi
if [ "x${NGINX_PORT}" = "x" ]; then
NGINX_PORT=443
fi
if [ "x${KIBANA_HOST}" = "x" ]; then
KIBANA_HOST="kibana:5601"
fi
echo "Configuring NGINX"
cat > /etc/nginx/conf.d/default.conf <<EOF
server {
listen 80;
listen [::]:80;
return 301 https://\$host:${NGINX_PORT}\$request_uri;
}
server {
listen ${NGINX_PORT} default_server;
listen [::]:${NGINX_PORT};
ssl on;
ssl_certificate /etc/nginx/conf.d/ssl/certs/kibana-access.pem;
ssl_certificate_key /etc/nginx/conf.d/ssl/private/kibana-access.key;
location / {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/conf.d/kibana.htpasswd;
proxy_pass http://${KIBANA_HOST}/;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
}
}
EOF
nginx -g 'daemon off;'

View File

@@ -1,12 +1,14 @@
# Wazuh Docker Copyright (C) 2019 Wazuh Inc. (License GPLv2)
FROM phusion/baseimage:latest
ARG FILEBEAT_VERSION=7.1.0
ARG WAZUH_VERSION=3.9.1-1
ARG FILEBEAT_VERSION=7.1.1
ARG WAZUH_VERSION=3.9.4-1
ENV API_USER="foo" \
API_PASS="bar"
ENV TEMPLATE_VERSION="v3.9.1"
ARG TEMPLATE_VERSION="v3.9.4"
# Set repositories.
RUN set -x && echo "deb https://packages.wazuh.com/3.x/apt/ stable main" | tee /etc/apt/sources.list.d/wazuh.list && \
@@ -18,8 +20,8 @@ RUN set -x && echo "deb https://packages.wazuh.com/3.x/apt/ stable main" | tee /
RUN add-apt-repository universe && apt-get update && apt-get upgrade -y -o Dpkg::Options::="--force-confold" && \
apt-get --no-install-recommends --no-install-suggests -y install openssl postfix bsd-mailx python-boto python-pip \
apt-transport-https vim expect nodejs python-cryptography mailutils libsasl2-modules wazuh-manager \
wazuh-api && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && rm -f \
apt-transport-https vim expect nodejs python-cryptography mailutils libsasl2-modules wazuh-manager=${WAZUH_VERSION} \
wazuh-api=${WAZUH_VERSION} && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && rm -f \
/var/ossec/logs/alerts/*/*/*.log && rm -f /var/ossec/logs/alerts/*/*/*.json && rm -f \
/var/ossec/logs/archives/*/*/*.log && rm -f /var/ossec/logs/archives/*/*/*.json && rm -f \
/var/ossec/logs/firewall/*/*/*.log && rm -f /var/ossec/logs/firewall/*/*/*.json
@@ -30,18 +32,20 @@ COPY config/init.bash /init.bash
RUN mkdir /entrypoint-scripts
COPY config/entrypoint.sh /entrypoint.sh
COPY config/00-wazuh.sh /entrypoint-scripts/00-wazuh.sh
COPY config/01-config_filebeat.sh /entrypoint-scripts/01-config_filebeat.sh
# Sync calls are due to https://github.com/docker/docker/issues/9547
RUN chmod 755 /init.bash && \
sync && /init.bash && \
sync && rm /init.bash && \
curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-${FILEBEAT_VERSION}-amd64.deb &&\
dpkg -i filebeat-${FILEBEAT_VERSION}-amd64.deb && rm -f filebeat-${FILEBEAT_VERSION}-amd64.deb && \
curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-oss-${FILEBEAT_VERSION}-amd64.deb &&\
dpkg -i filebeat-oss-${FILEBEAT_VERSION}-amd64.deb && rm -f filebeat-oss-${FILEBEAT_VERSION}-amd64.deb && \
chmod 755 /entrypoint.sh && \
chmod 755 /entrypoint-scripts/00-wazuh.sh
chmod 755 /entrypoint-scripts/00-wazuh.sh && \
chmod 755 /entrypoint-scripts/01-config_filebeat.sh
COPY config/filebeat.yml /etc/filebeat/
RUN chmod go-w /etc/filebeat/filebeat.yml
RUN chmod go-w /etc/filebeat/filebeat.yml
# Setting volumes
VOLUME ["/var/ossec/data"]
@@ -70,8 +74,7 @@ RUN chmod +x /etc/service/wazuh-api/run && \
ADD https://raw.githubusercontent.com/wazuh/wazuh/$TEMPLATE_VERSION/extensions/elasticsearch/7.x/wazuh-template.json /etc/filebeat
RUN chmod go-w /etc/filebeat/wazuh-template.json
RUN chmod go-w /etc/filebeat/wazuh-template.json
# Run all services
ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT ["/entrypoint.sh"]

View File

@@ -0,0 +1,47 @@
#!/bin/bash
# Wazuh App Copyright (C) 2019 Wazuh Inc. (License GPLv2)
set -e
WAZUH_FILEBEAT_MODULE=wazuh-filebeat-0.1.tar.gz
if [ "$ELASTICSEARCH_URL" != "" ]; then
>&2 echo "Customize Elasticsearch ouput IP."
sed -i 's|http://elasticsearch:9200|'$ELASTICSEARCH_URL'|g' /etc/filebeat/filebeat.yml
fi
# Install Wazuh Filebeat Module
curl -s "https://packages.wazuh.com/3.x/filebeat/${WAZUH_FILEBEAT_MODULE}" | tar -xvz -C /usr/share/filebeat/module
mkdir -p /usr/share/filebeat/module/wazuh
chmod 755 -R /usr/share/filebeat/module/wazuh
chown root: /etc/filebeat/filebeat.yml
chmod go-w /etc/filebeat/filebeat.yml
# Configure filebeat.yml security settings
if [ "$SSL_CERTIFICATE_AUTHORITIES" != "" ]; then
>&2 echo "Customize Elasticsearch ouput IP."
sed -i 's|#ssl.certificate_authorities:|'ssl.certificate_authorities:\ [\"$SSL_CERTIFICATE\"]'|g' /etc/filebeat/filebeat.yml
fi
if [ "$SSL_CERTIFICATE" != "" ]; then
>&2 echo "Customize Elasticsearch ouput IP."
sed -i 's|#ssl.certificate:|'ssl.certificate:\ \"$SSL_CERTIFICATE\"'|g' /etc/filebeat/filebeat.yml
fi
if [ "$SSL_KEY" != "" ]; then
>&2 echo "Customize Elasticsearch ouput IP."
sed -i 's|#ssl.key:|'ssl.key:\ \"$SSL_KEY\"'|g' /etc/filebeat/filebeat.yml
fi
if [ "$USERNAME" != "" ]; then
>&2 echo "Customize Elasticsearch ouput IP."
sed -i 's|#username:|'username:\ \"$USERNAME\"'|g' /etc/filebeat/filebeat.yml
fi
if [ "$PASSWORD" != "" ]; then
>&2 echo "Customize Elasticsearch ouput IP."
sed -i 's|#password:|'password:\ \"$PASSWORD\"'|g' /etc/filebeat/filebeat.yml
fi

View File

@@ -51,3 +51,8 @@ output.elasticsearch:
#pipeline: geoip
indices:
- index: 'wazuh-alerts-3.x-%{+yyyy.MM.dd}'
#ssl.certificate_authorities:
#ssl.certificate:
#ssl.key:
#username:
#password: