Secure Socket Layer (SSL) implementation in Db2

Db2 supports the use of Secured Socket Layer (SSL) to enable authentication through digital certificates, and to provide private communication between the client and the server via encryption to encrypt data in-transit. The SSL support is provided through the IBM Global Security Kit (GSKit) libraries that are installed on the Db2 server.

Implement SSL using the following steps:

Create a key database:

gsk8capicmd_64 -keydb -create -db "KeyDB.kdb" -pw "Passw0rd" -stash

The -stash option creates a stash file with an extension of.sth. This stash file will be used by the GSKit to obtain the password during the instance restart

 Configure digital certificates.

Add a digital certificate for your server to the key database. The server sends this certificate to clients during the SSL handshake to provide authentication for the server.

gsk8capicmd_64 -cert -create -db "KeyDB.kdb" -pw "Passw0rd"  -label "MyKeyDBLabel" -dn "CN=myhost.mycompany.com,O=myOrganization,OU=myOrganizationUnit,L=myLocation,ST=ON,C=CA" -size 2048 -sigalg SHA256_WITH_RSA;

Configure the necessary Db2 database manager configuration parameters and registry variables for SSL.

ssl_svr_keydb: Specifies the key file to be used for SSL setup at server-side. The default is NULL. If this is set to NULL, SSL support is disabled.

UPDATE DBM CFG USING SSL_SVR_KEYDB /home/db2inst1/sqllib/security/keystore/KeyDB.kdb;

ssl_svr_stash: Specifies a fully qualified file path for the stash file to be used for SSL setup at the server-side. The default is NULL. If this is set to NULL, SSL support is disabled.

UPDATE DBM CFG USING SSL_SVR_STASH home/db2inst1/sqllib/security/keystore/mydbserver.sth;

ssl_svr_label: Specifies a label of the personal certificate of the server in the key database. The default is NULL. If this set to NULL, the default certificate in the key database is used. If there is no default certificate in the key database, SSL support is disabled.

UPDATE DBM CFG USING SSL_SVR_LABEL MyKeyDBLabel;

ssl_svcename: Specifies the name of the port that a database server uses to await communications from remote client nodes using SSL protocol.

UPDATE DBM CFG USING SSL_SVCENAME db2inst1_ssl_port;

DB2COMM: This registry variable specifies communication protocols for the current Db2 instance.

db2set DB2COMM=SSL

If you want to allow both SSL and TCPIP communications, you can set the DB2COMM registry variable to both SSL and TCPIP.

 db2set DB2COMM=SSL,TCPIP

ssl_cipherspecs: Specifies the cipher suites that the server allows for incoming connection requests when using the SSL protocol. The default is NULL. If this is set to NULL, the GSKit will pick the strongest available cipher suite.

UPDATE DBM CFG USING SSL_CIPHERSPECS TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384;

Restart the database instance:

db2stop; db2start

Comments

Popular posts from this blog

Db2 export command example using file format (del , ixf)

How to fix DB2 Tablespace OFFLINE state issue?

Phases of a load operation