-
-
Notifications
You must be signed in to change notification settings - Fork 501
Closed
Description
I am trying to connect to a postgres database running on Heroku but having some issues related to TSL. Sorry if this isn't the right place to ask, but Google gave me nothing.
Cargo.toml
:
[package]
name = "instant-replay"
version = "0.1.0"
authors = ["davidpdrsn"]
[dependencies]
postgres = { version = "0.15", features = ["with-openssl"] }
main.rs
:
extern crate postgres;
use postgres::{Connection, TlsMode};
use postgres::tls::openssl::OpenSsl;
fn main() {
let openssl = OpenSsl::new().expect("failed to create openssl");
let connection = Connection::connect(
"postgres://_:_@_:5432/_?sslmode=require",
TlsMode::Prefer(&openssl),
).expect("failed to connect");
for row in &connection.query("select * from users limit 1", &[]).expect("query failed") {
println!("{:?}", row);
}
}
And finally the error
thread 'main' panicked at 'failed to connect: Error(Tls(Failure(MidHandshakeSslStream { stream: SslStream { stream: TcpStream { addr: V4(192.168.1.12:51332), peer: V4(54.228.220.197:5432), fd: 5 }, ssl: Ssl { state: "error", verify_result: X509VerifyError { code: 18, error: "self signed certificate" } } }, error: Ssl(ErrorStack([Error { code: 337047686, library: "SSL routines", function: "tls_process_server_certificate", reason: "certificate verify failed", file: "ssl/statem/statem_clnt.c", line: 1230 }])) })))', src/libcore/result.rs:859
stack backtrace:
0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
1: std::panicking::default_hook::{{closure}}
2: std::panicking::default_hook
3: std::panicking::rust_panic_with_hook
4: std::panicking::begin_panic
5: std::panicking::begin_panic_fmt
6: rust_begin_unwind
7: core::panicking::panic_fmt
8: core::result::unwrap_failed
9: <core::result::Result<T, E>>::expect
10: run::main
11: __rust_maybe_catch_panic
12: std::rt::lang_start
13: main
Any idea what I'm doing wrong?
everton
Metadata
Metadata
Assignees
Labels
No labels