GaussDB(DWS) supports the standard SSL. As a highly secure protocol, SSL authenticates bidirectional identification between the server and client using digital signatures and digital certificates to ensure secure data transmission. To support SSL connection, GaussDB(DWS) has obtained the formal certificates and keys for the server and client from the CA certification center. It is assumed that the key and certificate for the server are server.key and server.crt respectively; the key and certificate for the client are client.key and client.crt respectively, and the name of the CA root certificate is cacert.pem.
The SSL connection mode is more secure. By default, the SSL feature in a cluster allows SSL and non-SSL connections from the client. For security purposes, you are advised to connect to the cluster via SSL from the client. Ensure the certificate, private key, and root certificate of the GaussDB(DWS) server have been configured by default. To forcibly use an SSL connection, configure the require_ssl parameter in the Require SSL Connection area of the cluster's Security Settings page on the GaussDB(DWS) management console. Require SSL Connection on the Security Settings page of the cluster. For more information, see Configuring SSL Connection and Combinations of SSL Connection Parameters on the Client and Server.
Using the default certificate may pose security risks. To improve system security, you are advised to periodically change the certificate to prevent password cracking. If you need to replace the certificate, contact the database customer service.
Prerequisites
Procedure
By default, Configuration Status is Synchronized, which indicates that the latest database result is displayed.
indicates the function is enabled. The require_ssl is set to 1, indicating that the server forcibly requires the SSL connection.
indicates the function is disabled (default value). The require_ssl parameter is set to 0, indicating that the server does not require SSL connections. For details about how to configure the require_ssl parameter, see require_ssl (Server).
The system automatically saves the SSL connection settings. On the Security Settings page, Configuration Status is Applying. After Configuration Status changes to Synchronized, the settings have been saved and taken effect.
After a data warehouse cluster is deployed, the SSL authentication mode is enabled by default. The server certificate, private key, and root certificate have been configured by default. You need to configure the client parameters.
For example, save the downloaded certificate dws_ssl_cert.zip to the /home/dbadmin/dws_ssl/ directory.
cd /home/dbadmin/dws_ssl/ unzip dws_ssl_cert.zip
There are two SSL authentication modes: bidirectional authentication and unidirectional authentication. The client environment variables to be configured vary according to the authentication mode. For details, see SSL Authentication Modes and Client Parameters.
The following parameters must be configured for bidirectional authentication:
export PGSSLCERT="/home/dbadmin/dws_ssl/sslcert/client.crt" export PGSSLKEY="/home/dbadmin/dws_ssl/sslcert/client.key" export PGSSLMODE="verify-ca" export PGSSLROOTCERT="/home/dbadmin/dws_ssl/sslcert/cacert.pem"
The following parameters must be configured for unidirectional authentication:
export PGSSLMODE="verify-ca" export PGSSLROOTCERT="/home/dbadmin/dws_ssl/sslcert/cacert.pem"
The permissions on the client's root certificate, private key, certificate, and encrypted private key file must be 600. If the permissions do not meet the requirement, the client cannot connect to the cluster in SSL mode.
chmod 600 client.key chmod 600 client.crt chmod 600 client.key.cipher chmod 600 client.key.rand chmod 600 cacert.pem
There are two SSL authentication modes: bidirectional authentication and unidirectional authentication. Table Table 1 shows the differences between these two modes. You are advised to use bidirectional authentication for security purposes.
Authentication Mode |
Description |
Environment Variables Configured on a Client |
Maintenance |
---|---|---|---|
Bidirectional authentication (recommended) |
The client verifies the server's certificate and the server verifies the client's certificate. The connection can be set up only after the verifications are successful. |
Set the following environment variables:
|
This authentication mode is applicable to scenarios that require high data security. When using this mode, you are advised to set the PGSSLMODE client variable to verify-ca for network data security purposes. |
Unidirectional authentication |
The client verifies the server's certificate, whereas the server does not verify the client's certificate. The server loads the certificate information and sends it to the client. The client verifies the server's certificate according to the root certificate. |
Set the following environment variables:
|
To prevent TCP-based security attacks, you are advised to use the SSL certificate authentication. In addition to configuring the client root certificate, you are advised to set the PGSSLMODE variable to verify-ca on the client. |
Configure environment variables related to SSL authentication on the client. For details, see Table 2.
The path of environment variables is set to /home/dbadmin/dws_ssl/ as an example. Replace it with the actual path.
Environment Variable |
Description |
Value Description |
---|---|---|
PGSSLCERT |
Specifies the certificate files for a client, including the public key. Certificates prove the legal identity of the client and the public key is sent to the remote end for data encryption. |
The absolute path of the files must be specified, for example:
export PGSSLCERT='/home/dbadmin/dws_ssl/sslcert/client.crt' (No default value) |
PGSSLKEY |
Specifies the client private key file used to decrypt the digital signatures and the data encrypted using the public key. |
The absolute path of the files must be specified, for example:
export PGSSLKEY='/home/dbadmin/dws_ssl/sslcert/client.key' (No default value) |
PGSSLMODE |
Specifies whether to negotiate with the server about SSL connection and specifies the priority of the SSL connection. |
Values and meanings:
Default value: prefer NOTE:
When an external client accesses a cluster, the error message "ssl SYSCALL error" is displayed on some nodes. In this case, run export PGSSLMODE="allow" or export PGSSLMODE="prefer". |
PGSSLROOTCERT |
Specifies the root certificate file for issuing client certificates. The root certificate is used to verify the server certificate. |
The absolute path of the files must be specified, for example:
export PGSSLROOTCERT='/home/dbadmin/dws_ssl/sslcert/certca.pem' Default value: null |
PGSSLCRL |
Specifies the certificate revocation list file, which is used to check whether a server certificate is in the list. If the certificate is in the list, it is invalid. |
The absolute path of the files must be specified, for example:
export PGSSLCRL='/home/dbadmin/dws_ssl/sslcert/sslcrl-file.crl' Default value: null |
Whether the client uses the SSL encryption connection mode and whether to verify the server certificate depend on client parameter sslmode and server (cluster) parameters ssl and require_ssl. The parameters are as follows:
The combinations of client parameter sslmode and server parameters ssl and require_ssl are as follows.
ssl (Server) |
sslmode (Client) |
require_ssl (Server) |
Result |
---|---|---|---|
on |
disable |
on |
The server requires SSL, but the client disables SSL for the connection. As a result, the connection cannot be set up. |
disable |
off |
The connection is not encrypted. |
|
allow |
on |
The connection is encrypted. |
|
allow |
off |
The connection is not encrypted. |
|
prefer |
on |
The connection is encrypted. |
|
prefer |
off |
The connection is encrypted. |
|
require |
on |
The connection is encrypted. |
|
require |
off |
The connection is encrypted. |
|
verify-ca |
on |
The connection is encrypted and the server certificate is verified. |
|
verify-ca |
off |
The connection is encrypted and the server certificate is verified. |
|
off |
disable |
on |
The connection is not encrypted. |
disable |
off |
The connection is not encrypted. |
|
allow |
on |
The connection is not encrypted. |
|
allow |
off |
The connection is not encrypted. |
|
prefer |
on |
The connection is not encrypted. |
|
prefer |
off |
The connection is not encrypted. |
|
require |
on |
The client requires SSL, but SSL is disabled on the server. Therefore, the connection cannot be set up. |
|
require |
off |
The client requires SSL, but SSL is disabled on the server. Therefore, the connection cannot be set up. |
|
verify-ca |
on |
The client requires SSL, but SSL is disabled on the server. Therefore, the connection cannot be set up. |
|
verify-ca |
off |
The client requires SSL, but SSL is disabled on the server. Therefore, the connection cannot be set up. |