| Server IP : 34.87.99.72 / Your IP : 216.73.217.31 Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 User : bitnami ( 1000) PHP Version : 7.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /opt/bitnami/nami/node_modules/provisioner/lib/recipes/ |
Upload File : |
/// <reference path="../../typings-recipe.d.ts" />
/*
* Download CA certificate to use database with SSL connections
*/
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
recipes.register({
id: "download-database-ssl",
on: { beforeInitialize: {} },
conditions: {
tierModules: { all: ["mysql-client"] },
tierTags: { any: ["requires-database-ssl"] },
platformTags: { any: ["linux"] },
},
recipeHandler: function (input) {
return __awaiter(this, void 0, void 0, function* () {
const ca_cert_url = "https://www.digicert.com/CACerts/BaltimoreCyberTrustRoot.crt.pem";
const ca_cert_url_2020 = "https://cacerts.digicert.com/DigiCertGlobalRootG2.crt.pem";
const ca_cert_destination = $file.join(platform.pathInfo.namiAppPath, "/mysql/certs/");
const ca_cert_file = $file.join(ca_cert_destination, "ca.crt.pem");
const ca_cert_file_2020 = $file.join(ca_cert_destination, "ca.crt.2020.pem");
// Download ca cert
$file.mkdir(ca_cert_destination);
yield utils.retry(() => {
$os.runProgram("curl", ["-Lo", ca_cert_file, ca_cert_url]);
});
yield utils.retry(() => {
$os.runProgram("curl", ["-Lo", ca_cert_file_2020, ca_cert_url_2020]);
});
const ca_cert_file_2020_content = $file.read(ca_cert_file_2020);
$file.append(ca_cert_file, ca_cert_file_2020_content, { atNewLine: true });
});
}
});