Search code examples
databaserustssl-certificatequestdb

Insert data using the official Rust QuestDB client and self-signed certificate


I am trying to insert data using the official QuestDB Rust client. It all works good when using QuestDB without TLS, but when I enable TLS on my QuestDB Enterprise using a self-signed certificate, I get an error of certificate unknown.

When using the pgwire interface, I can insert data passing sslmode=require, and it works, so I can discard any problems with QuestDB recognising the certificate. But I cannot figure it out with Rust. I saw on the docs that there is an optional feature to insecure-skip-verify, so I added it to my Cargo.toml. Still same error.

[package]
name = "airplanes"
version = "0.1.0"
edition = "2018"

[dependencies]
chrono = "0.4"
rand = "0.8"
tokio = { version = "1", features = ["full"] }
questdb-rs = { version = "4.0.2", features = ["insecure-skip-verify"] }
structopt = "0.3"
futures = "0.3"  

[[bin]]
name = "airplanes"
path = "src/main.rs"

Solution

  • I'm no user of QuestDB but from the documentation for SenderBuilder, there is the method tls_ca that you can use to customize your certificate authority to source a local PEM-encoded file, and the tls_roots method to tell it where the file is.

    They even link to a directory on their GitHub that includes guidance for self-signed certificates.