MariaDB Team — Private CA Certificate Integration Runbook

Environment: OVHcloud / RHEL 9.8 / MariaDB 10.11
Certificate issuer: Private CA on GT Host (issuing-ca-01)
Objective: Obtain a CA-signed server certificate, configure MariaDB to use it, require client certificates for the application database account, and verify mTLS with SELinux enforcing.

Division of responsibility: The MariaDB team generates and retains its server private key. The CA team signs the MariaDB team’s Certificate Signing Request (CSR) and returns the public certificates. The CA’s private signing key is never transferred.

MariaDB Team Runbook — CA-Signed Certificates and Mutual TLS

Target: Existing MariaDB 10.11 server on RHEL 9.8
CA: GT Host private test CA (issuing-ca-01)
Security: SELinux enforcing
Scope: MariaDB server certificate issuance, installation, configuration, and mTLS validation

1. What the MariaDB team needs from the CA team

The MariaDB team must obtain two files from the private Certificate Authority:

FileProvided byPurpose
root-ca.crtCA teamPublic root certificate used to trust client certificates
server-cert.pemCA teamSigned certificate identifying the MariaDB server

The MariaDB team generates and retains one additional file:

FileGenerated byPurpose
server-key.pemMariaDB teamPrivate key belonging to the MariaDB server

Important: The CA team does not need the MariaDB server’s private key. It only needs the Certificate Signing Request (CSR).

The CA team’s root-ca.key must never be transferred to MariaDB.


2. Verify the existing MariaDB environment

Execute on the MariaDB host.

cat /etc/redhat-release

mariadb –version

openssl version

getenforce

sudo systemctl status mariadb –no-pager

Expected environment:

  • RHEL 9.8
  • MariaDB 10.11
  • OpenSSL available
  • SELinux: Enforcing
  • Existing MariaDB service installed

Inspect existing TLS configuration:

sudo mariadb -e “

SHOW GLOBAL VARIABLES

WHERE Variable_name IN

(‘have_ssl’,’ssl_ca’,’ssl_cert’,’ssl_key’);

“

sudo grep -RniE \

  ‘ssl_ca|ssl_cert|ssl_key|require_secure_transport’ \

  /etc/my.cnf /etc/my.cnf.d/ 2>/dev/null

Do not overwrite existing certificates or configuration without reviewing their current use.


3. Create the MariaDB certificate directory

sudo install -d \

  -o root -g mysql \

  -m 750 /etc/pki/mariadb

Verify the MariaDB service account is mysql. Adjust the group if the installation uses a different service identity.


4. Generate the MariaDB private key

sudo openssl genpkey \

  -algorithm RSA \

  -pkeyopt rsa_keygen_bits:3072 \

  -out /etc/pki/mariadb/server-key.pem

Protect the private key:

sudo chown root:mysql \

  /etc/pki/mariadb/server-key.pem

sudo chmod 640 \

  /etc/pki/mariadb/server-key.pem

This key stays on the MariaDB host.


5. Generate the Certificate Signing Request

Determine the hostname that ServiceNow will use when connecting to MariaDB.

For example:

mariadb-test.example.internal

Replace the example hostname below with the actual value.

sudo openssl req \

  -new \

  -sha256 \

  -key /etc/pki/mariadb/server-key.pem \

  -out /etc/pki/mariadb/server.csr \

  -subj “/O=OVHcloud Lab/CN=mariadb-test.example.internal”

Inspect the CSR:

sudo openssl req \

  -in /etc/pki/mariadb/server.csr \

  -noout -text -verify

Send the CSR to the CA team

Transfer:

server.csr

Provide the following information with the request:

FieldRequired value
Certificate typeTLS Server Authentication
Common NameActual MariaDB hostname
DNS Subject Alternative NameActual hostname used by ServiceNow
IP Subject Alternative NameActual DB IP, if clients connect by IP
Extended Key UsageserverAuth
Issuing CAGT Host Test Root CA

The CA team must include the approved Subject Alternative Names in the issued certificate.

Do not send server-key.pem.


6. Receive the signed certificate from the CA team

The CA team returns:

root-ca.crt

server-cert.pem

Copy both files into:

/etc/pki/mariadb/

The directory should now contain:

/etc/pki/mariadb/

├── root-ca.crt

├── server-cert.pem

├── server-key.pem

└── server.csr

Set permissions:

sudo chown root:mysql \

  /etc/pki/mariadb/root-ca.crt \

  /etc/pki/mariadb/server-cert.pem

sudo chmod 640 \

  /etc/pki/mariadb/root-ca.crt \

  /etc/pki/mariadb/server-cert.pem


7. Verify the certificates before configuring MariaDB

Verify the CA signature

sudo openssl verify \

  -CAfile /etc/pki/mariadb/root-ca.crt \

  -purpose sslserver \

  /etc/pki/mariadb/server-cert.pem

Expected:

/etc/pki/mariadb/server-cert.pem: OK

Inspect the server certificate

sudo openssl x509 \

  -in /etc/pki/mariadb/server-cert.pem \

  -noout -subject -issuer -dates -text

Confirm:

  • The issuer is the expected private CA.
  • The certificate is currently valid.
  • The SAN includes the correct MariaDB hostname/IP.
  • Extended Key Usage includes TLS Web Server Authentication.
  • Basic Constraints identifies it as a non-CA certificate.

Verify the certificate matches the private key

sudo openssl x509 \

  -in /etc/pki/mariadb/server-cert.pem \

  -pubkey -noout |

openssl pkey -pubin -outform DER |

sha256sum

