Skip to content

Commit d75a178

Browse files
Merge pull request #267002 from GennadNY/gennadyk-branch24
Gennadyk branch24
2 parents cea156f + 3fc4bf2 commit d75a178

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

articles/postgresql/flexible-server/concepts-networking-ssl-tls.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,39 @@ For testing, you can also use the **openssl** command directly, for example:
6262
```bash
6363
openssl s_client -connect localhost:5432 -starttls postgres
6464
```
65-
This prints out a lot of low-level protocol information, including the TLS version, cipher, and so on. Note that you must use the option -starttls postgres, or otherwise this command reports that no SSL is in use. This requires at least OpenSSL 1.1.1.
65+
This command prints numerous low-level protocol information, including the TLS version, cipher, and so on. You must use the option -starttls postgres, or otherwise this command reports that no SSL is in use. Using this command requires at least OpenSSL 1.1.1.
6666

6767
> [!NOTE]
6868
> To enforce **latest, most secure TLS version** for connectivity protection from client to Azure Database for PostgreSQL flexible server set **ssl_min_protocol_version** to **1.3**. That would **require** clients connecting to your Azure Database for PostgreSQL flexible server instance to use **this version of the protocol only** to securely communicate. However, older clients, since they don't support this version, may not be able to communicate with the server.
6969
70+
## Configuring SSL on the Client
71+
72+
By default, PostgreSQL doesn't perform any verification of the server certificate. This means that it's possible to spoof the server identity (for example by modifying a DNS record or by taking over the server IP address) without the client knowing. All SSL options carry overhead in the form of encryption and key-exchange, so there's a trade-off that has to be made between performance and security.
73+
In order to prevent spoofing, SSL certificate verification on the client must be used.
74+
There are many connection parameters for configuring the client for SSL. Few important to us are:
75+
1. **ssl**. Connect using SSL. This property doesn't need a value associated with it. The mere presence of it specifies a SSL connection. However, for compatibility with future versions, the value "true" is preferred. In this mode, when establishing an SSL connection the client driver validates the server's identity preventing "man in the middle" attacks. It does this by checking that the server certificate is signed by a trusted authority, and that the host you're connecting to is the same as the hostname in the certificate.
76+
2. **sslmode**. If you require encryption and want the connection to fail if it can't be encrypted then set **sslmode=require**. This ensures that the server is configured to accept SSL connections for this Host/IP address and that the server recognizes the client certificate. In other words if the server doesn't accept SSL connections or the client certificate isn't recognized the connection will fail. Table below list values for this setting:
77+
78+
| SSL Mode | Explanation |
79+
|----------|-------------|
80+
|disable | Encryption isn't used|
81+
|allow | Encryption is used if f server settings require\enforce it|
82+
|prefer | Encryption is used if server settings allow for it|
83+
|require | Encryption is used. This ensures that the server is configured to accept SSL connections for this Host IP address and that the server recognizes the client certificate.|
84+
|verify-ca| Encryption is used. Moreover, verify the server certificate signature against certificate stored on the client|
85+
|verify-full| Encryption is used. Moreover, verify server certificate signature and host name against certificate stored on the client|
86+
87+
3. **sslcert**, **sslkey** and **sslrootcert**. These parameters can override default location of the client certificate, the PKCS-8 client key and root certificate. These defaults to /defaultdir/postgresql.crt, /defaultdir/postgresql.pk8, and /defaultdir/root.crt respectively where defaultdir is ${user.home}/.postgresql/ in *nix systems and %appdata%/postgresql/ on windows.
88+
89+
> [!NOTE]
90+
> Using verify-ca and verify-full **sslmode** configuration settings can also be known as **[certificate pinning](../../security/fundamentals/certificate-pinning.md#how-to-address-certificate-pinning-in-your-application)**. Important to remember, you might periodically need to update client stored certificates when Certificate Authorities change or expire on PostgreSQL server certificates.
91+
92+
For more on SSL\TLS configuration on the client, see [PostgreSQL documentation](https://www.postgresql.org/docs/current/ssl-tcp.html#SSL-CLIENT-CERTIFICATES).
7093

7194
## Cipher Suites
7295

7396
A **cipher suite** is a set of cryptographic algorithms. TLS/SSL protocols use algorithms from a cipher suite to create keys and encrypt information.
74-
A cipher suite is displayed as a long string of seemingly random informationbut each segment of that string contains essential information. Generally, this data string is made up of several key components:
97+
A cipher suite is displayed as a long string of seemingly random informationbut each segment of that string contains essential information. Generally, this data string is made up of several key components:
7598
- Protocol (that is, TLS 1.2 or TLS 1.3)
7699
- Key exchange or agreement algorithm
77100
- Digital signature (authentication) algorithm

0 commit comments

Comments
 (0)