Skip to content

Commit 8ff8ae5

Browse files
committed
Document Npgsql 10 GSS session encryption
1 parent 2738df1 commit 8ff8ae5

File tree

3 files changed

+21
-24
lines changed

3 files changed

+21
-24
lines changed

conceptual/Npgsql/connection-string-parameters.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Passfile | Path to a PostgreSQL password file (PGPASSFILE), from which the p
1919

2020
Parameter | Description | Default
2121
---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -------
22+
GSS Encryption Mode | Controls whether GSS encryption is used, depending on server support. [See docs for possible values and more info](security.md). | Prefer
2223
SSL Mode | Controls whether SSL is used, depending on server support. [See docs for possible values and more info](security.md). | Prefer
2324
Trust Server Certificate | Whether to trust the server certificate without validating it. [See docs for more info](security.md). | false
2425
SSL Certificate | Location of a client certificate to be sent to the server. [See docs](security.md). | PGSSLCERT

conceptual/Npgsql/release-notes/10.0.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ Note that these changes modify the metric names and tracing span tags, and so ar
2020

2121
## GSSAPI session encryption
2222

23-
GSSAPI session encryption is an alternative to SSL/TLS session encryption, where special temporary tokens are used to encrypt traffic between the client and the server (MIT Kerberos is one of the GSSAPI providers that can be used for that), unlike SSL/TLS, where SSL certificate is used for the same purpose. You can use the `GssEncryptionMode` connection string parameter to control whether GSS session encryption is used; the default is `Prefer`, which will enable the feature if possible but proceed if it's not available. To learn more, see PostgreSQL [docs](https://www.postgresql.org/docs/current/gssapi-enc.html).
23+
GSSAPI session encryption is an alternative to SSL/TLS session encryption, where special temporary tokens are used to encrypt traffic between the client and the server (MIT Kerberos is one of the GSSAPI providers that can be used for that), unlike SSL/TLS, where the SSL certificate is used for the same purpose. You can use the `GssEncryptionMode` connection string parameter to control whether GSS session encryption is used; the default is `Prefer`, which will enable the feature if possible but proceed if it's not available.
24+
25+
To learn more, [see the security and encryption docs](../security.md).
2426

2527
## Support for RequireAuth in connection string
2628

conceptual/Npgsql/security.md

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,25 @@ dataSource.Password = <new password>;
3737

3838
Any physical connection that's opened after this point will use the newly-injected password.
3939

40-
## Encryption (SSL/TLS)
40+
## GSS session encryption (GSS-API)
41+
42+
Connections to PostgreSQL are unencrypted by default, but you can turn on session encryption if you wish. Npgsql 10 supports GSS-API for session encryption, and defaults to it if PostgreSQL is set up to support GSS-API (GSS-API is preferred over SSL/TLS).
4143

42-
By default PostgreSQL connections are unencrypted, but you can turn on SSL/TLS encryption if you wish. First, you have to set up your PostgreSQL to receive SSL/TLS connections [as described here](http://www.postgresql.org/docs/current/static/ssl-tcp.html). Once that's done, specify `SSL Mode` in your connection string as detailed below.
44+
To use GSS-API, configure your PostgreSQL for GSS-API session encryption ([docs](https://www.postgresql.org/docs/current/gssapi-enc.html)). Once that's done, you can use `GSS Encryption Mode` in your connection string to configure support (this is similar to the PG [`gccencmode`](https://www.postgresql.org/docs/16/libpq-connect.html#LIBPQ-CONNECT-GSSENCMODE) parameter):
4345

44-
### [Version 6.0+](#tab/tabid-1)
46+
SSL Mode | Meaning
47+
------------------- | ---------
48+
Disable | Only try a non-GSSAPI-encrypted connection.
49+
Prefer (default) | If there are GSSAPI credentials present (i.e., in a credentials cache), first try a GSSAPI-encrypted connection; if that fails or there are no credentials, try a non-GSSAPI-encrypted connection. This is the default when PostgreSQL has been compiled with GSSAPI support.
50+
Require | Only try a GSSAPI-encrypted connection.
4551

46-
Starting with 6.0, the following `SSL Mode` values are supported (see the [PostgreSQL docs](https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-SSLMODE-STATEMENTS) for more details):
52+
The default mode is `Prefer`, which allows GSS-API session encryption but does not require it.
53+
54+
## Encryption (SSL/TLS)
55+
56+
As an alternative to GSS-API, you can use SSL/TLS. First, you have to set up your PostgreSQL to receive SSL/TLS connections [as described here](http://www.postgresql.org/docs/current/static/ssl-tcp.html). Once that's done, specify `SSL Mode` in your connection string as detailed below.
57+
58+
The following `SSL Mode` values are supported (see the [PostgreSQL docs](https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-SSLMODE-STATEMENTS) for more details):
4759

4860
SSL Mode | Eavesdropping protection | Man-in-the-middle protection | Statement
4961
------------------- | ------------------------ | ---------------------------- | ---------
@@ -54,25 +66,7 @@ Require<sup>1</sup> | Yes | No |
5466
VerifyCA | Yes | Depends on CA policy | I want my data encrypted, and I accept the overhead. I want to be sure that I connect to a server that I trust.
5567
VerifyFull | Yes | Yes | I want my data encrypted, and I accept the overhead. I want to be sure that I connect to a server I trust, and that it's the one I specify.
5668

57-
<sup>1</sup> Prior to Npgsql 8.0, `SSL Mode=Require` required explicitly setting `Trust Server Certificate=true` as well, to make it explicit that the server certificate isn't validated. Starting with 8.0, `Trust Server Certificate=true` is no longer required and does nothing.
58-
59-
The default mode in 6.0+ is `Prefer`, which allows SSL but does not require it, and does not validate certificates.
60-
61-
### [Older versions](#tab/tabid-2)
62-
63-
Versions prior to 6.0 supported the following `SSL Mode` values:
64-
65-
SSL Mode | Eavesdropping protection | Man-in-the-middle protection | Statement
66-
----------- | ------------------------ | ---------------------------- | ---------
67-
Disable | No | No | I don't care about security, and I don't want to pay the overhead of encryption.
68-
Prefer | Maybe | Maybe | I don't care about encryption, but I wish to pay the overhead of encryption if the server supports it.
69-
Require | Yes | Yes | I want my data encrypted, and I accept the overhead. I want to be sure that I connect to a server I trust, and that it's the one I specify.
70-
71-
The default mode prior to 6.0 was `Disable`.
72-
73-
To disable certificate validation when using `Require`, set `Trust Server Certificate` to true; this allows connecting to servers with e.g. self-signed certificates, while still requiring encryption.
74-
75-
---
69+
The default mode is `Prefer`, which allows SSL but does not require it, and does not validate certificates.
7670

7771
### SSL Negotiation
7872

0 commit comments

Comments
 (0)