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

Fix connection to servers with self-signed certificates or unknown certificate authority #414

Merged
merged 3 commits into from
Feb 19, 2018

Conversation

kesslerm
Copy link
Contributor

@kesslerm kesslerm commented Feb 9, 2018

The metrics module fails to connect to the Elasticsearch metrics store,
if secure transport is used and the server has a self signed certificate
or a certificate signed by a certificate authority that's not in the
certificate store provided by certifi.

  • Introduce a non-mandatory setting that allows turning off certificate verification.
  • Introduce a non-mandatroy setting to override the ca_certs certificate store.

Fixes #413

…rtificate authority

The metrics module fails to connect to the Elasticsearch metrics store,
if secure transport is used and the server has a self signed certificate
or a certificate signed by a certificate authority that's not in the
certificate store provided by `certifi`.

+ Introduce a non-mandatory setting that allows turning off certificate verification.
+ Introduce a non-mandatroy setting to override the ca_certs certificate store.

Fixes elastic#413
Copy link
Member

@danielmitterdorfer danielmitterdorfer left a comment

Choose a reason for hiding this comment

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

Many thanks for the PR @kesslerm! I left two suggestions for the property names. I think would also be good to document these two properties towards the end of the section https://github.com/elastic/rally/blob/master/docs/configuration.rst#advanced-configuration.

@@ -130,6 +130,11 @@ def __init__(self, cfg):
secure = self._config.opts("reporting", "datastore.secure") == "True"
user = self._config.opts("reporting", "datastore.user")
password = self._config.opts("reporting", "datastore.password")
# poor man's boolean conversion
verify_certs = self._config.opts("reporting", "datastore.verify_certs", default_value="True", mandatory=False) == "True"
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather use datastore.certs.verify as name (in the config file we usually use dots as a separator).

@@ -130,6 +130,11 @@ def __init__(self, cfg):
secure = self._config.opts("reporting", "datastore.secure") == "True"
user = self._config.opts("reporting", "datastore.user")
password = self._config.opts("reporting", "datastore.password")
# poor man's boolean conversion
verify_certs = self._config.opts("reporting", "datastore.verify_certs", default_value="True", mandatory=False) == "True"
ca_certs = self._config.opts("reporting", "datastore.ca_certs", default_value=None, mandatory=False)
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather use datastore.certs.path as a name.

@danielmitterdorfer danielmitterdorfer added enhancement Improves the status quo :Metrics How metrics are stored, calculated or aggregated labels Feb 13, 2018
Copy link
Member

@danielmitterdorfer danielmitterdorfer left a comment

Choose a reason for hiding this comment

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

Apart from a minor comment with reStructuredText syntax, the changes look good. Can you please adjust the syntax as suggested? Then I think we can merge it.

@@ -124,7 +124,7 @@ Rally will ask you a few more things in the advanced setup:
* **Elasticsearch project directory**: This is the directory where the Elasticsearch sources are located. If you don't actively develop on Elasticsearch you can just leave the default but if you want to benchmark local changes you should point Rally to your project directory. Note that Rally will run builds with Gradle in this directory (it runs ``gradle clean`` and ``gradle :distribution:tar:assemble``).
* **JDK root directory**: Rally will only ask this if it could not autodetect the JDK home by itself. Just enter the root directory of the JDK you want to use. By default, Rally will choose Java 8 if available and fallback to Java 9.
* **Metrics store type**: You can choose between ``in-memory`` which requires no additional setup or ``elasticsearch`` which requires that you start a dedicated Elasticsearch instance to store metrics but gives you much more flexibility to analyse results.
* **Metrics store settings** (only for metrics store type ``elasticsearch``): Provide the connection details to the Elasticsearch metrics store. This should be an instance that you use just for Rally but it can be a rather small one. A single node cluster with default setting should do it.
* **Metrics store settings** (only for metrics store type ``elasticsearch``): Provide the connection details to the Elasticsearch metrics store. This should be an instance that you use just for Rally but it can be a rather small one. A single node cluster with default setting should do it. When using self-signed certificates on the Elasticsearch metrics store, certificate verification can be turned off by setting the `datastore.ssl.verification_mode` setting to `none`. Alternatively you can enter the path to the certificate authority's signing certificate in `datastore.ssl.certificate_authorities`. Both settings are optional.
Copy link
Member

Choose a reason for hiding this comment

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

One minor thing: Contrary to Markdown, reStructuredText requires two backticks for literal text. So e.g. instead of:

`datastore.ssl.verification_mode`

you need to write

``datastore.ssl.verification_mode``

Copy link
Member

@danielmitterdorfer danielmitterdorfer left a comment

Choose a reason for hiding this comment

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

Unfortunately, I missed your commit. LGTM now. Thanks for your contribution.

@danielmitterdorfer danielmitterdorfer merged commit d7faab5 into elastic:master Feb 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves the status quo :Metrics How metrics are stored, calculated or aggregated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants