You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/client-concepts/certificates/working-with-certificates.asciidoc
+14-11Lines changed: 14 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,8 @@ that generated the certificate is trusted by the machine running the client code
21
21
to the cluster over HTTPS with the client.
22
22
23
23
If you are using your own CA which is not trusted however, .NET won't allow you to make HTTPS calls to that endpoint by default. With .NET,
24
-
you can pre-empt this though a custom validation callback on the global static`ServicePointManager.ServerCertificateValidationCallback`. Most examples you will find doing this this will simply return `true` from the
24
+
you can pre-empt this though a custom validation callback on the global static
25
+
`ServicePointManager.ServerCertificateValidationCallback`. Most examples you will find doing this this will simply return `true` from the
25
26
validation callback and merrily whistle off into the sunset. **This is not advisable** as it allows *any* HTTPS traffic through in the
26
27
current `AppDomain` *without* any validation. Here's a concrete example:
27
28
@@ -40,7 +41,8 @@ validation will not be performed for HTTPS connections to *both* Elasticsearch *
40
41
41
42
It's possible to also set a callback per service endpoint with .NET, and both Elasticsearch.NET and NEST expose this through
42
43
connection settings `ConnectionConfiguration` with Elasticsearch.Net and `ConnectionSettings` with NEST). You can do
43
-
your own validation in that handler or use one of the baked in handlers that we ship with out of the box, on the static class`CertificateValidations`.
44
+
your own validation in that handler or use one of the baked in handlers that we ship with out of the box, on the static class
45
+
`CertificateValidations`.
44
46
45
47
The two most basic ones are `AllowAll` and `DenyAll`, which accept or deny all SSL traffic to our nodes, respectively. Here's
46
48
a couple of examples.
@@ -55,7 +57,7 @@ public class DenyAllCertificatesCluster : SslAndKpiXPackCluster
55
57
{
56
58
protected override ConnectionSettings ConnectionSettings(ConnectionSettings s) => s
<1> synonymous with the previous lambda expression
@@ -80,8 +82,9 @@ public class AllowAllCertificatesCluster : SslAndKpiXPackCluster
80
82
If your client application has access to the public CA certificate locally, Elasticsearch.NET and NEST ship with some handy helpers
81
83
that can assert that a certificate the server presents is one that came from the local CA.
82
84
83
-
If you use X-Pack's {ref_current}/certutil.html`certutil` tool] to generate SSL certificates, the generated node certificate
84
-
does not include the CA in the certificate chain, in order to cut down on SSL handshake size. In those case you can use`CertificateValidations.AuthorityIsRoot` and pass it your local copy of the CA public key to assert that
85
+
If you use X-Pack's {ref_current}/certutil.html[+certutil+ tool] to generate SSL certificates, the generated node certificate
86
+
does not include the CA in the certificate chain, in order to cut down on SSL handshake size. In those case you can use
87
+
`CertificateValidations.AuthorityIsRoot` and pass it your local copy of the CA public key to assert that
85
88
the certificate the server presented was generated using it
86
89
87
90
[source,csharp]
@@ -115,7 +118,7 @@ the local CA certificate is part of the chain that was used to generate the serv
115
118
==== Client Certificates
116
119
117
120
X-Pack also allows you to configure a {xpack_current}/pki-realm.html[PKI realm] to enable user authentication
118
-
through client certificates. The {ref_current}/certutil.html`certutil` tool] included with X-Pack allows you to
121
+
through client certificates. The {ref_current}/certutil.html[+certutil+ tool] included with X-Pack allows you to
119
122
generate client certificates as well and assign the distinguished name (DN) of the
120
123
certificate to a user with a certain role.
121
124
@@ -133,12 +136,12 @@ You can set Client Certificates to use on all connections on `ConnectionSettings
133
136
----
134
137
public class PkiCluster : CertgenCaCluster
135
138
{
136
-
protected override ConnectionSettings Authenticate(ConnectionSettings s) => s <1>
139
+
protected override ConnectionSettings Authenticate(ConnectionSettings s) => s <1>
0 commit comments