Skip to content

Commit c7086ab

Browse files
committed
[HOT FIX] 01312019
helk ELK Updated to version 6.5.4 helk-logstash fix #156 + Pipeline Updated ++ More security events ++ Reduced regex complexity to split process paths to process names ++ Enabled Kafka output again for Win Security and Win Sysmon logs ++ Added more win security conversion events helk-elastalert fix #157 fix #159 ELK: + Consolidated ELK scripts to one per container instead of trial and basic helk-sigma + Updated own fork helk-jupyter + Updated Elastic ES-Hadoop to 6.5.4 helk-jupyter + jupyterlab-manager widgets + Updated pandas 0.24.0 + Updated altair 2.3.0
1 parent 9b7d224 commit c7086ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+838
-2326
lines changed

docker/helk-elastalert/rules/cobalt_strike_msagent.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

docker/helk-elastalert/rules/cobalt_strike_rundll32.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

docker/helk-elastalert/rules/psexec_psh.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

docker/helk-elastalert/rules/whoami.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

docker/helk-elastalert/scripts/elastalert-entrypoint.sh

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,65 +12,58 @@
1212
if [[ -z "$ES_HOST" ]]; then
1313
ES_HOST=helk-elasticsearch
1414
fi
15-
echo "[HELK-DOCKER-INSTALLATION-INFO] Setting Elasticsearch server name to $ES_HOST"
15+
echo "[HELK-ELASTALERT-DOCKER-INSTALLATION-INFO] Setting Elasticsearch server name to $ES_HOST"
1616

1717
if [[ -z "$ES_PORT" ]]; then
1818
ES_PORT=9200
1919
fi
20-
echo "[HELK-DOCKER-INSTALLATION-INFO] Setting Elasticsearch server port to $ES_PORT"
20+
echo "[HELK-ELASTALERT-DOCKER-INSTALLATION-INFO] Setting Elasticsearch server port to $ES_PORT"
2121

22-
if [[ "$ELASTIC_USERNAME" ]] && [[ "$ES_PASSWORD" ]]; then
22+
if [[ -n "$ELASTIC_PASSWORD" ]]; then
23+
if [[ -z "$ELASTIC_USERNAME" ]]; then
24+
ELASTIC_USERNAME=elastic
25+
fi
2326
echo "es_username: $ELASTIC_USERNAME" >> $ESALERT_HOME/config.yaml
2427
echo "es_password: $ELASTIC_PASSWORD" >> $ESALERT_HOME/config.yaml
25-
echo "[HELK-DOCKER-INSTALLATION-INFO] Setting Elasticsearch username to $ELASTIC_USERNAME"
26-
echo "[HELK-DOCKER-INSTALLATION-INFO] Setting Elasticsearch password to $ELASTIC_PASSWORD"
28+
echo "[HELK-ELASTALERT-DOCKER-INSTALLATION-INFO] Setting Elasticsearch username to $ELASTIC_USERNAME"
29+
echo "[HELK-ELASTALERT-DOCKER-INSTALLATION-INFO] Setting Elasticsearch password to $ELASTIC_PASSWORD"
2730
ELASTICSEARCH_ACCESS=http://$ELASTIC_USERNAME:"$ELASTIC_PASSWORD"@$ES_HOST:$ES_PORT
28-
if [[ "$KIBANA_HOST" ]] && [[ "$KIBANA_PORT" ]]; then
29-
KIBANA=$KIBANA_HOST:$KIBANA_PORT
30-
else
31-
exit 1
32-
fi
3331
else
3432
ELASTICSEARCH_ACCESS=http://$ES_HOST:$ES_PORT
3533
fi
3634

3735
# *********** Update Elastalert Config ******************
38-
echo "[HELK-DOCKER-INSTALLATION-INFO] Updating Elastalert main config.."
36+
echo "[HELK-ELASTALERT-DOCKER-INSTALLATION-INFO] Updating Elastalert main config.."
3937
sed -i "s/^es_host\:.*$/es_host\: ${ES_HOST}/g" $ESALERT_HOME/config.yaml
4038
sed -i "s/^es_port\:.*$/es_port\: ${ES_PORT}/g" $ESALERT_HOME/config.yaml
4139

4240
# *********** Check if Elasticsearch is up ***************
43-
echo "[HELK-DOCKER-INSTALLATION-INFO] Waiting for elasticsearch URI to be accessible.."
41+
echo "[HELK-ELASTALERT-DOCKER-INSTALLATION-INFO] Waiting for elasticsearch URI to be accessible.."
4442
until curl -s $ES_HOST:$ES_PORT -o /dev/null; do
4543
sleep 1
4644
done
4745

