Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Establishing Secure TCP/IP Connections in SSL Mode

Updated on 2022-08-16 GMT+08:00
If the client or JDBC/ODBC driver needs to use SSL connection, you must configure related SSL connection parameters in the client or application code. The GaussDB(DWS) management console provides the SSL certificate required by the client. The SSL certificate contains the default certificate, private key, root certificate, and private key password encryption file required by the client. Download the SSL certificate to the host where the client resides and specify the path of the certificate on the client.
NOTE:

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.

For more information about SSL certificates, see (Optional) Downloading the SSL Certificate. The following parts are included in this section:

Configuring Digital Certificate Parameters Related to SSL Authentication on the gsql Client

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.

  1. Log in to the GaussDB(DWS) management console and click Connections to download the SSL certificate.

    For more information about SSL certificates, see (Optional) Downloading the SSL Certificate.

  2. Use a file transfer tool (such as WinSCP) to upload the SSL certificate to the host where the client is installed.

    For example, save the downloaded certificate dws_ssl_cert.zip to the /home/dbadmin/dws_ssl/ directory.

  3. Use an SSH remote connection tool (such as PuTTY) to log in to the host where the gsql client is installed and run the following commands to go to the directory where the SSL certificate is stored and decompress the SSL certificate:

    cd /home/dbadmin/dws_ssl/
    unzip dws_ssl_cert.zip

  4. Run the export command and configure digital certificate parameters related to SSL authentication on the host where the gsql client is installed.

    There are two SSL authentication modes: bidirectional authentication and unidirectional authentication. Different authentication modes require different client environment variables. 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"
    NOTICE:
    • You are advised to use bidirectional authentication for security purposes.
    • The environment variables configured for a client must contain the absolute file paths.

  5. Change the client private key permissions.

    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

SSL Authentication Modes and Client Parameters

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.

Table 1 Authentication modes

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:

  • PGSSLCERT
  • PGSSLKEY
  • PGSSLROOTCERT
  • PGSSLMODE

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:

  • PGSSLROOTCERT
  • PGSSLMODE

To prevent TCP-based link spoofing, 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.

NOTE:

The path of environment variables is set to /home/dbadmin/dws_ssl/ as an example. Replace it with the actual path.

Table 2 Client parameters

Environment Variable

Description

Value Range

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:

  • disable: only tries to establish a non-SSL connection.
  • allow: tries to establish a non-SSL connection first, and then an SSL connection if the first attempt fails.
  • prefer: tries to establish an SSL connection first, and then a non-SSL connection if the first attempt fails.
  • require: only tries to establish an SSL connection. If there is a CA file, perform the verification according to the scenario in which the parameter is set to verify-ca.
  • verify-ca: tries to establish an SSL connection and check whether the server certificate is issued by a trusted CA.
  • verify-full: GaussDB(DWS) does not support this mode.

Default value: 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

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback