const sequelize = new Sequelize(
configuration.get("postgresConnectionString"),
{
logging: false,
dialectOptions: {
ssl: {
ca: fs.readFileSync(path.join(__dirname, "/ssl/DigiCertGlobalRootG2.crt.pem")),
rejectUnauthorized: true,
require: true,
},
},
},
);
DigiCertGlobalRootG2.crt.pem: Is a combination of 2 key for constitency(BaltimoreCyberTrustRoot.crt.pem gonna expiry soon).One file with multiple keys as
----- BEGIN CERTIFICATE -----
BaltimoreCyberTrustRoot.crt.pem
----- END CERTIFICATE -----
----- BEGIN CERTIFICATE -----
DigiCertGlobalRootG2.crt.pem
-----END CERTIFICATE-----
Connecting to Azure postgress from node.js application using Sequelize ORM with support of SSL.
DigiCertGlobalRootG2.crt.pem: You will get it from the Azure portal.
Note: If not using any key then ssl configuration is like this:
const sequelize = new Sequelize(
configuration.get("postgresConnectionString"),
{
logging: false,
dialectOptions: {
ssl: true,
},
},
);
Note: Please check the connectionString
ends with sslmode=require|| ssl_ca=required: https://learn.microsoft.com/en-us/azure/mysql/concepts-certificate-rotation
, based this, please add SSL configuration accordingly
Note: The content you feel need a change , please let me know