![[MQ 9.4.4 Oct 2025]](ng944.gif)
Secure replication for DR/HA RDQM
You can specify that replication links in your DR/HA RDQM configuration are secured with TLS.
When you create a queue manager in a DR/HA RDQM configuration, you can specify that the links used to replicate data between the queue manager instances in the HA groups are secured with TLS. You can also specify that the link used to replicate data between the two HA configurations is secured with TLS. You can choose to secure either the HA or DR replication links, or both.
- Configure the required certificates.
- Configure the tlshd service.
- Specify the
-re,-reh, or-redoption when creating a new queue manager using crtmqm.
The TLS protocols and cipher suites that can be used by the RDQM secure replication links are controlled by the active system-wide cryptographic policy. Use the Linux® update-crypto-policies command to change the current active policy.
Configuring certificates
You must configure the certificates to be used by the replication link. The certificates that you create for each node can be used by any replication links. If you have more than one RDQM queue manager on a node that uses secure replication links, the same certificate is used.
To use secure replication links in a RDQM DR/HA configuration you need six certificates, one certificate per node in the RDQM DR/HA group.
- Use the following command to generate a private
key:
where key_file is the name of the file that is created to store the private key.openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 -out key_file - Create a certificate signing request.In a RDQM DR/HA configuration, the certificate that you create must meet the following requirements:
- The certificate Common Name (CN) must be set to the hostname of the RDQM node.
- The certificate Subject Alternative Name (SAN) must contain both the hostname of the RDQM node
and a group DNS name. The group DNS name defaults to the value
encrypted.remote. If required, you can specify a different group DNS name.The same group DNS name can be used by both HA groups, or you can specify a different name for each HA group.
Every node in a HA group must use certificates with the same group DNS name in the SAN.
If you do not use the default value of
encrypted.remotein the SAN when the certificate is created, you must specify the group DNS name for the local and remote HA groups by using the -san parameter on the crtmqm command when the queue manager is created.
Use the following command to create a certificate signing request:
where:openssl req -key key_file -subj "/CN=hostname" -addext "subjectAltName = DNS:hostname,DNS:group_dns_name" -new -out cert_req_file- key_file is the file that contains the private key that you created in step 1.
- hostname is the hostname of the node.
- group_dns_name is the group DNS name. To use the default value for the group
DNS name, specify
encrypted.remote. - cert_req_file is the file that is created to store the certificate signing request.
- Send the certificate signing request to your certificate authority (CA) to be signed. When you
receive the signed certificate from the CA, copy the private key, signed certificate, and CA
certificate files to the directory where you want to store these files. For example, the
/etc/drbd.d/directory. - Set the file permissions and ownership of the private key and certificate files to ensure that
only the root user can view the private keys.
- Change the ownership of the private key and certificate file to the root user.
- Set the permissions on the private key file so that only the root user has read and write access.
#!/bin/bash
# The CA name
ca_name="RDQM Test CA"
# The CA filename
ca_filename="rdqm_test_ca"
# Host certificates to generate
test_hosts=("alice" "bob" "charlie")
mkdir certificates && cd ./certificates
# Create private key for use with private CA using OpenSSL
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 \
-out $ca_filename.key
# Create a private CA certificate using OpenSSL
openssl req -key $ca_filename.key -new -x509 -days 3650 -subj "/CN=$ca_name" \
-out $ca_filename.crt
# Create certificates for each node
for host in ${test_hosts[@]}; do
# Create a private key
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 \
-out $host.key
# Generate a CSR
openssl req -key $host.key -subj "/CN=$host" \
-addext "subjectAltName = DNS:$host,DNS:encrypted.remote" \
-new -out $host.csr
# Create a valid certificate signed by the private CA
openssl x509 -req -in $host.csr -CA $ca_filename.crt \
-copy_extensions copyall -CAkey $ca_filename.key -CAcreateserial \
-days 365 -out $host.crt
# Remove sequential serial number
rm -f $ca_filename.srl
# Remove CSR
rm -f $host.csr
doneRun the same script on one of the nodes in your secondary HA group, specifying the three hostnames of the nodes in that group.
- rdqm_test_ca.crt
- rdqm_test_ca.key
- alice.crt
- alice.csr
- alice.key
- bob.crt
- bob.csr
- bob.key
- charlie.crt
- charlie.csr
- charlie.key
If the hosts in your secondary group were called william, joey, and kayser, then the following files are generated in the certificates directory on the node in the secondary group:
- rdqm_test_ca.crt
- rdqm_test_ca.key
- william.crt
- william.csr
- william.key
- joey.crt
- joey.csr
- joey.key
- kayser.crt
- kayser.csr
- kayser.key
- Copy the CA certificate (
rdqm_test_ca.crt) to each node’s/etc/drbd.d/directory. (These are example paths, you can choose another location if required.) - Copy each node’s certificate (
.crtfile) and private key (.keyfile) to/etc/drbd.d/. (These are example paths, you can choose another location if required.) - Change file permissions and ownership for the private keys and certificate on each node. This
ensures that only the root user can view the contents of the private
keys:
chmod 600 /etc/drbd.d/*.key chown root:root /etc/drbd.d/*.key chown root:root /etc/drbd.d/*.crt - Store the certificate authority's private key in a secure location.
Configuring the tlshd service
This tlshd service needs to be configured and then enabled and started, before any DRBD TLS handshakes can be completed. The tlshd service is provided in a package that is installed with the drbd-utils-9 packages.
The configuration file for this service is /etc/tlshd.conf and the initial contents are:
[debug]
loglevel=0
tls=0
nl=0
[authenticate]
#keyrings= <keyring>;<keyring>;<keyring>
[authenticate.client]
#x509.truststore= <pathname>
#x509.certificate= <pathname>
#x509.private_key= <pathname>
[authenticate.server]
#x509.truststore= <pathname>
#x509.certificate= <pathname>
#x509.private_key= <pathname>
authenticate.client and authenticate.server
sections (DRBD can establish its connections in either direction, unless there is a firewall
blocking one direction):- x509.truststore
- The path to the file that contains the certificate of the CA that signed the certificates used by the RDQM nodes. If a complex trust chain is required, it must be captured in a single file.
- x509.certificate
- The path to the file that contains the CA-signed certificate for the RDQM node.
- x509.private_key
- The path to the file that contains the private key for the RDQM node. The file must be owned by root and read/write permissions must be granted to only the root user.
authenticate.client and authenticate.server sections:- x509.crl
- The path to a file containing PEM-encoded certificate revocation lists (CRL) that are to be used to verify the revocation status of certificates during each handshake. If this option is not specified, CRL checking is skipped.
[authenticate.client]
x509.truststore=/etc/drbd.d/rdqm_test_ca.crt
x509.certificate=/etc/drbd.d/alice.crt
x509.private_key=/etc/drbd.d/alice.key
[authenticate.server]
x509.truststore=/etc/drbd.d/rdqm_test_ca.crt
x509.certificate=/etc/drbd.d/alice.crt
x509.private_key=/etc/drbd.d/alice.keysystemctl daemon-reloadTo start the tlshd service, enter the
following command:systemctl enable --now tlshdCreating the DR/HA RDQM
-re option, for example, for the primary
instance in the primary
group:crtmqm -sx -rr p -rl <Local_IPs> -ri <Recovery_IPs> -rp <DRPort> -re <DRHAQueueManagerName>You
run the following command on each of the other nodes in the primary group to create the secondary
instances:crtmqm -sxs -rr p -rl <Local_IPs> -ri <Recovery_IPs> -rp <DRPort> -re <DRHAQueueManagerName>You
create the primary instance in the secondary group by using the following
command:crtmqm -sx -rr s -rl <Local_IPs> -ri <Recovery_IPs> -rp <DRPort> -re <DRHAQueueManagerName>
You run the following command on each of the other nodes in the secondary group to create the
secondary
instances:crtmqm -sxs -rr s -rl <Local_IPs> -ri <Recovery_IPs> -rp <DRPort> -re <DRHAQueueManagerName>To
secure only the HA replication links in the group, specify the -reh option in the
commands. For
example:crtmqm -sx -rr p -rl <Local_IPs> -ri <Recovery_IPs> -rp <DRPort> -reh <DRHAQueueManagerName>-red
option in the commands. For
example:crtmqm -sx -rr p -rl <Local_IPs> -ri <Recovery_IPs> -rp <DRPort> -red <DRHAQueueManagerName>encrypted.remote for the group DNS name in the certificate's SAN. Where you have
created certificates using a different value, you must specify this value when you create the queue
manager by using the -san option. For
example:crtmqm -sx -rr p -rl <Local_IPs> -ri <Recovery_IPs> -rp <DRPort> -red -san <customSubjectAltName> <DRHAQueueManagerName>If
you have used the same group DNS name in the certificates for both groups, then specify the value by
using the -san <customSubjectAltName> option in all the
crtmqm commands that create the DR/HA RDQM configuration.crtmqm -sx -rr p -rl <Local_IPs> -ri <Recovery_IPs> -rp <DRPort> -red -san <primarySubjectAltName>,<secondarySubjectAltName> <DRHAQueueManagerName>The
following command creates the primary queue manager on the secondary HA
group:crtmqm -sx -rr s -rl <Local_IPs> -ri <Recovery_IPs> -rp <DRPort> -red -san <secondarySubjectAltName>,<primarySubjectAltName> <DRHAQueueManagerName>(You
can specify either the -re or -red option in these examples.)Use the rdqmstatus command to confirm that the replication links are secured with TLS. For more information, see Viewing DR/HA RDQM and HA group status.
For more information about creating DR/HA RDQMs, see Creating DR/HA RDQMs.