Skip to content

Remote _reindex fail for HTTPS remotes #27267

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

Closed
floragunn opened this issue Nov 4, 2017 · 12 comments
Closed

Remote _reindex fail for HTTPS remotes #27267

floragunn opened this issue Nov 4, 2017 · 12 comments
Labels
:Distributed Indexing/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. >enhancement help wanted adoptme

Comments

@floragunn
Copy link

Elasticsearch version (bin/elasticsearch --version):
6.0.0-rc2

Plugins installed: []

JVM version (java -version):
n/a

OS version (uname -a if on a Unix-like system):
n/a

Description of the problem including expected versus actual behavior:
Remote _reindex fail for HTTPS remotes when remote does use custom CA or requires a client certificate. It seems there are several ssl.* properties missing. For me it should look like:

POST _reindex
{
  "source": {
    "remote": {
      "host": "https://otherhost:9200",
      "username": "user",
      "password": "pass",
      "ssl.certificate_authorities": ..., //trust custom CA's
      "ssl.verification_mode": ...,
      "ssl.certificate": ..., //client certificate for PKI auth
      "ssl.key": ..., //client certificate key for PKI auth
      "ssl.key_passphrase": ...,
    },
    "index":
    ...

The root cause is that TransportReindexAction.buildRestClient does not support custom trusted CA's nor allow the ability to authenticate the initiating cluster via PKI because its not capable of sending client certificates. Its also not possible to adjust the certificate verification mode.

If this is not going to be implemented there should be at least a note in the docs about this limitations here:

This also applies to ES 5.6 and earlier versions.

@javanna
Copy link
Member

javanna commented Nov 6, 2017

@nik9000 thoughts about this? Was this considered and does this make sense adding support for?

@floragunn
Copy link
Author

@javanna @nik9000 ping

@PhaedrusTheGreek
Copy link
Contributor

PhaedrusTheGreek commented Jan 8, 2018

You can workaround this by adding the CA to the default Java CA Keystore:

IMPORTANT: Backup the $JAVA_HOME/jre/lib/security/cacerts file before doing this
IMPORTANT: Understand the security implications of doing this

sudo keytool -keystore $JAVA_HOME/jre/lib/security/cacerts -importcert -alias my_internal_ca -file /path/to/your/ca.crt

The default password to the cacerts keystore is changeit

@floragunn
Copy link
Author

@PhaedrusTheGreek but that will not help in a case where i need to send a client certificate

@nik9000
Copy link
Member

nik9000 commented Jan 9, 2018

This makes sense to me as a thing to add but I'm not super clear on exactly how. Is the ssl certificate a string containing the certificate? I think making it a path to something on the Elasticsearch server's file system would get messy really fast.

@floragunn
Copy link
Author

Yes, why not a string containing a pem certificate (or a certificate chain) and the key. Its not different from having the plaintext password inside the request.

@lcawl lcawl added :Distributed Indexing/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. and removed :Reindex API labels Feb 13, 2018
@floragunn
Copy link
Author

@nik9000 @PhaedrusTheGreek @javanna ping

@nik9000
Copy link
Member

nik9000 commented Mar 23, 2018

This isn't on my list of things to do, no. I don't disagree with doing it though.

@Constantin07
Copy link

I'm facing the same issue but I'm using official Docker container and adding the CA certificate in Java keystore is inconvenient since now I'm bind mounting the certificates (CA, server.key, server.crt) in PEM format at container run stage.

@bleskes bleskes added the help wanted adoptme label May 22, 2018
@bleskes
Copy link
Contributor

bleskes commented May 22, 2018

@nik9000 I marked this as adopt me. Just in case someone wants to pick it up.

@hackery
Copy link

hackery commented Jul 5, 2018

IMPORTANT: Understand the security implications of doing this

For example, don't do it if you're using demo certificates!

@jaymode
Copy link
Member

jaymode commented Feb 15, 2019

Fixed by
#37527

@jaymode jaymode closed this as completed Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. >enhancement help wanted adoptme
Projects
None yet
Development

No branches or pull requests

9 participants