Compare commits

...

49 Commits

Author SHA1 Message Date
Jose Luis Ruiz
80184b5c49 Update to Wazuh 3.6.1 and Elastic Stack 6.4.1 2018-09-29 09:01:06 -10:00
AlfonsoRBJ
f308ddcaab Merge pull request #53 from wazuh/fix-typo-kibana-chown
Fix typo in Kibana chown command
2018-09-24 16:45:11 +02:00
Jesús Ángel
d6bbc3db77 Fix typo 2018-09-24 09:26:36 +02:00
Jose Luis Ruiz
f14642ac1a Update to Wazuh 3.6.1 and Elastic Stack 6.4.0 2018-09-12 01:04:47 -04:00
Jose Luis Ruiz
04e0d4793a Upgrade Wazuh to 3.6.0 and Wazuh APP to 3.6.0_6.4.0 2018-08-30 10:09:22 -04:00
José Luis Ruiz
d514ab7830 Update README.md 2018-08-21 16:18:20 -04:00
José Luis Ruiz Ruiz
9ef39510fc Update Wazuh to v3.5.0 2018-08-11 10:25:10 -04:00
José Luis Ruiz Ruiz
9a3a89abdc Upgrade ELastic Stack to 6.3.2 2018-08-01 17:11:53 -04:00
José Luis Ruiz
8ddcda6e84 Merge pull request #48 from wirabdillah/fix-wazuh-kibana-version
Fix wazuh/wazuh-kibana image version to 3.4.0_6.3.1
2018-07-26 09:14:35 -04:00
Wira Abdillah S
915a395557 Fix wazuh/wazuh-kibana image version to 3.4.0_6.3.1 2018-07-26 19:18:25 +07:00
José Luis Ruiz Ruiz
b927c98585 Fixed logstash template and docker-compose.yml versions 2018-07-25 17:20:43 -04:00
José Luis Ruiz Ruiz
74c2948bc8 Update Kibana app to version 3.4.0_6.3.1 2018-07-24 20:17:33 -04:00
José Luis Ruiz Ruiz
b702c67865 Upgrade Wazuh-manager to 3.4.0 2018-07-24 17:19:04 -04:00
José Luis Ruiz
4575c30a00 Merge pull request #47 from rafadvega/master
Fixed bad permissions in filebeat.yml
2018-07-21 09:58:30 -04:00
Rafael de Vega
5c39d1f0ea Fixed bad permissions in filebeat.yml 2018-07-21 12:22:49 +02:00
José Luis Ruiz Ruiz
357a17e791 Update Elastic Stack to version non -oss, this option enable x-pack 2018-07-17 18:03:18 +02:00
José Luis Ruiz
f1a2762984 Update template version. 2018-07-17 17:25:19 +02:00
Miguelangel Freitas
7200d6f9c2 Using fixed containers versions 2018-07-15 17:49:32 -05:00
Miguelangel Freitas
23d0cb7f63 Enabling extra Wazuh APP extensions 2018-07-15 17:49:29 -05:00
José Luis Ruiz Ruiz
e03b222f05 Upgrade to Wazuh 3.3.1 and Elastic Stack 6.3.1 2018-07-11 15:16:48 +02:00
Miguelangel Freitas
4050621326 Updating logstash configuration 2018-07-02 08:13:04 -05:00
José Luis Ruiz Ruiz
36cc2607a7 Kibana version fixed 2018-06-29 21:03:55 +02:00
José Luis Ruiz Ruiz
b91e9ba308 Upgrade Wazuh Manager to 3.3.1 and Elastic Stack 6.3.0 2018-06-29 20:41:11 +02:00
José Luis Ruiz Ruiz
9829b98cae Upgrade Wazuh Manager to 3.3.1 2018-06-25 16:03:38 +02:00
Miguelangel Freitas
073bf284f3 Updating README.md 2018-06-11 22:32:15 +00:00
Miguelangel Freitas
6dacfbcc40 Upgrade Wazuh to 3.3.0 2018-06-11 22:30:57 +00:00
José Luis Ruiz
2f91f5aa10 Update APP version 2018-06-08 16:37:13 +02:00
José Luis Ruiz Ruiz
2016322c0a Upgrade Wazuh version 2018-06-04 21:15:45 +02:00
José Luis Ruiz Ruiz
fec53979ea Upgrade Wazuh to 3.2.3 2018-05-28 23:07:05 +02:00
Miguelangel Freitas
ee3ff4847b Update License and copyright, thanks @jlruizmlg 2018-05-16 02:39:54 +00:00
Miguelangel Freitas
290ea29c1d Upgrade Elastic Stack and Wazuh-APP version to 3.2.2_6.2.4, thanks @jlruizmlg 2018-05-16 02:39:54 +00:00
Miguelangel Freitas
711c3c0f8e Refactoring wazuh/wazuh-logstash container 2018-05-16 02:39:54 +00:00
Miguelangel Freitas
70171d490d Refactoring wazuh/wazuh-kibana container 2018-05-16 02:39:54 +00:00
Miguelangel Freitas
0df2367e7a Refactoring wazuh/wazuh-nginx container 2018-05-16 02:39:50 +00:00
Miguelangel Freitas
efb5f9ef04 Refactoring wazuh/wazuh container 2018-04-20 17:14:43 -05:00
Miguelangel Freitas
97c7b82aec Merge pull request #44 from augustine-urolime/patch-1
Update Dockerfile
2018-04-20 17:10:25 -05:00
augustine-urolime
a9e16e79a9 Update Dockerfile
nginx copy command fix
2018-04-13 22:37:56 +05:30
José Luis Ruiz
9294617a0e Update Wazuh Cluster port 2018-04-11 19:23:26 -04:00
José Luis Ruiz
8408f401d5 Update Dockerfile
Enable port 1516/TCP in order to create a Wazuh Cluster.
2018-04-11 19:19:42 -04:00
José Luis Ruiz Ruiz
575708310b Update docker to Wazug 3.2.1 Elastic 6.2.3 2018-04-04 15:23:59 -04:00
Miguelangel Freitas
15f7ce98d9 Updating versions on README.md 2018-03-24 18:12:18 -05:00
Miguelangel Freitas
fd18a00429 Updating containers to latest versions. 2018-03-22 17:43:11 +00:00
Miguelangel Freitas
9a4c409a0a Static versions for wazuh-manager and wazuh-api 2018-03-21 14:08:31 -05:00
Miguelangel Freitas
57490a50bd Merge pull request #42 from coveord/feature-wazuh-config-mount-point
Add a mount point for custom Wazuh configuration files
2018-03-13 17:25:31 -05:00
Jean-Philippe Lachance
62741c639f ! Fix the "currently supported versions" in the README
! Fix the ossec_shutdown function (/var/ossec/data/bin is not valid)
+ Add a mount point for custom Wazuh configuration files
+ Add documentation for that mount point
2018-03-09 16:56:50 -05:00
José Luis Ruiz
043f8f18de Merge pull request #41 from wazuh/issue-40.1
Issue 40.1
2018-03-01 10:55:34 +01:00
AlfonsoRBJ
ee74f01cba fix 2
fix VOLUME ["/etc/filebeat"]
2018-02-27 16:37:03 +01:00
AlfonsoRBJ
e685128b51 fix
fix  "#   -my-path:/etc/filebeat
2018-02-27 16:27:27 +01:00
José Luis Ruiz Ruiz
8f40340dda Update docker to Wazug 3.2.1 Elastic 6.2.1 2018-02-21 00:13:47 +01:00
22 changed files with 295 additions and 179 deletions

