Skip to content

Commit

Permalink
Adding conf samples and updated scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Rickard authored and Josh Rickard committed Nov 10, 2020
1 parent 6a8b374 commit 67c9008
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 47 deletions.
1 change: 1 addition & 0 deletions .env-example
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ STAGING=true
# swag Configuration
DOMAIN=mydomain.com
SUBDOMAIN=kibana
#SUBFOLDER=kibana
[email protected]
TIMEZONE=America/Chicago
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This docker-compose project will assist with setting up and creating a ELK stack
## Environment Details

This project was built so that you can test and use built-in features under Kibana SIEM, like detections, signals, cases, and other features.
This project was built so that you can test and use built-in features under Elastic Security, like detections, signals, cases, and other features.

This docker-compose project will create the following Elastic containers based on version 7.9.2:

Expand Down Expand Up @@ -52,6 +52,7 @@ STAGING=true
# swag Configuration
DOMAIN=mydomain.com
SUBDOMAIN=kibana
#SUBFOLDER=kibana
[email protected]
TIMEZONE=America/Chicago
```
Expand All @@ -66,7 +67,6 @@ You can find more documentation about these settings in our [WiKi](https://githu

Before we build or create our containers we first need to create our keystore and certificates. You can do this using the [docker-compose.setup.yml](docker-compose.setup.yml) yaml file. If you run into issues you can see the associated documentation in our [WiKi Page about Certificates](https://github.com/swimlane/elk-tls-docker/wiki/Certificates) or create an issue in this repository.


#### Creating Keystore for self-signed certificates

By default creation of self-signed certificates is used and makes the most sense when testing out this project. To do so you simply run the following command first:
Expand Down Expand Up @@ -96,11 +96,7 @@ You can find additioanl information about the environments that are created on y

## Running a production environment

Now, that you have your keys/certs and [passwords](https://github.com/swimlane/elk-tls-docker/wiki/Setting%20Passwords) set we can then just restart the containers by running:

```
docker-compose -f docker-compose.production.yml -f docker-compose.override.yml up -d
```
Here is a [walkthrough](https://github.com/swimlane/elk-tls-docker/wiki/Letsencrypt%20Walkthrough) on setting up a production-like environment using LetsEncrypt.

You should be able to login into the ELK stack and be on your way.

Expand Down
2 changes: 0 additions & 2 deletions docker-compose.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ services:
- VALIDATION=http
- EMAIL=${EMAIL}
- STAGING=false
- MYSUBDOMAIN=${SUBDOMAIN}
volumes:
- ./swag/nginx/proxy-confs/kibana.subdomain.conf:/config/nginx/proxy-confs/${SUBDOMAIN}.subdomain.conf
- ./swag:/config
ports:
- 443:443
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ services:
- ./setup/instances.yml:${ELASTIC_DIR}/config/instances.yml:ro
environment:
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD}
SUBDOMAIN: ${SUBDOMAIN}
SUBFOLDER: ${SUBFOLDER}
networks:
- elk

Expand Down
14 changes: 14 additions & 0 deletions setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ create_self_signed_ca()
unzip $CA_ZIP -d $OUTPUT_DIR
}

rename_swag_confs()
{
if [ "$SUBDOMAIN" ]; then
mv "/swag/nginx/proxy-confs/kibana.subdomain.conf.sample" "/swag/nginx/proxy-confs/$SUBDOMAIN.subdomain.conf"
sed -i -e "s/REPLACE_ME.*;/$SUBDOMAIN.*;/" "/swag/nginx/proxy-confs/$SUBDOMAIN.subdomain.conf"
elif [ "$SUBFOLDER" ]; then
mv "/swag/nginx/proxy-confs/kibana.subfolder.conf.sample" "/swag/nginx/proxy-confs/$SUBFOLDER.subfolder.conf"
sed -e "s/\\REPLACE_ME/\\$SUBFOLDER/" "/swag/nginx/proxy-confs/$SUBFOLDER.subfolder.conf"
else
echo "No SUBDOMAIN or SUBFOLDER variable set.... skipping ...."
fi
}

if [ "$STAGING"]; then
create_keystore
remove_existing_certificates
Expand All @@ -112,6 +125,7 @@ else
touch "$OUTPUT_DIR/.temp"
echo "Creating temporary ca for initial setup"
create_self_signed_ca
rename_swag_confs
fi
fi

Expand Down
38 changes: 0 additions & 38 deletions swag/nginx/proxy-confs/kibana.subdomain.conf

This file was deleted.

15 changes: 15 additions & 0 deletions swag/nginx/proxy-confs/kibana.subdomain.conf.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name REPLACE_ME.*;
include /config/nginx/ssl.conf;
client_max_body_size 0;
location / {
include /config/nginx/proxy.conf;
resolver 127.0.0.11 valid=30s;
set $upstream_app kibana;
set $upstream_port 5601;
set $upstream_proto https;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}
}
8 changes: 8 additions & 0 deletions swag/nginx/proxy-confs/kibana.subfolder.conf.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
location ^~ /REPLACE_ME {
include /config/nginx/proxy.conf;
resolver 127.0.0.11 valid=30s;
set $upstream_app kibana;
set $upstream_port 5601;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}

0 comments on commit 67c9008

Please sign in to comment.