- Apr 25, 2015
- 1,845
- 2
- 2,199
- 327
Anyone go like wtf am I supposed to do? Elk, what.. that a deer, he got hop hop through snow.
He go moo? No, wtf noise he make. He go Docker..
Time to get legit, sorry.. I am f**k*ng tired and need more sleep lmao. But time to show how we proper do an ELK build.
1. Get Debian because Ubuntu sucks.
2. Install your Debian.
3. apt update
4. apt upgrade
5. apt install docker docker.io docker-compose git -y
Here is the ELK party time:
Time to find their changeme bullshit:
The above gives us all the locations changeme exists.
Let's read instructions fast:
Let's see all the files we have to change "changeme" in:
Simplify this shit with cut.. when things get too hard just cut AHAHAHAHAH:
We noticed some duplicates, fuck that.
This shows us:
Not hard, time to edit all this sh** could use sed maybe.. 1sec? Hold beer pls
Sed can do this shtufff
So, let's apply to our shtttufff:
That is an example, you could probably further expedite the searching and replacing using xargs for example. idgaf, figure it outtt if you do..
Already started? Nuke your docker shit - CAREFUL THIS MAKES AL LDOCKER SHIT GO BYE BYE:
Noice mate, try to do your compose all over:
Thing is.. Kibana is going to take its sweet ass time to boot up, so don't go mad if it takes time for the port to be ready.
But keep in mind even when you change the changeme password from this elk stack stuff, you are going to want to listen to the instructions above with generating users hopefully you can have fun and use this neat tool.. WITHOUT default creds.
He go moo? No, wtf noise he make. He go Docker..
Time to get legit, sorry.. I am f**k*ng tired and need more sleep lmao. But time to show how we proper do an ELK build.
1. Get Debian because Ubuntu sucks.
2. Install your Debian.
3. apt update
4. apt upgrade
5. apt install docker docker.io docker-compose git -y
Here is the ELK party time:
Code:
cd ~
git clone https://github.com/deviantony/docker-elk.git
cd ./docker-elk
Time to find their changeme bullshit:
Code:
grep -rnw './' -e 'changeme'
The above gives us all the locations changeme exists.
Let's read instructions fast:
The stack is pre-configured with the following **privileged** bootstrap user:
* user: *elastic*
* password: *changeme*
Although all stack components work out-of-the-box with this user, we strongly recommend using the unprivileged [built-in
users][builtin-users] instead for increased security.
1. Initialize passwords for built-in users
```console
$ docker-compose exec -T elasticsearch bin/elasticsearch-setup-passwords auto --batch
```
Passwords for all 6 built-in users will be randomly generated. Take note of them.
2. Unset the bootstrap password (_optional_)
Remove the `ELASTIC_PASSWORD` environment variable from the `elasticsearch` service inside the Compose file
(`docker-compose.yml`). It is only used to initialize the keystore during the initial startup of Elasticsearch.
3. Replace usernames and passwords in configuration files
Use the `kibana` user inside the Kibana configuration file (`kibana/config/kibana.yml`) and the `logstash_system` user
inside the Logstash configuration file (`logstash/config/logstash.yml`) in place of the existing `elastic` user.
Replace the password for the `elastic` user inside the Logstash pipeline file (`logstash/pipeline/logstash.conf`).
> :information_source: Do not use the `logstash_system` user inside the Logstash *pipeline* file, it does not have
> sufficient permissions to create indices. Follow the instructions at [Configuring Security in Logstash][ls-security]
> to create a user with suitable roles.
See also the [Configuration](#configuration) section below.
4. Restart Kibana and Logstash to apply changes
```console
$ docker-compose restart kibana logstash
```
> :information_source: Learn more about the security of the Elastic stack at [Tutorial: Getting started with
> security][sec-tutorial].
### Injecting data
Give Kibana about a minute to initialize, then access the Kibana web UI by hitting
[http://localhost:5601](http://localhost:5601) with a web browser and use the following default credentials to log in:
* user: *elastic*
* password: *\<your generated elastic password>*
Now that the stack is running, you can go ahead and inject some log entries. The shipped Logstash configuration allows
you to send content via TCP:
Let's see all the files we have to change "changeme" in:
Code:
k:~/docker-elk# grep -rnw './' -e 'changeme'
./extensions/apm-server/config/apm-server.yml:8: password: changeme
./kibana/config/kibana.yml:13:elasticsearch.password: changeme
./logstash/pipeline/logstash.conf:13: password => "changeme"
./logstash/config/logstash.yml:12:xpack.monitoring.elasticsearch.password: changeme
./README.md:133:* password: *changeme*
./.travis/run-tests.sh:61:poll_ready elasticsearch 'http://localhost:9200/' 'elastic:changeme'
./.travis/run-tests.sh:64:poll_ready kibana 'http://localhost:5601/api/status' 'kibana:changeme'
./.travis/run-tests.sh:75: -u elastic:changeme \
./.travis/run-tests.sh:79:response="$(curl 'http://localhost:5601/api/saved_objects/_find?type=index-pattern' -u elastic:changeme)"
./.travis/run-tests.sh:91:curl -X POST 'http://localhost:9200/_refresh' -u elastic:changeme \
./.travis/run-tests.sh:95:response="$(curl 'http://localhost:9200/_count?q=message:dockerelk&pretty' -u elastic:changeme)"
./.travis/elasticsearch-setup-passwords.exp:5:set password "changeme"
./docker-stack.yml:15: ELASTIC_PASSWORD: changeme
./docker-compose.yml:22: ELASTIC_PASSWORD: changeme
Simplify this shit with cut.. when things get too hard just cut AHAHAHAHAH:
Code:
grep -rnw './' -e 'changeme' | cut -d ':' -f 1
We noticed some duplicates, fuck that.
Code:
grep -rnw './' -e 'changeme' | cut -d ':' -f 1 | sort | uniq -c
This shows us:
Code:
k:~/docker-elk# grep -rnw './' -e 'changeme' | cut -d ':' -f 1 | sort | uniq -c
1 ./docker-compose.yml
1 ./docker-stack.yml
1 ./extensions/apm-server/config/apm-server.yml
1 ./kibana/config/kibana.yml
1 ./logstash/config/logstash.yml
1 ./logstash/pipeline/logstash.conf
1 ./README.md
1 ./.travis/elasticsearch-setup-passwords.exp
6 ./.travis/run-tests.sh
Not hard, time to edit all this sh** could use sed maybe.. 1sec? Hold beer pls
Sed can do this shtufff
Code:
sed -i 's/old-text/new-text/g'
So, let's apply to our shtttufff:
Code:
sed -i 's/changeme/myPasswd12inchesUrsIsOnly6/g' ./docker-compose.yml
sed -i 's/changeme/myPasswd12inchesUrsIsOnly6/g' ./docker-stack.yml
sed -i 's/changeme/myPasswd12inchesUrsIsOnly6/g' ./extensions/apm-server/config/apm-server.yml
sed -i 's/changeme/myPasswd12inchesUrsIsOnly6/g' ./kibana/config/kibana.yml
sed -i 's/changeme/myPasswd12inchesUrsIsOnly6/g' ./logstash/config/logstash.yml
sed -i 's/changeme/myPasswd12inchesUrsIsOnly6/g' ./logstash/pipeline/logstash.conf
sed -i 's/changeme/myPasswd12inchesUrsIsOnly6/g' ./README.md
sed -i 's/changeme/myPasswd12inchesUrsIsOnly6/g' ./.travis/elasticsearch-setup-passwords.exp
sed -i 's/changeme/myPasswd12inchesUrsIsOnly6/g' ./.travis/run-tests.sh
That is an example, you could probably further expedite the searching and replacing using xargs for example. idgaf, figure it outtt if you do..
Already started? Nuke your docker shit - CAREFUL THIS MAKES AL LDOCKER SHIT GO BYE BYE:
Code:
docker container stop $(docker container ls -aq)
docker container rm $(docker container ls -aq)
docker image prune -a
docker system prune
docker system prune --volumes
Noice mate, try to do your compose all over:
Code:
docker-compose up -d
Thing is.. Kibana is going to take its sweet ass time to boot up, so don't go mad if it takes time for the port to be ready.
Kibana server is not ready yet
But keep in mind even when you change the changeme password from this elk stack stuff, you are going to want to listen to the instructions above with generating users hopefully you can have fun and use this neat tool.. WITHOUT default creds.
Last edited: