Skip to content

Commit 04ad88f

Browse files
committed
Update concepts-networking-ssl-tls.md
1 parent 182f8e2 commit 04ad88f

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

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

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ This command prints numerous low-level protocol information, including the TLS v
7272
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.
7373
In order to prevent spoofing, SSL certificate verification on the client must be used.
7474
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.
75+
1. **ssl**. Connect using SSL. This property doesn't need a value associated with it. The mere presence of it specifies an 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.
7676
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:
7777

7878
| SSL Mode | Explanation |
@@ -84,7 +84,7 @@ There are many connection parameters for configuring the client for SSL. Few imp
8484
|verify-ca| Encryption is used. Moreover, verify the server certificate signature against certificate stored on the client|
8585
|verify-full| Encryption is used. Moreover, verify server certificate signature and host name against certificate stored on the client|
8686

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.
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.
8888

8989
**Certificate Authorities (CAs)** are the institutions responsible for issuing certificates. A trusted certificate authority is an entity that’s entitled to verify someone is who they say they are. In order for this model to work, all participants must agree on a set of trusted CAs. All operating systems and most web browsers ship with a set of trusted CAs.
9090

@@ -96,6 +96,35 @@ For more on SSL\TLS configuration on the client, see [PostgreSQL documentation](
9696
> [!NOTE]
9797
> For clients that use **verify-ca** and **verify-full** sslmode configuration settings, i.e. certificate pinning, they have to accept **both** [DigiCert Global Root G2](https://www.digicert.com/kb/digicert-root-certificates.htm) and [Microsoft RSA Root Certificate Authority 2017](https://www.microsoft.com/pkiops/docs/repository.htm) root CA certificates, as services are migrating from Digicert to Microsoft CA.
9898
99+
### Importing Root Certificates in Java Key Store on the client for certificate pinning scenarios
100+
101+
Custom-written Java applications use a default keystore, called *cacerts*, which contains trusted certificate authority (CA) certificates. It's also often known as Java trust store. A certificates file named *cacerts* resides in the security properties directory, java.home\lib\security, where java.home is the runtime environment directory (the jre directory in the SDK or the top-level directory of the Java™ 2 Runtime Environment).
102+
You can use following directions to update client root CA certificates for client certificate pinning scenarios with PostgreSQL Flexible Server:
103+
1. Make a backup copy of your custom keystore.
104+
2. Download Microsoft RSA Root Certificate Authority 2017 and DigiCert Global Root G2 certificates from following URIs:
105+
For Microsoft RSA Root Certificate Authority 2017 https://www.microsoft.com/pkiops/certs/Microsoft%20RSA%20Root%20Certificate%20Authority%202017.crt.
106+
For DigiCert Global Root G2 https://cacerts.digicert.com/DigiCertGlobalRootG2.crt.pem.
107+
3. Optionally, to prevent future disruption, it's also recommended to add the following roots to the trusted store:
108+
Microsoft ECC Root Certificate Authority 2017 - https://www.microsoft.com/pkiops/certs/Microsoft%20ECC%20Root%20Certificate%20Authority%202017.crt
109+
4. Generate a combined CA certificate store with both Microsoft RSA Root Certificate Authority 2017 and DigiCertGlobalRootG2 certificates are included. Example below shows using DefaultJavaSSLFactory for PostgreSQL JDBC users
110+
111+
```powershell
112+
113+
114+
keytool -importcert -alias PostgreSQLServerCACert -file D:\ DigiCertGlobalRootG2.crt.pem -keystore truststore -storepass password -noprompt
115+
116+
keytool -importcert -alias PostgreSQLServerCACert2 -file "D:\ Microsoft ECC Root Certificate Authority 2017.crt.pem" -keystore truststore -storepass password -noprompt
117+
```
118+
5. Replace the original keystore file with the new generated one:
119+
120+
```java
121+
System.setProperty("javax.net.ssl.trustStore","path_to_truststore_file");
122+
System.setProperty("javax.net.ssl.trustStorePassword","password");
123+
```
124+
6. Replace the original root CA pem file with the combined root CA file and restart your application/client.
125+
126+
127+
99128
## Cipher Suites
100129

101130
A **cipher suite** is a set of cryptographic algorithms. TLS/SSL protocols use algorithms from a cipher suite to create keys and encrypt information.
@@ -107,7 +136,7 @@ A cipher suite is displayed as a long string of seemingly random information—b
107136
- Message authentication code algorithm (MAC)
108137

109138
Different versions of SSL/TLS support different cipher suites. TLS 1.2 cipher suites can’t be negotiated with TLS 1.3 connections and vice versa.
110-
As of this time Azure Database for PostgreSQL flexible server supports a number of cipher suites with TLS 1.2 protocol version that fall into [HIGH:!aNULL](https://www.postgresql.org/docs/16/runtime-config-connection.html#GUC-SSL-CIPHERS) category.
139+
As of this time Azure Database for PostgreSQL flexible server supports many cipher suites with TLS 1.2 protocol version that fall into [HIGH:!aNULL](https://www.postgresql.org/docs/16/runtime-config-connection.html#GUC-SSL-CIPHERS) category.
111140

112141
## Troubleshooting SSL\TLS connectivity errors
113142

0 commit comments

Comments
 (0)