This repository has been archived by the owner on May 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[logstash] add security example (#392)
This commit add a security example to use Logstash Helm chart and Elasticsearch Helm chart with TLS encryption.
- Loading branch information
Showing
6 changed files
with
151 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ LOGSTASH_SUITE: | |
- default | ||
- oss | ||
- elasticsearch | ||
- security | ||
- 6.x | ||
APM_SERVER_SUITE: | ||
- default | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
default: test | ||
|
||
include ../../../helpers/examples.mk | ||
|
||
RELEASE := helm-logstash-security | ||
|
||
install: | ||
helm upgrade --wait --timeout=900 --install $(RELEASE) --values values.yaml ../../ | ||
|
||
test: install goss | ||
|
||
purge: | ||
helm del --purge $(RELEASE) | ||
kubectl delete $$(kubectl get pvc -l release=$(RELEASE) -o name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Security | ||
|
||
This example deploy Logstash 7.7.1 which connects to Elasticsearch using TLS | ||
(see [values][]). | ||
|
||
|
||
## Usage | ||
|
||
* Deploy [Elasticsearch Helm chart with security][]. | ||
|
||
* Deploy Logstash chart: `make install` | ||
|
||
* You can now setup a port forward to query Logstash indices: | ||
|
||
``` | ||
kubectl port-forward svc/elasticsearch-master 9200 | ||
curl localhost:9200/_cat/indices | ||
``` | ||
|
||
|
||
## Testing | ||
|
||
You can also run [goss integration tests][] using `make test` | ||
|
||
|
||
[elasticsearch helm chart with security]: https://github.com/elastic/helm-charts/tree/master/elasticsearch/examples/security/ | ||
[goss integration tests]: https://github.com/elastic/helm-charts/tree/master/logstash/examples/security/test/goss.yaml | ||
[values]: https://github.com/elastic/helm-charts/tree/master/logstash/examples/security/values.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
mount: | ||
/usr/share/logstash/data: | ||
exists: true | ||
/usr/share/logstash/config/logstash.yml: | ||
exists: true | ||
opts: | ||
- ro | ||
/usr/share/logstash/pipeline/uptime.conf: | ||
exists: true | ||
opts: | ||
- ro | ||
|
||
user: | ||
logstash: | ||
exists: true | ||
uid: 1000 | ||
gid: 1000 | ||
|
||
http: | ||
http://localhost:9600?pretty: | ||
status: 200 | ||
timeout: 2000 | ||
body: | ||
- '"host" : "helm-logstash-security-logstash-0"' | ||
- '"version" : "7.7.1"' | ||
- '"http_address" : "0.0.0.0:9600"' | ||
- '"name" : "helm-logstash-security-logstash-0"' | ||
- '"status" : "green"' | ||
- '"workers" : 1' | ||
- '"batch_size" : 125' | ||
- '"batch_delay" : 50' | ||
https://security-master:9200/_cat/indices: | ||
status: 200 | ||
timeout: 2000 | ||
body: | ||
- 'logstash' | ||
allow-insecure: true | ||
username: '{{ .Env.ELASTICSEARCH_USERNAME }}' | ||
password: '{{ .Env.ELASTICSEARCH_PASSWORD }}' | ||
|
||
file: | ||
/usr/share/logstash/config/logstash.yml: | ||
exists: true | ||
mode: "0644" | ||
owner: root | ||
group: logstash | ||
filetype: file | ||
contains: | ||
- 'http.host: 0.0.0.0' | ||
- 'xpack.monitoring.enabled: true' | ||
- 'xpack.monitoring.elasticsearch.hosts: ["https://security-master:9200"]' | ||
- 'xpack.monitoring.elasticsearch.ssl.certificate_authority: /usr/share/logstash/config/certs/elastic-certificate.crt' | ||
/usr/share/logstash/pipeline/uptime.conf: | ||
exists: true | ||
mode: "0644" | ||
owner: root | ||
group: logstash | ||
filetype: file | ||
contains: | ||
- 'input { exec { command => "uptime" interval => 30 } }' | ||
- 'output { elasticsearch {' | ||
- 'hosts => ["https://security-master:9200"]' | ||
- 'cacert => "/usr/share/logstash/config/certs/elastic-certificate.crt"' | ||
- 'index => "logstash"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
persistence: | ||
enabled: true | ||
|
||
logstashConfig: | ||
logstash.yml: | | ||
http.host: 0.0.0.0 | ||
xpack.monitoring.enabled: true | ||
xpack.monitoring.elasticsearch.username: '${ELASTICSEARCH_USERNAME}' | ||
xpack.monitoring.elasticsearch.password: '${ELASTICSEARCH_PASSWORD}' | ||
xpack.monitoring.elasticsearch.hosts: ["https://security-master:9200"] | ||
xpack.monitoring.elasticsearch.ssl.certificate_authority: /usr/share/logstash/config/certs/elastic-certificate.crt | ||
logstashPipeline: | ||
uptime.conf: | | ||
input { exec { command => "uptime" interval => 30 } } | ||
output { elasticsearch { | ||
hosts => ["https://security-master:9200"] | ||
cacert => "/usr/share/logstash/config/certs/elastic-certificate.crt" | ||
user => '${ELASTICSEARCH_USERNAME}' | ||
password => '${ELASTICSEARCH_PASSWORD}' | ||
index => "logstash" | ||
} | ||
} | ||
secretMounts: | ||
- name: elastic-certificate-crt | ||
secretName: elastic-certificate-crt | ||
path: /usr/share/logstash/config/certs | ||
|
||
extraEnvs: | ||
- name: 'ELASTICSEARCH_USERNAME' | ||
valueFrom: | ||
secretKeyRef: | ||
name: elastic-credentials | ||
key: username | ||
- name: 'ELASTICSEARCH_PASSWORD' | ||
valueFrom: | ||
secretKeyRef: | ||
name: elastic-credentials | ||
key: password |