mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 07:33:12 +09:00
Refactor SSL certificate creation
Rewrite the generateSSLcert lib to be async, use the sslCert and
sslPrivKey config entries and invoke it only if needed during master
server startup instead of in the post install script. Also add note to
the changelog covering both this and the fix in c645fac.
This commit is contained in:
1 parent
cc87654742
commit
44b7d0aa19
5 files changed
+58
-52
No files matched your search
+13
-12
@@ -1,25 +1,26 @@
|
||||
var assert = require("assert");
|
||||
var fs = require("fs");
|
||||
var fs = require("fs-extra");
|
||||
|
||||
var fileOps = require("lib/fileOps");
|
||||
var generateSSLcert = require("./generateSSLcert.js")
|
||||
var generateSSLcert = require("lib/generateSSLcert.js")
|
||||
|
||||
describe("generateSSLcert.js(options)", ()=>{
|
||||
it("Creates a folder with a .crt and .key file in it", ()=>{
|
||||
let certPath = "lib/certTestPlsDelete";
|
||||
assert(!fs.existsSync(certPath)); // if it already exsits, the test might pass because of leftover data (which is bad)
|
||||
it("Creates a folder with a .crt and .key file in it", async function() {
|
||||
let certPath = "lib/certTestPlsDelete/cert.crt";
|
||||
let privKeyPath = "lib/certTestPlsDelete/cert.key";
|
||||
assert(!await fs.exists(certPath)); // if it already exsits, the test might pass because of leftover data (which is bad)
|
||||
|
||||
generateSSLcert({
|
||||
await generateSSLcert({
|
||||
// bits:512, // supported, but I just use the default of 2048 for this test
|
||||
certificatePath:certPath,
|
||||
sslCertPath: certPath,
|
||||
sslPrivKeyPath: privKeyPath,
|
||||
doLogging: false,
|
||||
});
|
||||
|
||||
assert(fs.existsSync(certPath));
|
||||
assert(fs.existsSync(certPath+"/cert.key")); // private key
|
||||
assert(fs.existsSync(certPath+"/cert.crt")); // certificate file
|
||||
assert(await fs.exists(certPath)); // private key
|
||||
assert(await fs.exists(privKeyPath)); // certificate file
|
||||
|
||||
// remove certificates and data from the test
|
||||
fileOps.deleteFolderRecursiveSync(certPath);
|
||||
fileOps.deleteFolderRecursiveSync("lib/certTestPlsDelete");
|
||||
}).timeout(10000);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user