Skip to content

SSL/TLS

SQDR can encrypt its network connections with SSL/TLS (the manual uses both names for the same thing).

When to encrypt

Encryption costs some performance and setup, so decide per connection, along the paths your data takes:

  • Connections that leave the server or the network, especially over a WAN or the internet: encrypt them.
  • Connections inside the Stelo VM, between the Replicator Service and the staging databases of Stelo Capture on the same server, never leave the computer: there's no need to encrypt them.

Which TLS versions are allowed is usually decided by Windows and by the database server, and negotiated when the client connects; SQDR needs no setting for it, except where noted below.

The connections

Connection How to encrypt it See
Your browser to the SQDR Control Center Open it at https://<server>:8443/SQDRManager. It uses a self-signed certificate unless you install your own. Your own certificate for the SQDR Control Center
Capture Agent to a Db2 for i source Set up TLS on the IBM i, add its certificate authority's certificate on the SQDR Control Center's Certificates tab, and select SSL for the agent. SSL/TLS to a Db2 for i source
Capture Agent to a SQL Server source Encryption on the SQL Server, the certificate on the Certificates tab. SSL/TLS to a SQL Server source
Capture Agent to a Db2 for LUW source Use SSL/TLS (property useSSL), to the Db2 TLS port. Db2 for LUW: supported configurations
Capture Agent to a MySQL or MariaDB source Use SSL/TLS. MySQL: SSL/TLS
Capture Agent to a PostgreSQL source Use SSL/TLS. PostgreSQL: SSL/TLS
Replicator Service to a Db2 for i or Db2 for LUW database (StarSQL) Netlib=SQSSL.DLL and the TLS port in the connection string, or SSL/TLS in the data source's network options. Re-enter the credentials, and restart the Replicator Service (or end its open connections) so it reconnects. Db2 with StarSQL, SQDR connections
Replicator Service to a Db2 database (IBM Db2 ODBC driver) Security=SSL and a GSKit key database in the connection string. IBM Db2 ODBC driver
Replicator Service to SQL Server Encrypt=Yes (the default of ODBC Driver 18). Microsoft SQL Server, SSL/TLS to a SQL Server source
Replicator Service to Oracle Depends on the driver: the SQDR bundled Oracle driver or Oracle Instant Client. Oracle
Replicator Service to another source or destination The driver's own encryption keywords. The database's page under Databases
Replicator Service to the staging databases, when SQDR runs on another server TLS on Db2 for LUW on the Stelo Capture server, and the agent's clientODBCString with the TLS port and Netlib=SQSSL.DLL (see Replicating across networks). Encrypt connections to the staging databases
Databricks to the staging database TLS on Db2 for LUW, and sslConnection=true. Databricks: firewall rules

To allow only TLS 1.2 and later on Db2 for LUW (for example for the staging databases), set db2 update dbm cfg using ssl_versions TLSv12 and restart the instance.

Your own certificate for the SQDR Control Center

The SQDR Control Center runs in the SQDR Plus Jetty service (Jetty is an open-source Java web server). For HTTPS, it uses a self-signed certificate that Jetty generates each time the service starts, so browsers warn about it, and it changes at every start. To avoid the warning, give it a certificate from your organization's certificate authority (CA) or from a public one. This certificate only concerns the browser connection; it's unrelated to the certificates the Capture Agents trust for source databases.

What you need:

  • access to a certificate authority;
  • keytool, which comes with the Java runtime installed with Stelo Capture (for example C:\Program Files\StarQuest\jre\bin\keytool.exe);
  • a password for the new keystore. Keep it: you need it whenever you use the keystore.

How it works: Jetty's programs are in its home folder (C:\Program Files\Stelo\jetty), and the SQDR Control Center's Jetty configuration in C:\Program Files\StarQuest\sqdrplus\jetty.base. You copy that configuration to the ProgramData folder and point the service at the copy, so your changes don't sit in the program folder. The service's own settings come from its wrapper.conf, which reads your overrides from wrapper-local.conf (see Configuration files).

1. Copy the Jetty configuration

  1. Copy the folder C:\Program Files\StarQuest\sqdrplus\jetty.base to C:\ProgramData\StarQuest\sqdrplus\jetty\jetty.base. From here on, jetty.base means this copy.
  2. Create C:\ProgramData\StarQuest\sqdrplus\jetty\wrapper-local.conf with this line:

    wrapper.java.additional.5=-Djetty.base="C:\ProgramData\StarQuest\sqdrplus\jetty\jetty.base"
    

    The number (5) must be the one of the jetty.base line in C:\Program Files\StarQuest\sqdrplus\jetty\wrapper\conf\wrapper.conf: check it there.

  3. Restart the SQDR Plus Jetty service and check that it starts. Each start now writes a new self-signed certificate to jetty.base\etc\test-keystore.p12.

