1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! The PostgreSQL catalog (cargo feature `postgres`), a preview: the
//! connector and the pool the catalog's statements will run on.
//!
//! - Every connection is TLS, with the server's certificate chain and host
//! name verified by rustls against `catalog.postgres.ca_file` or the
//! system's certificate authorities; a server that does not offer TLS is
//! refused.
//! - With a password, the only login accepted is SCRAM-SHA-256 with channel
//! binding (SCRAM-SHA-256-PLUS): tokio-postgres's `ChannelBinding::Require`
//! refuses an `md5`, `password` or `trust` answer before it sends the
//! password. With a client certificate and no password, the server's
//! `cert` and `trust` methods both answer AuthenticationOk, which a
//! client cannot tell apart.
//! - A standby, a server with `transaction_read_only` on, a superuser and a
//! role with BYPASSRLS are refused on each new connection.
//! - The secret files are read once, before any connection
//! ([`secrets::Secrets::read`]); the pool reconnects from memory.
//!
//! No catalog statement runs here yet: [`preview`] connects, checks the
//! server, and refuses to go on.
use crate;
use Connector;
use Pool;
use Secrets;
/// What a start with a PostgreSQL catalog ends with in this release: the
/// secret files read, one connection made and the server checked, then a
/// refusal that names the server reached, since the catalogs are not kept
/// there yet. Every other outcome is the refusal of the step that failed.
pub async