This directory provides scripts to generate a complete certificate hierarchy for MangoCloud, including:
- Root Certificate Authority (CA)
- Issuer CA (subordinate to the Root CA)
- Server certificates
- Client certificates
These certificates are essential for securing communication between MangoCloud components such as servers and clients using TLS/SSL.
Ensure OpenSSL is installed and accessible on your system. Install on Ubuntu:
sudo apt-get install opensslExample:
CA_CERT_VALIDITY_DAYS=7300
LEAF_CERT_VALIDITY_DAYS=825
CA_CERT_VALIDITY_DAYS is used for Root CA and Issuer CA certificates.
LEAF_CERT_VALIDITY_DAYS is used for Server and Client certificates.
Before running the scripts, update the certificate subject fields to match your environment.
Update the certificate subject values as needed, including commonName, countryName, stateOrProvinceName, and organizationName, in the following files:
- Root CA:
conf/rootca.cnf - Issuer CA:
conf/issuer.cnf - Server certificate:
conf/server.cnf - Client certificate:
conf/client.cnf
Run the script to generate the Root Certificate Authority:
./createRootCA.shGenerate the Issuer CA signed by the Root CA:
./createIssuer.shCreate the server's private key and certificate:
Make sure commonName is set to your actual domain name in: conf/server.cnf
./createServerCerts.shGenerate the client's private key and certificate.
client_id must be exactly 12 characters (for example, aabbccddeeff):
./createClientCerts.sh <client_id>./transfer_server_certificates.shThis script will be used to transfer device certs. Client certificate files will be placed on the device with the following names: operational.pem, operational.ca, and key.pem. If you are using a client firmware version earlier than 4.0, rename the files as follows:
- operational.pem -> cert.pem
- operational.ca -> cas.pem
./transfer_client_certificates.sh