Skip to content

Commit 1a50135

Browse files
committed
added secure elastic readme
1 parent 624051d commit 1a50135

File tree

6 files changed

+102
-80
lines changed

6 files changed

+102
-80
lines changed

elastic_kibana/ref.md

Whitespace-only changes.

elastic_secure/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ services:
3636
- data01:/usr/share/elasticsearch/data
3737
- ./certs:$CERTS_DIR
3838
- ./certs/ca/ca.crt:/usr/local/share/ca-certificates/ca.crt
39-
- ./changePassword.sh:/changePassword.sh
39+
- ./changePassword.sh:/usr/share/elasticsearch/changePassword.sh
4040
ports:
4141
- ${ELASTIC_PORT}:9200
4242
networks:

elastic_secure/example.env

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
ELASTIC_VERSION=8.8.0
2+
KIBANA_VERSION=8.7.1
3+
ELASTIC_SECURITY=true
4+
ELASTIC_PASSWORD=password
5+
KIBANA_PASSWORD=passwordkibana
6+
COMPOSE_PROJECT_NAME=es
7+
CERTS_DIR=/usr/share/elasticsearch/config/certificates
8+
KIBANA_ENCRYPTION_KEY=random32CharactorString
9+
ELASTIC_PORT=9200
10+
KIBANA_PORT=5601

elastic_secure/readme-old.md

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

elastic_secure/readme.md

Lines changed: 90 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,103 @@
1-
# Elastic - Kibana - Docker - Nginx - Letsencrypt
1+
# Setting up secure Elastic DB and Kibana with Docker
2+
3+
This guide will walk you through the steps to set up Elastic DB and Kibana using Docker Desktop. This is a basic setup with no security or password configuration.
4+
`If for simple setup, you can check [elasticdb](./../elasticdb/readme.md)
25

36
---
47

5-
### Introduction
8+
## Prerequisites
9+
10+
Before you begin, ensure you have Docker Desktop installed on your system. If not, follow the steps below to install Docker Desktop:
11+
12+
1. **Install Docker Desktop:**
13+
- Go to the Docker website: [https://www.docker.com/products/docker-desktop](https://www.docker.com/products/docker-desktop)
14+
- Download Docker Desktop for your operating system (Windows/Mac).
15+
- Follow the installation instructions provided for your platform.
616

7-
Setup a Elastic + Kibana stack in seconds! Ready for public use with TLS enabled between nodes, and automatic SSL/TLS certificates + renewal with certbot and Nginx.
17+
## Setup Elastic DB and Kibana
818

9-
Docker-compose follows Elastic's official documentation for creating a Elastic Stack on Docker. More information can be found on their official site.
10-
https://www.elastic.co/guide/en/elastic-stack-get-started/current/get-started-docker.html
11-
https://www.elastic.co/guide/en/elasticsearch/reference/current/configuring-tls-docker.html
19+
Follow these steps to set up Elastic DB and Kibana using Docker Desktop:
1220

13-
### DISCLAIMER
21+
1. **Create .env file, and put env variables like in example.env file:**
1422

15-
Instructions and scripts are designed to be used with the version listed in the .env file.
23+
```env
24+
ELASTIC_VERSION=8.8.0
25+
KIBANA_VERSION=8.7.1
26+
ELASTIC_SECURITY=true
27+
ELASTIC_PASSWORD=password
28+
KIBANA_PASSWORD=passwordkibana
29+
COMPOSE_PROJECT_NAME=es
30+
CERTS_DIR=/usr/share/elasticsearch/config/certificates
31+
KIBANA_ENCRYPTION_KEY=random32CharactorString
32+
ELASTIC_PORT=9200
33+
KIBANA_PORT=5601
1634
17-
### Instructions
35+
```
1836

19-
1. Create Certificate Authority:
37+
2. **Create Certificate Authority:**
2038
- Install Openssl if your system don't have.
2139
- Certificate Url [Opensssl Download](https://knowledge.digicert.com/solution/generate-a-certificate-signing-request-using-openssl-on-microsoft-windows-system)
22-
- private key
23-
`openssl genpkey -algorithm RSA -out ca.key`
40+
- create folder:
41+
42+
```bash
43+
mkdir -p folder/subfolder
44+
```
45+
46+
- create private key
47+
48+
```bash
49+
openssl genpkey -algorithm RSA -out certs/ca/ca.key
50+
```
51+
2452
- private certificate
25-
`openssl req -x509 -new -key ca.key -out ca.crt`.
2653

27-
2. Setup Docker Compose: (https://github.com/wdrdres3qew5ts21/MeetU/blob/master/docker-compose-elastic-single-full-ssl.yml)
28-
29-
3.
54+
```bash
55+
openssl req -x509 -new -key certs/ca/ca.key -out certs/ca/ca.crt
56+
```
57+
58+
- after this you will see certs folder with ca certificates.
59+
60+
3. **Create TLS certificates for encrypted communications between nodes:**
61+
62+
```bash
63+
docker-compose -f create-certs.yml run --rm create_certs
64+
```
65+
66+
- in cert folder you will see es01 and kib01 folder respectively.
67+
68+
4. **Run Docker Compose:**
69+
70+
```bash
71+
docker-compose up -d
72+
```
73+
74+
This command will start Elastic DB and Kibana containers in the background.
75+
76+
5. **Change Password for kibana**
77+
78+
- open bash inside es01 container
79+
80+
```bash
81+
docker exec -it es01 bash
82+
```
83+
84+
- run changePassword.sh mounted inside the container
85+
86+
```bash
87+
sh /usr/share/elasticsearch/changePassword.sh
88+
```
89+
90+
6. **Access Elastic Kibana:**
91+
- Open your web browser and go to [https://localhost:5601](https://localhost:5601).
92+
- You should see the Kibana login page.
93+
- put user as: elastic and password value from your env file ELASTIC_PASSWORD.
94+
95+
96+
## Notes
97+
98+
- By default, this setup does not include any security or password protection. It's recommended to configure security settings according to your requirements before deploying to production.
99+
- Ensure that Docker Desktop is running before executing Docker Compose commands.
100+
- Docker-compose follows Elastic's official documentation for creating a Elastic Stack on Docker. More information can be found on their official site.
101+
<https://www.elastic.co/guide/en/elastic-stack-get-started/current/get-started-docker.html>
102+
<https://www.elastic.co/guide/en/elasticsearch/reference/current/configuring-tls-docker.html>
103+

es_data_provider/example.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ELASTIC_URL='https://localhost:9200'
1+
ELASTIC_URL='http://localhost:9200'

0 commit comments

Comments
 (0)