4846
# *********** Creating Elastalert Status Index ***************
4947
response_code=$(curl -s -o /dev/null -w "%{http_code}" $ELASTICSEARCH_ACCESS/elastalert_status)
5048
if [[ $response_code == 404 ]]; then
51-
echo "[HELK-DOCKER-INSTALLATION-INFO] Creating Elastalert index.."
52-
if [[ "$ELASTIC_PASSWORD" ]]; then
53-
# *********** Waiting for Kibana port to be up ***************
54-
echo "[++] Checking to see if kibana port is up..."
55-
until curl -s $KIBANA -o /dev/null; do
56-
sleep 1
57-
done
58-
elastalert-create-index --host $ES_HOST --port $ES_PORT --username $ELASTIC_USERNAME--password $ELASTIC_PASSWORD --no-auth --no-ssl --url-prefix '' --old-index ''
49+
echo "[HELK-ELASTALERT-DOCKER-INSTALLATION-INFO] Creating Elastalert index.."
50+
if [[ -n "$ELASTIC_PASSWORD" ]]; then
51+
elastalert-create-index --host $ES_HOST --port $ES_PORT --username $ELASTIC_USERNAME --password $ELASTIC_PASSWORD --no-auth --no-ssl --url-prefix '' --old-index ''
5952
else
6053
elastalert-create-index --host $ES_HOST --port $ES_PORT --no-auth --no-ssl --url-prefix '' --old-index ''
6154
fi
6255
else
63-
echo "[HELK-DOCKER-INSTALLATION-INFO] Elastalert index already exists"
56+
echo "[HELK-ELASTALERT-DOCKER-INSTALLATION-INFO] Elastalert index already exists"
6457
fi
6558

6659
# *********** Transform SIGMA Rules to Elastalert Signatures *************
67-
echo "[HELK-DOCKER-INSTALLATION-INFO] Executing pull-sigma.sh script.."
60+
echo "[HELK-ELASTALERT-DOCKER-INSTALLATION-INFO] Executing pull-sigma.sh script.."
6861
/etc/elastalert/pull-sigma.sh
6962

