From c16bc4c2bf15a4d1443abe50c59c1c7979759b9e Mon Sep 17 00:00:00 2001 From: neu5ron <> Date: Thu, 23 Jan 2020 17:27:32 -0500 Subject: [PATCH] cleanup --- .../helk-kibana/scripts/kibana-entrypoint.sh | 38 ++++++------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/docker/helk-kibana/scripts/kibana-entrypoint.sh b/docker/helk-kibana/scripts/kibana-entrypoint.sh index f5cd6cf..3c412bd 100755 --- a/docker/helk-kibana/scripts/kibana-entrypoint.sh +++ b/docker/helk-kibana/scripts/kibana-entrypoint.sh @@ -15,17 +15,17 @@ HELK_ERROR_TAG="HELK-KIBANA-DOCKER-$TAG_NAME-ERROR:" # *********** Install Plugins ********************* # *********** Environment Variables *************** -if [[ -z "$ELASTICSEARCH_HOSTS" ]]; then +if [ -z "$ELASTICSEARCH_HOSTS" ]; then export ELASTICSEARCH_HOSTS=http://helk-elasticsearch:9200 fi echo "$HELK_INFO_TAG Setting Elasticsearch URL to $ELASTICSEARCH_HOSTS" -if [[ -z "$SERVER_HOST" ]]; then +if [ -z "$SERVER_HOST" ]; then export SERVER_HOST=helk-kibana fi echo "$HELK_INFO_TAG Setting Kibana server to $SERVER_HOST" -if [[ -z "$SERVER_PORT" ]]; then +if [ -z "$SERVER_PORT" ]; then export SERVER_PORT=5601 fi echo "$HELK_INFO_TAG Setting Kibana server port to $SERVER_PORT" @@ -33,34 +33,18 @@ echo "$HELK_INFO_TAG Setting Kibana server port to $SERVER_PORT" KIBANA_HOST=http://$SERVER_HOST:$SERVER_PORT echo "$HELK_INFO_TAG Setting Kibana URL to $KIBANA_HOST" -if [[ -n "$ELASTICSEARCH_PASSWORD" ]]; then - if [[ -z "$ELASTICSEARCH_USERNAME" ]]; then +if [ -n "$ELASTICSEARCH_PASSWORD" ]; then + if [ -z "$ELASTICSEARCH_USERNAME" ]; then export ELASTICSEARCH_USERNAME=elastic - echo "$HELK_INFO_TAG Setting Elasticsearch username to access Elasticsearch to HELK's default" - else - echo "$HELK_INFO_TAG Setting Elasticsearch username to access Elasticsearch to your predfined username" fi - - if [[ -z "$KIBANA_USER" ]]; then + if [ -z "$KIBANA_USER" ]; then export KIBANA_USER=kibana - echo "$HELK_INFO_TAG Setting Kibana username to access Elasticsearch to HELK's default" - else - echo "$HELK_INFO_TAG Setting Kibana username to access Elasticsearch to your predfined username" fi - - if [[ -z "$KIBANA_PASSWORD" ]]; then + if [ -z "$KIBANA_PASSWORD" ]; then export KIBANA_PASSWORD=kibanapassword - echo "$HELK_INFO_TAG Setting Kibana password to access Elasticsearch to HELK's default" - echo "$HELK_INFO_TAG Setting Kibana password to HELK's default" - else - echo "$HELK_INFO_TAG Setting Kibana password to access Elasticsearch to your predfined password" fi - - if [[ -z "$KIBANA_UI_PASSWORD" ]]; then + if [ -z "$KIBANA_UI_PASSWORD" ]; then export KIBANA_UI_PASSWORD=hunting - echo "$HELK_INFO_TAG Setting Kibana UI password to HELK's default" - else - echo "$HELK_INFO_TAG Setting Kibana UI password to your predfined password" fi export ELASTICSEARCH_CREDS="${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}" @@ -74,8 +58,8 @@ export KIBANA_ACCESS export KIBANA_HOST # *********** Check if Elasticsearch is up *************** -until [[ "$(curl -s -o /dev/null -w "%{http_code}" -u "${ELASTICSEARCH_CREDS}" "${ELASTICSEARCH_HOSTS}")" == "200" ]]; do - echo "$HELK_INFO_TAG Waiting for elasticsearch URI to be accessible.." +until [ "$(curl -s -o /dev/null -w "%{http_code}" -u "${ELASTICSEARCH_CREDS}" "${ELASTICSEARCH_HOSTS}")" = "200" ]; do + echo "$HELK_INFO_TAG Waiting for very basic elasticsearch check.." sleep 5 done sleep 5 @@ -90,7 +74,7 @@ echo "$HELK_INFO_TAG Elasticsearch cluster is up.." # *********** Set Elastic License Variables *************** -if [[ -n "$ELASTICSEARCH_PASSWORD" ]]; then +if [ -n "$ELASTICSEARCH_PASSWORD" ]; then # *********** Change Kibana and Logstash password *************** echo "$HELK_INFO_TAG Submitting a request to change the password of a Kibana and Logstash users .." until curl -X POST -u "${ELASTICSEARCH_CREDS}" "${ELASTICSEARCH_HOSTS}"/_security/user/kibana/_password -H 'Content-Type:application/json' -d "{\"password\": \"${KIBANA_PASSWORD}\"}"