pub enum SslMode {
Disable,
Prefer,
Require,
VerifyCa,
VerifyFull,
}Expand description
SSL/TLS connection mode.
These modes match PostgreSQL’s sslmode connection parameter.
See PostgreSQL SSL Support
for detailed documentation.
Variants§
Disable
Never use TLS. Connection will fail if server requires TLS.
Prefer
Try TLS first, fall back to unencrypted if server doesn’t support it.
Warning: Vulnerable to downgrade attacks. Not recommended for production.
Require
Require TLS but don’t verify the server certificate.
Protects against passive eavesdropping but not active MITM attacks.
VerifyCa
Require TLS and verify the server certificate chain against trusted CAs.
Does NOT verify that the certificate hostname matches the connection target.
VerifyFull
Require TLS, verify certificate chain, AND verify hostname matches.
Recommended for production. Provides full protection against MITM attacks.
Implementations§
Source§impl SslMode
impl SslMode
Sourcepub fn requires_tls(&self) -> bool
pub fn requires_tls(&self) -> bool
Returns true if this mode requires TLS (won’t fall back to plain).
Sourcepub fn verifies_certificate(&self) -> bool
pub fn verifies_certificate(&self) -> bool
Returns true if this mode verifies the certificate chain.
Sourcepub fn verifies_hostname(&self) -> bool
pub fn verifies_hostname(&self) -> bool
Returns true if this mode verifies the server hostname.