-
Notifications
You must be signed in to change notification settings - Fork 3
OPGOPS-1734 Enable ssl for elasticsearch5 #127
base: master
Are you sure you want to change the base?
Changes from all commits
451ae89
1b717f0
0f15ef3
ff66b57
876daaa
9664aec
aaca8e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
version: '2' | ||
|
||
services: | ||
elasticsearch01: | ||
build: elasticsearch5 | ||
mem_limit: 1000000000 | ||
links: | ||
- elasticsearch02:elasticsearch-02 | ||
ports: | ||
- 9201:9200 | ||
environment: | ||
ELASTICSEARCH_NUMBER_OF_REPLICAS: 2 | ||
ELASTICSEARCH_NODE_NAME: elasticsearch-01 | ||
ELASTICSEARCH_CLUSTER_NODES_ONE: elasticsearch-01 | ||
ELASTICSEARCH_CLUSTER_NODES_TWO: elasticsearch-02 | ||
ELASTICSEARCH_CLUSTER_NODES_THREE: elasticsearch-03 | ||
|
||
elasticsearch02: | ||
build: elasticsearch5 | ||
mem_limit: 1000000000 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is known to cause issues. Use ES_JAVA_OPTS instead to limit the memory |
||
links: | ||
- elasticsearch03:elasticsearch-03 | ||
ports: | ||
- 9202:9200 | ||
environment: | ||
ELASTICSEARCH_NUMBER_OF_REPLICAS: 2 | ||
ELASTICSEARCH_NODE_NAME: elasticsearch-02 | ||
ELASTICSEARCH_CLUSTER_NODES_ONE: elasticsearch-01 | ||
ELASTICSEARCH_CLUSTER_NODES_TWO: elasticsearch-02 | ||
ELASTICSEARCH_CLUSTER_NODES_THREE: elasticsearch-03 | ||
|
||
elasticsearch03: | ||
build: elasticsearch5 | ||
mem_limit: 1000000000 | ||
ports: | ||
- 9203:9200 | ||
environment: | ||
ELASTICSEARCH_NUMBER_OF_REPLICAS: 2 | ||
ELASTICSEARCH_NODE_NAME: elasticsearch-03 | ||
ELASTICSEARCH_CLUSTER_NODES_ONE: elasticsearch-01 | ||
ELASTICSEARCH_CLUSTER_NODES_TWO: elasticsearch-02 | ||
ELASTICSEARCH_CLUSTER_NODES_THREE: elasticsearch-03 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,14 @@ node.data: false | |
{{if exists "/elasticsearch/gateway/expected/nodes" }}gateway.expected_nodes: {{ getv "/elasticsearch/gateway/expected/nodes" }}{{end}} | ||
{{if exists "/elasticsearch/gateway/recover/after/time" }}gateway.recover_after_time: {{ getv "/elasticsearch/gateway/recover/after/time" }}{{end}} | ||
{{if exists "/elasticsearch/gateway/recover/after/nodes" }}gateway.recover_after_nodes: {{ getv "/elasticsearch/gateway/recover/after/nodes" }}{{end}} | ||
|
||
|
||
xpack.ssl.key: /usr/share/elasticsearch/config/key.pem | ||
xpack.ssl.certificate: /usr/share/elasticsearch/config/cert.pem | ||
{{ if eq "TRUE" (toUpper (getv "/elasticsearch/usessl")) }} | ||
xpack.security.transport.ssl.enabled: true | ||
xpack.security.http.ssl.enabled: true | ||
{{ else }} | ||
xpack.security.transport.ssl.enabled: false | ||
xpack.security.http.ssl.enabled: false | ||
{{end}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how does elasticsearch behave if the certs are in place, but ssl is disabled There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As expected. elasticsearch starts but communication with external client and also between nodes is via HTTP. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We get default authorisation too. use |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we use a different init number here so we don't overwrite the base image behaviour? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Overriding keeps it simple. |
||
es_user=elasticsearch | ||
es_configpath=/usr/share/elasticsearch/config | ||
es_hostname=$ELASTICSEARCH_NODE_NAME | ||
|
||
# Check elasticsearch user exists | ||
if id $es_user >/dev/null 2>&1; then | ||
echo "$es_user user exists" | ||
else | ||
echo "Error: $es_user user does not exist" | ||
exit 1 | ||
fi | ||
|
||
if [ -s $es_configpath/ssl.crt ] || [ -s $es_configpath/cert.pem ] || [ -s $es_configpath/key.pem ] || [ -n "${SKIP_SSL_GENERATE}" ]; then | ||
echo "Skipping SSL certificate generation" | ||
else | ||
echo "Generating self-signed certificate" | ||
|
||
mkdir -p $es_configpath | ||
cd $es_configpath | ||
|
||
# Generating signing SSL private key | ||
openssl genrsa -des3 -passout pass:x -out key.pem 2048 | ||
|
||
# Removing passphrase from private key | ||
cp key.pem key.pem.orig | ||
openssl rsa -passin pass:x -in key.pem.orig -out key.pem | ||
|
||
# Generating certificate signing request | ||
openssl req -new -key key.pem -out cert.csr -subj "/C=GB/ST=GB/L=London/O=OPG/OU=Digital/CN=$es_hostname" | ||
|
||
# Generating self-signed certificate | ||
openssl x509 -req -days 3650 -in cert.csr -signkey key.pem -out cert.pem | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have the context of where elastic-scripts was used. They were empty during my runs
Shall I remove?