sudo openssl pkey \

  -in /etc/pki/mariadb/server-key.pem \

  -pubout -outform DER |

sha256sum

Both SHA-256 values must match.


8. Configure MariaDB TLS

Back up the existing configuration before proceeding.

If no conflicting TLS settings exist, create:

/etc/my.cnf.d/90-mtls.cnf

With the following contents:

[mariadb]

ssl_ca=/etc/pki/mariadb/root-ca.crt

ssl_cert=/etc/pki/mariadb/server-cert.pem

ssl_key=/etc/pki/mariadb/server-key.pem

These are local filesystem paths on the MariaDB server.

ParameterFunction
ssl_caTrusts certificates issued by the private CA
ssl_certPresents MariaDB’s signed server certificate
ssl_keyProvides MariaDB’s private key

Note: Configuring these three settings enables certificate-based TLS support. It does not, by itself, require every database client to present a certificate.

Do not enable require_secure_transport globally until existing connection requirements have been reviewed.


9. Verify SELinux permissions

Check the certificate directory:

getenforce

sudo ls -ldZ /etc/pki/mariadb

sudo ls -lZ /etc/pki/mariadb

Expected SELinux mode:

Enforcing

Confirm that MariaDB can read the files under the active SELinux policy.

If access is denied, inspect the audit log:

sudo ausearch -m AVC,USER_AVC -ts recent

Apply a persistent, policy-appropriate SELinux file-context correction if required.

Do not disable SELinux to bypass certificate access problems.


10. Restart MariaDB and verify TLS

During an approved test window:

sudo systemctl restart mariadb

Verify service status:

sudo systemctl status mariadb –no-pager

If the service fails:

sudo journalctl -u mariadb -n 100 –no-pager

Check the TLS configuration:

sudo mariadb -e “

SHOW GLOBAL VARIABLES

WHERE Variable_name IN

(‘have_ssl’,’ssl_ca’,’ssl_cert’,’ssl_key’);

“

Expected:

have_ssl    YES

The configured certificate paths must match the installed files.


11. Enforce client certificates for the application account

The application team must separately obtain its own CA-signed client certificate and private key.

The MariaDB team does not need to receive or store the application client’s private key.

For the initial test, create a dedicated account rather than modifying the existing ServiceNow account.

Connect using the approved MariaDB administrative account:

sudo mariadb

Execute, replacing the placeholders:

CREATE USER ‘mtls_probe’@’APP_IP’

IDENTIFIED BY ‘STRONG_TEST_PASSWORD’

REQUIRE X509;

Verify:

SHOW CREATE USER ‘mtls_probe’@’APP_IP’;

The account must include:

REQUIRE X509

This requires a trusted client certificate in addition to the MariaDB username and password.

For stricter certificate identity binding, the MariaDB team can subsequently configure REQUIRE SUBJECT and REQUIRE ISSUER using the exact identity and issuer values from the approved client certificate.


12. Validate the MariaDB mTLS connection

The application/test client must possess:

root-ca.crt

client-cert.pem

client-key.pem

These are provided or generated through the application team’s own CA enrollment process.

Test A — Valid client certificate

From a compatible MariaDB command-line client:

mariadb \

  –host=DB_HOSTNAME \

  –port=3306 \

  –user=mtls_probe \

  –password \

  –ssl-ca=/path/to/root-ca.crt \

  –ssl-cert=/path/to/client-cert.pem \

  –ssl-key=/path/to/client-key.pem \

  –ssl-verify-server-cert

Expected: Connection succeeds.

After connecting:

SHOW SESSION STATUS LIKE ‘Ssl_cipher’;

SHOW SESSION STATUS LIKE ‘Ssl_version’;

SELECT CURRENT_USER();

The TLS cipher must be populated.

Test B — Missing client certificate

Repeat the connection with the same database account and password, but without the client certificate and private key.

Ensure client configuration files do not silently supply a certificate.

Expected: Connection fails.

Test C — Untrusted client certificate

Attempt to connect with a client certificate issued by an unrelated CA.

Expected: Connection fails.

Test D — Incorrect database password

Connect with a valid client certificate but an incorrect database password.

Expected: Connection fails.

Test E — Server certificate validation

Verify that the client rejects a MariaDB server certificate that is untrusted or whose hostname does not match the connection target.

Expected: Connection fails.


13. Final acceptance criteria

RequirementExpected result
Root CA certificate installedYes
MariaDB server certificate signed by CAYes
Server certificate matches private keyYes
MariaDB TLS enabledhave_ssl = YES
Test account requires client certificateREQUIRE X509
Valid client certificateConnection succeeds
Missing client certificateConnection rejected
Untrusted client certificateConnection rejected
Incorrect passwordConnection rejected
Server identity validationEnforced
SELinuxEnforcing
MariaDB serviceActive

MariaDB team deliverables

The MariaDB team provides the following to the application integration team:

  1. Database hostname and port.
  2. Public Root CA certificate (root-ca.crt).
  3. Confirmation that MariaDB TLS is operational.
  4. Confirmation that the designated SQL account requires X.509 authentication.
  5. Results of successful and rejected mTLS connection tests.
  6. Certificate expiration date and issuing CA identity.

The MariaDB server private key is not part of the handoff.

Definition of done

MariaDB is operational with its CA-signed server certificate, trusts the designated private CA for client certificate validation, and requires a valid client certificate for the designated application database account.

Successful and rejected connection tests have been demonstrated with SELinux enforcing.

The environment is now ready for the ServiceNow application team to configure Java/JDBC client certificates and perform end-to-end application connectivity testing.

Add the CA team’s issuance procedureSeparate server TLS from client mTLS

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *