Setting instance configuration parameters so that the instance is strictly compliant with NIST SP 800-131A.
Set the DB2 registry variable DB2COMM to SSL:
$db2set DB2COMM=SSL
Set the DB2 database manager configuration parameter SSL_VERSIONS to TLSV12:
$db2 update dbm cfg using SSL_VERSIONS TLSV12
Set the DB2 database manager configuration parameter SSL_CIPHERSPECS to a symmetric algorithm key length that is greater than or equal to 112:
$db2 update dbm cfg using SSL_CIPHERSPECS TLS_RSA_WITH_AES_256_GCM_SHA384
Set the database manager configuration parameter SSL_SVC_LABEL to a certificate with RSA key length that is greater than or equal to 2048. That certificate must also have a digital signature with minimum SHA2.
Create the certificate. Example:
$gsk8capicmd_64 -cert -create -db "mydbserver.kdb" -pw "password" -size 2048 -sigalg SHA256WithRSA -label "myselfsigned_SHA2_2K" -dn "CN=myhost.mycompany.com,O=myOrganization, OU=myOrganizationUnit,L=myLocation,ST=ON,C=CA"
$db2 update dbm cfg using SSL_SVR_LABEL myselfsigned_SHA_2K
Note: Here is an example of SSL set up on Linux:
1. Create a directory "ssl"
$mkdir ssl
2. Make sure gsk8capicmd_64 command in PATH $ export PATH=$PATH:/home/db2inst1/sqllib/gskit/bin
3. Make sure library is in path $ echo $LD_LIBRARY_PATH /home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32
4. Go to ssl directory (/home/db2inst1/ssl)
5. Create Server key database
$db2inst1@potserver:~/ssl> gsk8capicmd_64 -keydb -create -db "mydbserver.kdb" -pw "password" -stash
$db2inst1@potserver:~/ssl> ls
$mydbserver.crl mydbserver.kdb mydbserver.rdb mydbserver.sth
6. To create a self-signed certificate with a label of myselfsigned, use the GSKCapiCmd command as shown in the following example:
$gsk8capicmd_64 -cert -create -db "mydbserver.kdb" -pw "password" -label "myselfsigned" -dn "CN=myhost.mycompany.com,O=myOrganization, OU=myOrganizationUnit,L=myLocation,ST=ON,C=CA"
7. Extract the certificate you just created to a file, so that you can distribute it to computers running clients that will be establishing SSL connections to your DB2 server. For example, the following GSKCapiCmd command extracts the certificate to a file called mydbserver.arm:
$gsk8capicmd_64 -cert -extract -db "mydbserver.kdb" -pw "password" -label "myselfsigned" -target "mydbserver.arm" -format ascii -fips
8. Set database manager configuration parameters:
$db2 update dbm cfg using SSL_SVR_KEYDB /home/db2inst1/ssl/mydbserver.kdb
$db2 update dbm cfg using SSL_SVR_STASH /home/db2inst1/ssl/mydbserver.sth
$db2 update dbm cfg using SSL_SVR_LABEL SSLLabel
$db2 update dbm cfg using SSL_SVCENAME 50602
9. Add the value SSL to the DB2COMM registry variable. For example:
$db2set -i db2inst1 DB2COMM=SSL
or
$db2set -i db2inst1 DB2COMM=SSL