Custom Object Gateway SSL/TLS Certificate

This page shows how to create a private key and certificate signing request (CSR) for the object storage (S3) service with OpenSSL, have your certificate authority (CA) sign it, and turn the result into the PEM file QuantaStor uses. To apply the finished file to the systems, see Certificate Template Manager.

Create the certificate before you deploy the object gateways if you can, so you can give it to the gateways when you create them.

Choosing the names

Clients check that the name they connect to appears in the certificate's Subject Alternative Name (SAN) list. Include:

  • the S3 endpoint name clients use, for example s3.example.com,
  • a wildcard for that name, for example *.s3.example.com, if clients put the bucket name in the host name (virtual-hosted style),
  • each system's own name, if clients connect to systems directly,
  • any IP address clients connect to.

QuantaStor refuses a certificate that has no SAN.

Creating the key and CSR

Work in an empty directory:

mkdir s3_cert
cd s3_cert

Create a file named openssl.cnf. Change the values under [ req_distinguished_name ] to your organisation's, and list your names under [ alt_names ]:

[ req ]
default_bits       = 2048
prompt             = no
default_md         = sha256
distinguished_name = req_distinguished_name
req_extensions     = req_ext

[ req_distinguished_name ]
C  = US
ST = Washington
L  = Bellevue
O  = Example Organization
OU = Storage
CN = s3.example.com

[ req_ext ]
subjectAltName = @alt_names

[ alt_names ]
DNS.1 = s3.example.com
DNS.2 = *.s3.example.com
DNS.3 = qs-node1.example.com
DNS.4 = qs-node2.example.com
DNS.5 = qs-node3.example.com
IP.1  = 192.0.2.11
IP.2  = 192.0.2.12
IP.3  = 192.0.2.13

Generate the private key, then the CSR:

openssl genrsa -out s3.key 2048
openssl req -new -key s3.key -config openssl.cnf -out s3.csr

Check the CSR before you submit it. The output should show your subject and, under Subject Alternative Name, every name you listed:

openssl req -in s3.csr -noout -text

Keep s3.key private. Anyone who has it can pose as your S3 service.

Having the CSR signed

Submit s3.csr to your CA and follow its process.

Download the signed certificate and the CA chain. A CA can supply them as Base64 (PEM) text or as binary DER files, often a .cer file for the certificate and a .p7b file for the chain.

Converting the CA's files to PEM

If the chain arrived as a .p7b file, extract its certificates as PEM text:

openssl pkcs7 -print_certs -in certnew.p7b -inform DER -out chain.pem

Leave out -inform DER if the .p7b file is Base64 text, which starts with -----BEGIN PKCS7-----. The output also holds your server certificate when the CA included it. Build the PEM file from the certificates that issued yours, and check the order as described below.

Building the PEM file

Combine the key, the server certificate and the chain into one file, in that order:

cat s3.key > s3.pem
openssl x509 -in certnew.cer >> s3.pem
cat chain.pem >> s3.pem

openssl x509 reads the certificate whether the CA sent it as PEM text or as binary DER, and writes it as PEM text. Before you add the file to QuantaStor, run the checks in Checking the file.

Applying the certificate

  • New object gateways. The Add S3 Gateway To Ceph Cluster dialog has a Certificate (PEM) field. Select s3.pem there. If you leave it empty, QuantaStor creates a self-signed certificate for the gateway.
  • Existing object gateways and the load balancer. Add s3.pem as a template and apply it with Update, as described on Certificate Template Manager.

Trusting the CA on clients

Clients have to trust the CA that signed the certificate. A public CA is usually trusted already. For a private CA, add its root certificate to each client's trust store. On Ubuntu and Debian, save the root certificate as a file ending in .crt:

cp example-root-ca.crt /usr/local/share/ca-certificates/
update-ca-certificates

An S3 application that keeps its own trust store needs the CA added to that store as well. See the application's documentation.

Testing from a client

From a client that trusts the CA, check the certificate the load balancer serves:

echo | openssl s_client -connect s3.example.com:8580 -servername s3.example.com 2>&1 | grep -E 'subject=|Verify return code'

You should see your certificate's subject and Verify return code: 0 (ok). Port 8580 is the load balancer. Use port 7480 to test an object gateway directly.

Related pages


Verified against QuantaStor 6.9.0.