Remove automatic creation of TLS certificate

The automatic creation of a self-signed certificate while nice presents
several problems.  To make connections not reject the self-signed
certificate the validation of TLS certificates are wholesale disabled,
decreasing the security even when properly set up and trusted
certificates are used.

To make the created self-signed certificate pass validation it is
necessary for it to list the host names it's valid for and to copy it to
each machine that intends to connect to the server.  These two steps
complicate automating the process in a reliable way and will likely lead
to confused users seeking to disable TLS certificate validation as the
easy way out to problems.

For these reasons, remove the automating creation of a broke self-signed
certificate, fix validation of certificates and document how to set up
TLS properly.  This makes HTTPS recommended when accessing over the
internet, but still something which must be explicitly configured.
This commit is contained in:
Hornwitser committed 2021-01-04 08:22:05 +01:00
1 parent a094a06cd1
commit 3592ff3269
16 files changed
+343 -179

No files matched your search

-33
View File
@@ -1,33 +0,0 @@
"use strict";
const assert = require("assert");
const fs = require("fs-extra");
const path = require("path");
const generateSslCert = require("@clusterio/master/src/generate_ssl_cert");
describe("generate_ssl_cert", function() {
let testDir = path.join("temp", "test", "certTest");
before(async function() {
await fs.remove(testDir);
});
it("Creates a folder with a .crt and .key file in it", async function() {
this.timeout(1000);
// eslint-disable-next-line no-process-env
if (process.env.FAST_TEST) {
this.skip();
}
let certPath = path.join(testDir, "cert.crt");
let privKeyPath = path.join(testDir, "cert.key");
await generateSslCert({
bits: 512, // This is too small for real world usage, but faster to test
sslCertPath: certPath,
sslPrivKeyPath: privKeyPath,
});
assert(await fs.exists(certPath), "cert file was not created");
assert(await fs.exists(privKeyPath), "key file was not created");
});
});