View File

@@ -15,7 +15,7 @@ In addition, a docker-compose file is provided to launch the containers mentione
## Current release
Containers are currently tested on Wazuh version 3.1.0 and Elastic Stack version 6.1.0. We will do our best to keep this repository updated to latest versions of both Wazuh and Elastic Stack.
Containers are currently tested on Wazuh version 3.6.1 and Elastic Stack version 6.4.1. We will do our best to keep this repository updated to latest versions of both Wazuh and Elastic Stack.
## Installation notes
@@ -25,7 +25,34 @@ To run all docker instances you can just run ``docker-compose up``, from the dir
* Kibana container can take a few minutes to install Wazuh plugin, this takes place after ``Optimizing and caching browser bundles...`` is printed out.
* It is recommended to set Docker host preferences to give at least 4GB memory per container (this doesn't necessarily mean they all will use it, but Elasticsearch requires them to work properly).
Once installed you can browse through the interface at: http://127.0.0.1:5601
Once installed you can browse through the interface at: https://127.0.0.1
## Mount custom Wazuh configuration files
To mount custom Wazuh configuration files in the Wazuh manager container, mount them in the `/wazuh-config-mount` folder. For example, to mount a custom `ossec.conf` file, mount it in `/wazuh-config-mount/etc/ossec.conf` and the [run.sh](wazuh/config/run.sh) script will copy the file at the right place on boot while respecting the destination file permissions.
Here is an example of a `/wazuh-config-mount` folder used to mount some common custom configuration files:
```
root@wazuh-manager:/# tree /wazuh-config-mount/
/wazuh-config-mount/
└── etc
├── ossec.conf
├── rules
│   └── local_rules.xml
└── shared
└── default
└── agent.conf
4 directories, 3 files
```
In that case, you will see this in the Wazuh manager logs on boot:
```
Identified Wazuh configuration files to mount...
'/wazuh-config-mount/etc/ossec.conf' -> '/var/ossec/data/etc/ossec.conf'
'/wazuh-config-mount/etc/rules/local_rules.xml' -> '/var/ossec/data/etc/rules/local_rules.xml'
'/wazuh-config-mount/etc/shared/default/agent.conf' -> '/var/ossec/data/etc/shared/default/agent.conf'
```
## More documentation
@@ -42,6 +69,10 @@ These Docker containers are based on:
We thank you them and everyone else who has contributed to this project.
## License and copyright
Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
## Wazuh official website
[Wazuh website](http://wazuh.com)

View File

@@ -1,8 +1,9 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
version: '2'
services:
wazuh:
image: wazuh/wazuh
image: wazuh/wazuh:3.6.1_6.4.1
hostname: wazuh-manager
restart: always
ports:
@@ -10,22 +11,23 @@ services:
- "1515:1515"
- "514:514/udp"
- "55000:55000"
# - "1516:1516"
networks:
- docker_elk
# volumes:
# - my-path:/var/ossec/data:Z
# - my-path:/etc/postfix:Z
# - my-path:/etc/filebeat
# - my-custom-config-path/ossec.conf:/wazuh-config-mount/etc/ossec.conf
depends_on:
- elasticsearch
- logstash
logstash:
image: wazuh/wazuh-logstash
image: wazuh/wazuh-logstash:3.6.1_6.4.1
hostname: logstash
restart: always
command: -f /etc/logstash/conf.d/
# volumes:
# - my-path:/etc/logstash/conf.d:Z
links:
- kibana
- elasticsearch:elasticsearch
ports:
- "5000:5000"
@@ -35,9 +37,8 @@ services:
- elasticsearch
environment:
- LS_HEAP_SIZE=2048m
- XPACK_MONITORING_ENABLED=false
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.1.3
image: docker.elastic.co/elasticsearch/elasticsearch:6.4.1
hostname: elasticsearch
restart: always
ports:
@@ -48,11 +49,6 @@ services:
- cluster.name=wazuh
- network.host=0.0.0.0
- bootstrap.memory_lock=true
- xpack.security.enabled=false
- xpack.monitoring.enabled=false
- xpack.ml.enabled=false
- xpack.watcher.enabled=false
- xpack.graph.enabled=false
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
ulimits:
memlock:
@@ -64,26 +60,24 @@ services:
networks:
- docker_elk
kibana:
image: wazuh/wazuh-kibana
image: wazuh/wazuh-kibana:3.6.1_6.4.1
hostname: kibana
restart: always
# ports:
# - "5601:5601"
environment:
- "NODE_OPTIONS=--max-old-space-size=3072"
# environment:
# - ELASTICSEARCH_URL=http://elasticsearch:9200
networks:
- docker_elk
depends_on:
- elasticsearch
links:
- elasticsearch:elasticsearch
- wazuh
entrypoint: /wait-for-it.sh elasticsearch
- wazuh:wazuh
nginx:
image: wazuh/wazuh-nginx
image: wazuh/wazuh-nginx:3.6.1_6.4.1
hostname: nginx
restart: always
entrypoint: /run.sh
environment:
- NGINX_PORT=443
ports:
@@ -96,7 +90,7 @@ services:
depends_on:
- kibana
links:
- kibana
- kibana:kibana
networks:
docker_elk:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

View File

@@ -1,21 +1,19 @@
FROM docker.elastic.co/kibana/kibana:6.1.3
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
FROM docker.elastic.co/kibana/kibana:6.4.1
ARG WAZUH_APP_VERSION=3.6.1_6.4.1
USER root
COPY ./config/kibana.yml /usr/share/kibana/config/kibana.yml
ADD https://packages.wazuh.com/wazuhapp/wazuhapp-${WAZUH_APP_VERSION}.zip /tmp
COPY config/wait-for-it.sh /wait-for-it.sh
ADD https://raw.githubusercontent.com/wazuh/wazuh/3.6/extensions/elasticsearch/wazuh-elastic6-template-alerts.json /usr/share/kibana/config
ADD https://packages.wazuh.com/wazuhapp/wazuhapp-3.1.0_6.1.3.zip /tmp
RUN NODE_OPTIONS="--max-old-space-size=3072" /usr/share/kibana/bin/kibana-plugin install file:///tmp/wazuhapp-${WAZUH_APP_VERSION}.zip &&\
chown -R kibana:kibana /usr/share/kibana &&\
rm -rf /tmp/*
ADD https://raw.githubusercontent.com/wazuh/wazuh/3.1/extensions/elasticsearch/wazuh-elastic6-template-alerts.json /usr/share/kibana/config
COPY config/entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh
ADD https://raw.githubusercontent.com/wazuh/wazuh/3.1/extensions/elasticsearch/wazuh-elastic6-template-monitoring.json /usr/share/kibana/config
USER kibana
ADD https://raw.githubusercontent.com/wazuh/wazuh/3.1/extensions/elasticsearch/alert_sample.json /usr/share/kibana/config
RUN /usr/share/kibana/bin/kibana-plugin install file:///tmp/wazuhapp-3.1.0_6.1.3.zip
RUN rm -rf /tmp/*
RUN chmod 755 /wait-for-it.sh
ENTRYPOINT /entrypoint.sh

View File

@@ -0,0 +1,56 @@
#!/bin/bash
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
set -e
if [ "x${ELASTICSEARCH_URL}" = "x" ]; then
el_url="http://elasticsearch:9200"
else
el_url="${ELASTICSEARCH_URL}"
fi
until curl -XGET $el_url; do
>&2 echo "Elastic is unavailable - sleeping"
sleep 5
done
>&2 echo "Elastic is up - executing command"
#Insert default templates
cat /usr/share/kibana/config/wazuh-elastic6-template-alerts.json | curl -XPUT "$el_url/_template/wazuh" -H 'Content-Type: application/json' -d @-
sleep 5
echo "Setting API credentials into Wazuh APP"
CONFIG_CODE=$(curl -s -o /dev/null -w "%{http_code}" -XGET $el_url/.wazuh/wazuh-configuration/1513629884013)
if [ "x$CONFIG_CODE" = "x404" ]; then
curl -s -XPOST $el_url/.wazuh/wazuh-configuration/1513629884013 -H 'Content-Type: application/json' -d'
{
"api_user": "foo",
"api_password": "YmFy",
"url": "https://wazuh",
"api_port": "55000",
"insecure": "true",
"component": "API",
"cluster_info": {
"manager": "wazuh-manager",
"cluster": "Disabled",
"status": "disabled"
},
"extensions": {
"oscap": true,
"audit": true,
"pci": true,
"aws": true,
"virustotal": true,
"gdpr": true,
"ciscat": true
}
}
' > /dev/null
else
echo "Wazuh APP already configured"
fi
sleep 5
/usr/local/bin/kibana-docker

View File

@@ -90,10 +90,3 @@ logging.quiet: true
# Set the interval in milliseconds to sample system and process performance
# metrics. Minimum is 100ms. Defaults to 10000.
# ops.interval: 10000
xpack.security.enabled: false
xpack.grokdebugger.enabled: false
xpack.graph.enabled: false
xpack.ml.enabled: false
xpack.monitoring.enabled: false
xpack.reporting.enabled: false

View File

@@ -1,58 +0,0 @@
#!/bin/bash
set -e
host="$1"
shift
cmd="kibana"
until curl -XGET $host:9200; do
>&2 echo "Elastic is unavailable - sleeping"
sleep 5
done
>&2 echo "Elastic is up - executing command"
sleep 5
#Insert default templates
cat /usr/share/kibana/config/wazuh-elastic6-template-alerts.json | curl -XPUT 'http://elasticsearch:9200/_template/wazuh' -H 'Content-Type: application/json' -d @-
sleep 5
#Insert default templates
cat /usr/share/kibana/config/wazuh-elastic6-template-monitoring.json | curl -XPUT 'http://elasticsearch:9200/_template/wazuh-agent' -H 'Content-Type: application/json' -d @-
#Insert sample alert:
sleep 5
cat /usr/share/kibana/config/alert_sample.json | curl -XPUT "http://elasticsearch:9200/wazuh-alerts-3.x-"`date +%Y.%m.%d`"/wazuh/sample" -H 'Content-Type: application/json' -d @-
sleep 5
echo "Setting API credentials into Wazuh APP"
CONFIG_CODE=$(curl -s -o /dev/null -w "%{http_code}" -XGET http://$host:9200/.wazuh/wazuh-configuration/1513629884013)
if [ "x$CONFIG_CODE" = "x404" ]; then
curl -s -XPOST http://$host:9200/.wazuh/wazuh-configuration/1513629884013 -H 'Content-Type: application/json' -d'
{
"api_user": "foo",
"api_password": "YmFy",
"url": "https://wazuh",
"api_port": "55000",
"insecure": "true",
"component": "API",
"cluster_info": {
"manager": "wazuh-manager",
"cluster": "Disabled",
"status": "disabled"
},
"extensions": {
"oscap": true,
"audit": true,
"pci": true
}
}
' > /dev/null
else
echo "Wazuh APP already configured"
fi
sleep 5
exec $cmd

View File

@@ -1,3 +1,6 @@
FROM docker.elastic.co/logstash/logstash:6.1.3
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
FROM docker.elastic.co/logstash/logstash:6.4.1
COPY config/logstash.conf /etc/logstash/conf.d/logstash.conf
RUN rm -f /usr/share/logstash/pipeline/logstash.conf
COPY config/01-wazuh.conf /usr/share/logstash/pipeline/01-wazuh.conf

View File

@@ -1,3 +1,4 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
# Wazuh - Logstash configuration file
## Remote Wazuh Manager - Filebeat input
input {
@@ -25,14 +26,14 @@ filter {
geoip {
source => "@src_ip"
target => "GeoLocation"
fields => ["city_name", "continent_code", "country_code2", "country_name", "region_name", "location"]
fields => ["city_name", "country_name", "region_name", "location"]
}
date {
match => ["timestamp", "ISO8601"]
target => "@timestamp"
}
mutate {
remove_field => [ "timestamp", "beat", "input_type", "tags", "count", "@version", "log", "offset", "type","@src_ip"]
remove_field => [ "timestamp", "beat", "input_type", "tags", "count", "@version", "log", "offset", "type", "@src_ip", "host"]
}
}
output {

View File

@@ -1,5 +1,5 @@
#!/bin/bash
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
#
# OSSEC container bootstrap. See the README for information of the environment
# variables expected by this script.

View File

@@ -1,7 +1,16 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
FROM nginx:latest
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y openssl apache2-utils
COPY ./config/run.sh /run.sh
COPY config/entrypoint.sh /entrypoint.sh
RUN chmod 755 /run.sh
RUN chmod 755 /entrypoint.sh
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
VOLUME ["/etc/nginx/conf.d"]
ENTRYPOINT /entrypoint.sh

View File

@@ -0,0 +1,54 @@
#!/bin/sh
# Wazuh App Copyright (C) 2018 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
# Configuring default credentiales.
if [ ! -f /etc/nginx/conf.d/kibana.htpasswd ]; then
echo "Setting Nginx credentials"
echo bar|htpasswd -i -c /etc/nginx/conf.d/kibana.htpasswd foo >/dev/null
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}/;
}
}
EOF
nginx -g 'daemon off;'

View File

@@ -1,43 +0,0 @@
#!/bin/bash
set -e
if [ ! -d /etc/pki/tls/certs ]; then
echo "Generating SSL certificates"
mkdir -p /etc/pki/tls/certs /etc/pki/tls/private
openssl req -x509 -batch -nodes -days 365 -newkey rsa:2048 -keyout /etc/pki/tls/private/kibana-access.key -out /etc/pki/tls/certs/kibana-access.pem >/dev/null
else
echo "SSL certificates already present"
fi
if [ ! -f /etc/nginx/conf.d/kibana.htpasswd ]; then
echo "Setting Nginx credentials"
echo bar|htpasswd -i -c /etc/nginx/conf.d/kibana.htpasswd foo >/dev/null
else
echo "Kibana credentials already configured"
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/pki/tls/certs/kibana-access.pem;
ssl_certificate_key /etc/pki/tls/private/kibana-access.key;
location / {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/conf.d/kibana.htpasswd;
proxy_pass http://kibana:5601/;
}
}
EOF
echo "Starting Nginx"
nginx -g 'daemon off; error_log /dev/stdout info;'

View File

@@ -1,16 +1,32 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
FROM phusion/baseimage:latest
ARG FILEBEAT_VERSION=6.1.3
ARG FILEBEAT_VERSION=6.4.1
ARG WAZUH_VERSION=3.6.1-1
RUN apt-get update; apt-get -y dist-upgrade
RUN apt-get -y install openssl postfix bsd-mailx curl apt-transport-https lsb-release
# Updating image
RUN apt-get update && apt-get upgrade -y -o Dpkg::Options::="--force-confold"
# Set Wazuh repository.
RUN echo "deb https://packages.wazuh.com/3.x/apt/ stable main" | tee /etc/apt/sources.list.d/wazuh.list
RUN curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | apt-key add -
# Set nodejs repository.
RUN curl --silent --location https://deb.nodesource.com/setup_8.x | bash -
# Creating ossec user as uid:gid 1000:1000
RUN groupadd -g 1000 ossec
RUN useradd -u 1000 -g 1000 ossec
RUN curl --silent --location https://deb.nodesource.com/setup_6.x | bash - &&\
apt-get install -y nodejs
RUN curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | apt-key add -
RUN echo "deb https://packages.wazuh.com/3.x/apt/ stable main" | tee -a /etc/apt/sources.list.d/wazuh.list
RUN apt-get update && apt-get -y install wazuh-manager wazuh-api expect
# Configure postfix
RUN echo "postfix postfix/mailname string wazuh-manager" | debconf-set-selections
RUN echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
# Install packages
RUN apt-get update && apt-get -y install openssl postfix bsd-mailx python-boto python-pip \
apt-transport-https vim expect nodejs python-cryptography wazuh-manager=${WAZUH_VERSION} \
wazuh-api=${WAZUH_VERSION}
# Adding first run script.
ADD config/data_dirs.env /data_dirs.env
ADD config/init.bash /init.bash
@@ -19,18 +35,43 @@ RUN chmod 755 /init.bash &&\
sync && /init.bash &&\
sync && rm /init.bash
# Installing and configuring fiebeat
RUN curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-${FILEBEAT_VERSION}-amd64.deb &&\
dpkg -i filebeat-${FILEBEAT_VERSION}-amd64.deb && rm filebeat-${FILEBEAT_VERSION}-amd64.deb
dpkg -i filebeat-${FILEBEAT_VERSION}-amd64.deb && rm -f filebeat-${FILEBEAT_VERSION}-amd64.deb
COPY config/filebeat.yml /etc/filebeat/
RUN chmod go-w /etc/filebeat/filebeat.yml
ADD config/run.sh /tmp/run.sh
RUN chmod 755 /tmp/run.sh
# Adding entrypoint
ADD config/entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh
# Setting volumes
VOLUME ["/var/ossec/data"]
VOLUME ["/etc/filebeat"]
VOLUME ["/etc/postfix"]
EXPOSE 55000/tcp 1514/udp 1515/tcp 514/udp
# Services ports
EXPOSE 55000/tcp 1514/udp 1515/tcp 514/udp 1516/tcp
# Run supervisord so that the container will stay alive
# Clean up
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENTRYPOINT ["/tmp/run.sh"]
# Adding services
RUN mkdir /etc/service/wazuh
COPY config/wazuh.runit.service /etc/service/wazuh/run
RUN chmod +x /etc/service/wazuh/run
RUN mkdir /etc/service/wazuh-api
COPY config/wazuh-api.runit.service /etc/service/wazuh-api/run
RUN chmod +x /etc/service/wazuh-api/run
RUN mkdir /etc/service/postfix
COPY config/postfix.runit.service /etc/service/postfix/run
RUN chmod +x /etc/service/postfix/run
RUN mkdir /etc/service/filebeat
COPY config/filebeat.runit.service /etc/service/filebeat/run
RUN chmod +x /etc/service/filebeat/run
# Run all services
ENTRYPOINT ["/entrypoint.sh"]

View File

@@ -1,4 +1,5 @@
#!/bin/bash
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
#
# OSSEC container bootstrap. See the README for information of the environment
@@ -12,8 +13,13 @@
#
source /data_dirs.env
FIRST_TIME_INSTALLATION=false
DATA_PATH=/var/ossec/data
WAZUH_INSTALL_PATH=/var/ossec
DATA_PATH=${WAZUH_INSTALL_PATH}/data
WAZUH_CONFIG_MOUNT=/wazuh-config-mount
print() {
echo -e $1
@@ -29,6 +35,9 @@ exec_cmd() {
eval $1 > /dev/null 2>&1 || error_and_exit "$1"
}
exec_cmd_stdout() {
eval $1 2>&1 || error_and_exit "$1"
}
edit_configuration() { # $1 -> setting, $2 -> value
sed -i "s/^config.$1\s=.*/config.$1 = \"$2\";/g" "${DATA_PATH}/api/configuration/config.js" || error_and_exit "sed (editing configuration)"
@@ -75,11 +84,28 @@ then
fi
fi
##############################################################################
# Copy all files from $WAZUH_CONFIG_MOUNT to $DATA_PATH and respect
# destination files permissions
#
# For example, to mount the file /var/ossec/data/etc/ossec.conf, mount it at
# $WAZUH_CONFIG_MOUNT/etc/ossec.conf in your container and this code will
# replace the ossec.conf file in /var/ossec/data/etc with yours.
##############################################################################
if [ -e "$WAZUH_CONFIG_MOUNT" ]
then
print "Identified Wazuh configuration files to mount..."
exec_cmd_stdout "cp --verbose -r $WAZUH_CONFIG_MOUNT/* $DATA_PATH"
else
print "No Wazuh configuration files to mount..."
fi
# Enabling ossec-authd.
exec_cmd "/var/ossec/bin/ossec-control enable auth"
function ossec_shutdown(){
${DATA_PATH}/bin/ossec-control stop;
${WAZUH_INSTALL_PATH}/bin/ossec-control stop;
}
# Trap exit signals and do a proper shutdown
@@ -87,9 +113,4 @@ trap "ossec_shutdown; exit" SIGINT SIGTERM
chmod -R g+rw ${DATA_PATH}
service postfix start
service wazuh-api start
service wazuh-manager start
service filebeat start
tail -f /var/ossec/logs/ossec.log
/sbin/my_init

View File

@@ -0,0 +1,3 @@
#!/bin/sh
service filebeat start
tail -f /var/log/filebeat/filebeat

View File

@@ -1,3 +1,4 @@
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
filebeat:
prospectors:
- input_type: log

View File

@@ -1,4 +1,5 @@
#!/bin/bash
# Wazuh App Copyright (C) 2018 Wazuh Inc. (License GPLv2)
#
# Initialize the custom data directory layout

View File

@@ -0,0 +1,3 @@
#!/bin/sh
service postfix start
tail -f /var/log/mail.log

View File

@@ -0,0 +1,4 @@
#!/bin/sh
service wazuh-api start
tail -f /var/ossec/data/logs/api.log

View File

@@ -0,0 +1,4 @@
#!/bin/sh
service wazuh-manager start
tail -f /var/ossec/data/logs/ossec.log