2. Create a key and a certificate request

  1. Create the keystore and a key pair:

    keytool -genkeypair -keysize 2048 -keystore C:\ProgramData\StarQuest\sqdrplus\jetty\jetty.base\etc\keystore.p12 -alias jetty -keyalg RSA -sigalg SHA256withRSA
    

    At the "first and last name" prompt, enter the server's fully qualified host name (for example myhost.mydomain.com), and give a two-letter country code.

  2. Create the certificate signing request (CSR), with the same host name:

    keytool -certreq -alias jetty -keyalg RSA -file certreq.csr -keystore C:\ProgramData\StarQuest\sqdrplus\jetty\jetty.base\etc\keystore.p12 -ext san=dns:myhost.mydomain.com
    

3. Get the certificate

Submit certreq.csr to your certificate authority, and get back the certificate chain in Base 64 format (a .p7b file). With a public CA, follow its instructions. With Windows Certificate Services, for example:

  1. Open https://<certificate server>/certsrv in a browser, and sign in with your domain account.
  2. Choose Request a certificate › Submit an advanced certificate request, paste the contents of certreq.csr, select the Web Server template, and click Submit.
  3. Choose Base 64 encoded and Download certificate chain, and save it as certnew.p7b.

4. Import the certificate

keytool -import -alias jetty -trustcacerts -file certnew.p7b -keystore C:\ProgramData\StarQuest\sqdrplus\jetty\jetty.base\etc\keystore.p12

With a private CA, keytool may ask "... is not trusted. Install reply anyway?": answer yes.

5. Configure Jetty and restart

  1. Delete jetty.base\start.d\test-keystore.ini, so Jetty stops generating its own certificate.
  2. In jetty.base\start.d\ssl.ini, uncomment jetty.sslContext.keyStorePassword and set it to the keystore password, in plain text or obfuscated:

    jetty.sslContext.keyStorePassword=OBF:<obfuscated password>
    

    To obfuscate it, run Jetty's password utility, and use the output line that starts with OBF::

    java -cp "C:\Program Files\Stelo\jetty\lib\jetty-util-<version>.jar" org.eclipse.jetty.util.security.Password <password>
    

    An obfuscated password is only hidden from a casual look, not secure: restrict access to the file.

  3. To use another HTTPS port, add wrapper.java.additional.6=-Djetty.ssl.port=<port> to wrapper-local.conf (again, check the number in wrapper.conf).

  4. Restart the SQDR Plus Jetty service. If it doesn't start, see its log, C:\ProgramData\StarQuest\sqdrplus\jetty\logs\wrapper.log.

6. Trust the CA in the browser and test

  • With a public CA, or an internal CA your computers already trust (often the case for computers in the CA's Active Directory domain), there's nothing to do.
  • Otherwise, import the CA's certificate chain into the browser's or Windows' trusted root certificate authorities (for Edge and Chrome on Windows: the Windows certificate store, Trusted Root Certification Authorities; for Firefox: its own certificate settings, Authorities).

Open https://myhost.mydomain.com:8443/SQDRManager, and look at the certificate through the padlock in the address bar. The SQDR Control Center's Jetty accepts only TLS 1.2 and later; to check that an older protocol is refused, you can try openssl s_client -connect myhost.mydomain.com:8443 -tls1 from a computer with OpenSSL.

Messages:

Message Cause
SEC_ERROR_UNKNOWN_ISSUER, ERR_CERT_AUTHORITY_INVALID, "the certificate is not trusted because it is self-signed", "issued by a certificate authority that is not known" The browser doesn't trust the CA: import its certificate (above), or the self-signed certificate is still in use.
NET::ERR_CERT_WEAK_SIGNATURE_ALGORITHM The CA signed the certificate with SHA-1. Have it issued with SHA-256: the CA may need to move to SHA-2 (see Microsoft's documentation on migrating a certification authority from SHA-1 to SHA-2).

Docker

In the Stelo Replicator container, jetty.base and wrapper-local.conf go under /var/sqdrplus/jetty, and the default Docker Compose setup publishes only port 8080, not 8443 (see .env settings). Ask Stelo Support before you change the container's Jetty configuration.

A certificate from Let's Encrypt for tests

Servers such as the SQDR Control Center's Jetty and Db2 for LUW need a server certificate, the same kind as a web server's. A certificate from a public CA needs no setup on the clients. Let's Encrypt issues such certificates at no charge, and its certbot tool, in manual mode with a DNS challenge, can issue one for a CSR from a server that isn't on the internet:

certbot certonly --csr myhost.csr --manual --preferred-challenges dns --config-dir . --work-dir . --logs-dir .

certbot asks you to create a DNS TXT record named _acme-challenge.<host name> with a given value; then it issues the certificate, which you import on the server. These certificates last 90 days, so use them for tests and trials; for production, use a CA with longer-lived certificates.