|
| 1 | +# CrateDB with SSL |
| 2 | + |
| 3 | +## About |
| 4 | + |
| 5 | +A service composition file (Docker or Podman) for running CrateDB |
| 6 | +with SSL enabled, using self-signed certificates. |
| 7 | + |
| 8 | +Accompanied are example client programs that connect to CrateDB/SSL |
| 9 | +using the canonical `?sslmode=require` connection option parameter, |
| 10 | +to use SSL, but turn off certificate validation. To turn it on, |
| 11 | +use `?sslmode=verify-ca` or `?sslmode=verify-full`. |
| 12 | + |
| 13 | +## Caveat |
| 14 | + |
| 15 | +Note this example is not generating fresh self-signed certificates, |
| 16 | +but uses the ones uploaded to the repository. In this spirit, anyone |
| 17 | +spinning an environment from this example will be using the same |
| 18 | +encryption keys. A future iteration might improve this, possibly by |
| 19 | +using [minica]. |
| 20 | + |
| 21 | +## Usage |
| 22 | + |
| 23 | +```shell |
| 24 | +docker compose up |
| 25 | +``` |
| 26 | + |
| 27 | +## Clients |
| 28 | + |
| 29 | +Client examples adjusted to disable certificate validation, allowing |
| 30 | +connections to the server with self-signed certificates. |
| 31 | + |
| 32 | +- [crash] » [client_crash.sh] |
| 33 | +- [DB API] » [client_dbapi.py] |
| 34 | +- [SQLAlchemy] » [client_sqlalchemy.py] |
| 35 | + |
| 36 | +## Tests |
| 37 | + |
| 38 | +```shell |
| 39 | +make test |
| 40 | +``` |
| 41 | + |
| 42 | +## Rationale |
| 43 | + |
| 44 | +When not disabling host name verification, clients will bail out with |
| 45 | +`SSLError`/`SSLCertVerificationError`: |
| 46 | +```text |
| 47 | +[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed |
| 48 | +certificate in certificate chain (_ssl.c:1010). |
| 49 | +``` |
| 50 | + |
| 51 | +## Backlog |
| 52 | + |
| 53 | +- Documentation is currently void of relevant ready-to-run examples |
| 54 | + - [Install with containers](https://cratedb.com/docs/guide/install/container/) |
| 55 | + - [Docker install guide](https://cratedb.com/docs/guide/install/container/docker.html) |
| 56 | + - [SSL Reference](https://cratedb.com/docs/crate/reference/en/latest/admin/ssl.html) |
| 57 | +- Possibly synchronize with `crate-pdo`, where this is derived from |
| 58 | + <https://github.com/crate/crate-pdo/tree/2.2.2/test/provisioning> |
| 59 | + |
| 60 | + |
| 61 | +[client_crash.sh]: ./client_crash.sh |
| 62 | +[client_dbapi.py]: ./client_dbapi.py |
| 63 | +[client_sqlalchemy.py]: ./client_sqlalchemy.py |
| 64 | +[crash]: https://cratedb.com/docs/crate/crash/ |
| 65 | +[DB API]: https://cratedb.com/docs/python/ |
| 66 | +[minica]: https://github.com/jsha/minica |
| 67 | +[SQLAlchemy]: https://cratedb.com/docs/sqlalchemy-cratedb/ |
0 commit comments