Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Docker SSL/TLS getting started #27281

Closed
wants to merge 10 commits into from

Conversation

dliappis
Copy link
Contributor

@dliappis dliappis commented Nov 6, 2017

Commit docs for a getting started example for https and TLS/SSL enabled transport with the Docker Elasticsearch image.

@dliappis dliappis requested review from a user, joshbressers, skearns64 and drewr November 6, 2017 16:18
Copy link

@joshbressers joshbressers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is solid. Well done.

services:
create_certs:
container_name: create_certs
image: docker.elastic.co/elasticsearch/elasticsearch-platinum:6.0.0-rc2
Copy link
Contributor

@michaelbaamonde michaelbaamonde Nov 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we parameterize the version here and everywhere else that 6.0.0-rc2 is used? It's possible that I've got the workflow wrong, but it seems like you'll otherwise need to hard-code the version for each branch that this document will live on (master, 6.0, 6.x) in separate backport commits.

Copy link
Contributor Author

@dliappis dliappis Nov 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @michaelbaamonde addressed in 03d040d already, almost missed that!

Adding also // NOTCONSOLE for curl example
And display a warning message for versions that haven't been released
yet.
@dliappis
Copy link
Contributor Author

dliappis commented Nov 7, 2017

jenkins, test it

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even works on Windows (after installing Curl). Very nice!

[[getting-started-tls-docker]]
=== Getting started with TLS and Elasticsearch

Starting with version 6.0.0, x-pack licensed for security (gold, platinum or enterprise subscriptions) https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking-6.0.0-xes.html[requires SSL/TLS] encryption for the transport networking layer.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

X-Pack, Security, Gold, Platinum, and Enterprise are all proper nouns in this context, so they need capitals.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in d258de6


Starting with version 6.0.0, x-pack licensed for security (gold, platinum or enterprise subscriptions) https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking-6.0.0-xes.html[requires SSL/TLS] encryption for the transport networking layer.

This section demonstrates an easy path to get started with SSL/TLS for both http and transport using the elasticsearch-platinum docker image.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"HTTP" should be capped.

Consider backticks for elasticsearch-platinum.

"Docker" is a proper noun.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in d258de6

ip:
- 127.0.0.1

<1> Allow use of embedded Docker DNS server names.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than "allowing" DNS, isn't this line an imperative that we will create a DNS entry? Like:

"Create a record for this node in Docker's internal DNS"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this is done by Docker itself and its embedded DNS server. Here we just add the localhost IP address to the SAN records of the certificate, so that https calls, used in our examples, will work without issues.

volumes: {"esdata_01": {"driver": "local"}, "esdata_02": {"driver": "local"}}
----

<1> Bootstrap `elastic` with the password defined in `.env`. See {xpack-ref}/setting-up-authentication.html#bootstrap-elastic-passwords[the Elastic Boostrap Password].
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Boostrap" is missing a "t".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in d258de6

CERTS_DIR=/usr/share/elasticsearch/config/x-pack/certificates <1>
ELASTIC_PASSWORD=PleaseChangeMe <2>

<1> The path, inside the docker image, where certificates are expected to be found.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Docker" proper noun.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in d258de6

fi;
chgrp -R 0 config/x-pack/certificates/certs
'
user: ${UID:-1000}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AsciiDoc is trying to expand this as an attribute and failing:

asciidoc: WARNING: getting-started-tls-docker.asciidoc: line 71: illegal system attribute name: UID

Standard escaping seems to work:

$\{UID:-1000\}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! Addressed in d258de6

image: docker.elastic.co/elasticsearch/elasticsearch-platinum:{version}
command: >
bash -c '
if [[ ! -d config/x-pack/certificates/certs ]]; then
Copy link

@ghost ghost Nov 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we:

  • Indent the script under the opening qoute
  • Indent the conditional bodies within the script

?

Copy link
Contributor Author

@dliappis dliappis Nov 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in e73fb2a

<1> Bootstrap `elastic` with the password defined in `.env`. See {xpack-ref}/setting-up-authentication.html#bootstrap-elastic-passwords[the Elastic Boostrap Password].
<2> Disable verification of authenticity for inter-node communication. Allows creating self-signed certificates without having to pin specific internal IP addresses.
endif::[]

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to explain, but explained well here. Nice.

["source","sh"]
----
docker-compose -f create-certs.yml up
----
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth making the node containers "depend" on this one instead? Will that work? Is it too fiddly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed this is very tricky, because the create-certs docker container will eventually exit and it's hard to create a decent healthcheck in this case.

[[getting-started-tls-docker]]
=== Getting started with TLS and Elasticsearch

Starting with version 6.0.0, x-pack licensed for security (gold, platinum or enterprise subscriptions) https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking-6.0.0-xes.html[requires SSL/TLS] encryption for the transport networking layer.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "X-Pack Security" cleaner than "X-Pack licenced for Security"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in d258de6

@dliappis
Copy link
Contributor Author

dliappis commented Nov 8, 2017

Thanks for the thorough review @Jarpy , I have addressed the identified issues.

@ghost
Copy link

ghost commented Nov 9, 2017

Oh no, thank you.

@dliappis
Copy link
Contributor Author

Closed in lieu of #27333

cc @lcawl ^^

@dliappis dliappis closed this Nov 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants