generate dhparams per server

this way we don't need to save/restore it from the database.
This commit is contained in:
Girish Ramakrishnan
2021-11-16 23:03:16 -08:00
parent c4db0d746d
commit 1c8e699a71
5 changed files with 17 additions and 29 deletions

View File

@@ -767,6 +767,13 @@ async function writeDefaultConfig(options) {
}
}
if (!fs.existsSync(paths.DHPARAMS_FILE)) {
debug('writeDefaultConfig: generating dhparams');
const dhparams = safe.child_process.execSync('openssl dhparam -dsaparam 2048');
if (!dhparams) throw new BoxError(BoxError.OPENSSL_ERROR, safe.error);
if (!safe.fs.writeFileSync(paths.DHPARAMS_FILE, dhparams)) throw new BoxError(BoxError.FS_ERROR, `Could not save dhparams.pem: ${safe.error.message}`);
}
const data = {
sourceDir: path.resolve(__dirname, '..'),
vhost: '',