Login as root and Create keys on Master

make a directory to hold SSL certs

mkdir -p /var/lib/mysql
cd /var/lib/mysql

Use openssl to generate a key file.

openssl genrsa 2048 > ca-key.pem

set CA common name to "MariaDB admin"

openssl req -new -x509 -nodes -days 730 -key ca-key.pem -out ca-cert.pem

set server certificate common name to "MariaDB server"

openssl req -newkey rsa:2048 -days 730 -nodes -keyout server-key.pem -out server-req.pem
openssl rsa -in server-key.pem -out server-key.pem
openssl x509 -req -in server-req.pem -days 730 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 -out server-cert.pem

set client common name to "MariaDB client"

openssl req -newkey rsa:2048 -days 730 -nodes -keyout client-key.pem -out client-req.pem
openssl rsa -in client-key.pem -out client-key.pem
openssl x509 -req -in client-req.pem -days 730 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 -out client-cert.pem

Verify certificate

openssl verify -CAfile ca-cert.pem server-cert.pem client-cert.pem

Previous Post Next Post