speed up dhparam creation
This commit is contained in:
@@ -71,9 +71,10 @@ async function initSecrets() {
|
||||
// TODO maybe skip this in tests if possible again
|
||||
let dhparams = await get(exports.DHPARAMS);
|
||||
if (!dhparams) {
|
||||
debug('initSecrets: generating dhparams.pem. this takes forever');
|
||||
debug('initSecrets: generating dhparams.pem');
|
||||
if (constants.TEST) dhparams = safe.fs.readFileSync('/tmp/dhparams.pem');
|
||||
if (!dhparams) dhparams = safe.child_process.execSync('openssl dhparam 2048');
|
||||
// https://security.stackexchange.com/questions/95178/diffie-hellman-parameters-still-calculating-after-24-hours
|
||||
if (!dhparams) dhparams = safe.child_process.execSync('openssl dhparam -dsaparam 2048');
|
||||
if (!dhparams) throw new BoxError(BoxError.OPENSSL_ERROR, safe.error);
|
||||
if (constants.TEST) safe.fs.writeFileSync('/tmp/dhparams.pem', dhparams);
|
||||
if (!safe.fs.writeFileSync(paths.DHPARAMS_FILE, dhparams)) throw new BoxError(BoxError.FS_ERROR, `Could not save dhparams.pem: ${safe.error.message}`);
|
||||
|
||||
Reference in New Issue
Block a user