0

I am trying to connect to a crate database with python

from crate import client
url = '434.342.435.2:4400' # Faked these numbers for purposes of this post
conn = client.connect(url)

It seems like I need to pass the cert_file and key_file arguments to client.connect which point to my .pem and .key files. Looking in the documentation, I cannot find any resource to create or download these files.

Any advice? Even a comment pointing me to a good resource for beginners would be appreciated.

Alex
  • 12,078
  • 6
  • 64
  • 74
  • 3
    If its your own development setup, you could probably use a self-signed certificate , instructions to generate one are here - http://serverfault.com/questions/224122/what-is-crt-and-key-and-how-can-i-generate-them , else you probably need to reach out to sys admins in your organisation for this info – pragman Dec 15 '16 at 19:04
  • The `cert_file` and `key_file` is optional and only needs to be provided if you're connecting to a Crate cluster that uses `https`. – mfussenegger Dec 16 '16 at 14:45
  • @mfussenegger when I connect in my browser I am prompted for a username and password. Does this imply I am connecting via `https`? – Alex Dec 16 '16 at 18:30

1 Answers1

1

So cert and key files are part of the TLS encryption of a HTTP(S) connection that are required if you use a self-signed certificate :)

This seems to be a very good explanation of the file types

As mfussenegger explained in the comment, these files are optional and only required if your CrateDB instance is "hidden" behind a reverse proxy server like NGINX or Apache with a self-signed certificate. A small green lock on the far left of your browser's address bar indicates HTTPS (and therefore TLS) with known certificates. valid certificate

Typically certificates signed by an unknown CA - like yourself - result in a warning page and a red indicator:

invalid certificate

Since you are also referring to username and password, they usually indicate some sort of auth (maybe basic auth) which is not yet supported by crate-python :(

claus
  • 377
  • 2
  • 9