7063
# *********** Setting Slack Integration *************
7164
rule_counter=0
7265
if [[ "$SLACK_WEBHOOK_URL" ]]; then
73-
echo "[HELK-DOCKER-INSTALLATION-INFO] Setting Slack webhook url to $SLACK_WEBHOOK_URL.."
66+
echo "[HELK-ELASTALERT-DOCKER-INSTALLATION-INFO] Setting Slack webhook url to $SLACK_WEBHOOK_URL.."
7467
for er in $ESALERT_HOME/rules/*; do
7568
priority=$(sed -n -e 's/^priority: //p' $er)
7669
if [[ $priority = "1" ]]; then
@@ -96,5 +89,5 @@ if [[ "$SLACK_WEBHOOK_URL" ]]; then
9689
echo " "
9790
fi
9891

99-
echo "[HELK-DOCKER-INSTALLATION-INFO] Starting Elastalert.."
92+
echo "[HELK-ELASTALERT-DOCKER-INSTALLATION-INFO] Starting Elastalert.."
10093
exec "$@"

docker/helk-elastalert/scripts/pull-sigma.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
cd $ESALERT_SIGMA_HOME
1111

1212
# ******* Check if Elastalert rules folder has SIGMA rules ************
13-
echo "[+++] Checking if Elastalert rules folder has SIGMA rules.."
13+
echo "[HELK-ELASTALERT-DOCKER-INSTALLATION-INFO] Checking if Elastalert rules folder has SIGMA rules.."
1414
if ls $ESALERT_HOME/rules/ | grep -v '^helk_' >/dev/null 2>&1; then
1515
echo "[+++++] SIGMA rules available in rules folder.."
1616
SIGMA_RULES_AVAILABLE=YES
@@ -19,11 +19,11 @@ else
1919
fi
2020

2121
# ******* Check if local SIGMA repo needs update *************
22-
echo "[+++] Fetch updates for SIGMA remote.."
22+
echo "[HELK-ELASTALERT-DOCKER-INSTALLATION-INFO] Fetch updates for SIGMA remote.."
2323
git remote update
2424

2525
# Reference: https://stackoverflow.com/a/3278427
26-
echo "[+++] Checking to see if local SIGMA repo is up to date or not.."
26+
echo "[HELK-ELASTALERT-DOCKER-INSTALLATION-INFO] Checking to see if local SIGMA repo is up to date or not.."
2727
UPSTREAM=${1:-'@{u}'}
2828
LOCAL=$(git rev-parse @)
2929
REMOTE=$(git rev-parse "$UPSTREAM")
@@ -85,7 +85,7 @@ find $ESALERT_HOME/rules/ -type f -name 'sigma_sysmon_powershell_suspicious_para
8585

8686
# ******** Deleting Empty Files ***********
8787
echo " "
88-
echo "\Removing empty files.."
88+
echo "Removing empty files.."
8989
echo "-------------------------"
9090
rule_counter=0
9191
for ef in $ESALERT_HOME/rules/* ; do

docker/helk-elasticsearch/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
# References:
77
# https://cyberwardog.blogspot.com/2017/02/setting-up-pentesting-i-mean-threat_98.html
88

9-
FROM docker.elastic.co/elasticsearch/elasticsearch:6.5.3
9+
FROM docker.elastic.co/elasticsearch/elasticsearch:6.5.4
1010
LABEL maintainer="Roberto Rodriguez @Cyb3rWard0g"
1111
LABEL description="Dockerfile base for the HELK Elasticsearch."

docker/helk-elasticsearch/scripts/basic/elasticsearch-entrypoint.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

docker/helk-elasticsearch/scripts/trial/elasticsearch-entrypoint.sh renamed to docker/helk-elasticsearch/scripts/elasticsearch-entrypoint.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Author: Roberto Rodriguez (@Cyb3rWard0g)
77
# License: GPL-3.0
88

9-
# *********** Looking for ES ***************
9+
# *********** Setting ES_JAVA_OPTS ***************
1010
if [[ -z "$ES_JAVA_OPTS" ]]; then
1111
ES_MEMORY=$(awk '/MemAvailable/{printf "%.f", $2/1024/1024/2}' /proc/meminfo)
1212
if [ $ES_MEMORY -gt 31 ]; then
@@ -16,11 +16,20 @@ if [[ -z "$ES_JAVA_OPTS" ]]; then
1616
fi
1717
echo "[HELK-ES-DOCKER-INSTALLATION-INFO] Setting ES_JAVA_OPTS to $ES_JAVA_OPTS"
1818

19-
# *********** HELK ES Password ***************
20-
if [[ -z "$ELASTIC_PASSWORD" ]]; then
21-
export ELASTIC_PASSWORD=elasticpassword
19+
# ******** Checking License Type ***************
20+
ENVIRONMENT_VARIABLES=$(env)
21+
XPACK_LICENSE_TYPE="$(echo $ENVIRONMENT_VARIABLES | grep -oE 'xpack.license.self_generated.type=[^ ]*' | sed s/.*=//)"
22+
23+
# ******** Set Trial License Variables ***************
24+
if [[ $XPACK_LICENSE_TYPE == "trial" ]]; then
25+
# *********** HELK ES Password ***************
26+
if [[ -z "$ELASTIC_PASSWORD" ]]; then
27+
export ELASTIC_PASSWORD=elasticpassword
28+
fi
29+
echo "[HELK-ES-DOCKER-INSTALLATION-INFO] Setting Elastic password to $ELASTIC_PASSWORD"
2230
fi
23-
echo "[HELK-ES-DOCKER-INSTALLATION-INFO] Setting Elastic password to $ELASTIC_PASSWORD"
31+
32+
echo "[HELK-ES-DOCKER-INSTALLATION-INFO] Setting Elastic license to $XPACK_LICENSE_TYPE"
2433

2534
# ********** Starting Elasticsearch *****************
2635
echo "[HELK-ES-DOCKER-INSTALLATION-INFO] Running docker-entrypoint script.."

docker/helk-jupyter/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ENV DEBIAN_FRONTEND noninteractive
1111

1212
# *********** Setting Environment Variables ***************
1313
ENV JUPYTER_DIR=/opt/helk/jupyter
14-
ENV ESHADOOP_VERSION=6.5.3
14+
ENV ESHADOOP_VERSION=6.5.4
1515
ENV POSTGRESQL_VERSION=42.2.5
1616

1717
# *********** Installing Prerequisites ***************
@@ -23,18 +23,20 @@ RUN apt-get update -qq \
2323
libxml2-dev libxslt1-dev zlib1g-dev postgresql \
2424
# ********** Install PIP Packages ************
2525
&& sudo pip3 install --upgrade pip \
26-
&& pip3 install pandas==0.23.4 \
27-
altair==2.2.2 \
26+
&& pip3 install pandas==0.24.0 \
27+
altair==2.3.0 \
2828
jupyter==1.0.0 \
2929
jupyterlab==0.35.4 \
3030
jupyterhub==0.9.4 \
31+
ipywidgets==7.4.2 \
3132
# *********** Setting Jupyter Hub & Jupyter **********************
3233
&& curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - \
3334
&& apt-get install -y --no-install-recommends nodejs \
3435
&& npm install --production -g configurable-http-proxy \
3536
&& jupyter labextension install @jupyterlab/[email protected] \
3637
&& jupyter labextension install @jupyterlab/[email protected] \
3738
&& jupyter labextension install @mflevine/[email protected] \
39+
&& jupyter labextension install @jupyter-widgets/[email protected] \
3840
&& bash -c 'mkdir -pv /opt/helk/{es-hadoop,jupyter,jupyterhub}' \
3941
&& mkdir -v /usr/local/share/jupyter/kernels/pyspark3 \
4042
&& mkdir -v /var/log/spark \

0 commit comments

Comments
 (0)