Fixed certificate creation problem.
This commit is contained in:
parent
87ede3be0e
commit
c2cda23e83
|
@ -307,7 +307,7 @@ module.exports.CertificateOperations = function (parent) {
|
|||
var keys = obj.pki.rsa.generateKeyPair({ bits: (strong == true) ? 3072 : 2048, e: 0x10001 });
|
||||
var cert = obj.pki.createCertificate();
|
||||
cert.publicKey = keys.publicKey;
|
||||
cert.serialNumber = require('crypto').randomBytes(4).readUInt32BE(0);
|
||||
cert.serialNumber = '' + require('crypto').randomBytes(4).readUInt32BE(0);
|
||||
cert.validity.notBefore = new Date(2018, 0, 1);
|
||||
cert.validity.notAfter = new Date(2049, 11, 31);
|
||||
if (addThumbPrintToName === true) { commonName += '-' + obj.pki.getPublicKeyFingerprint(cert.publicKey, { encoding: 'hex' }).substring(0, 6); }
|
||||
|
@ -329,7 +329,7 @@ module.exports.CertificateOperations = function (parent) {
|
|||
var keys = obj.pki.rsa.generateKeyPair({ bits: (strong == true) ? 3072 : 2048, e: 0x10001 });
|
||||
var cert = obj.pki.createCertificate();
|
||||
cert.publicKey = keys.publicKey;
|
||||
cert.serialNumber = require('crypto').randomBytes(4).readUInt32BE(0);
|
||||
cert.serialNumber = '' + require('crypto').randomBytes(4).readUInt32BE(0);
|
||||
cert.validity.notBefore = new Date(2018, 0, 1);
|
||||
cert.validity.notAfter = new Date(2049, 11, 31);
|
||||
if (addThumbPrintToName === true) { commonName += "-" + obj.pki.getPublicKeyFingerprint(cert.publicKey, { encoding: 'hex' }).substring(0, 6); }
|
||||
|
|
|
@ -4662,7 +4662,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
|||
obj.app.use(function (req, res, next) {
|
||||
// Set the real IP address of the request
|
||||
// If a trusted reverse-proxy is sending us the remote IP address, use it.
|
||||
const ipex = (req.ip.startsWith('::ffff:')) ? req.ip.substring(7) : req.ip;
|
||||
var ipex = '0.0.0.0';
|
||||
if (typeof req.ip == 'string') { ipex = (req.ip.startsWith('::ffff:')) ? req.ip.substring(7) : req.ip; }
|
||||
if (
|
||||
(obj.args.trustedproxy === true) ||
|
||||
((typeof obj.args.trustedproxy == 'object') && (obj.args.trustedproxy.indexOf(ipex) >= 0)) ||
|
||||
|
@ -4735,7 +4736,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
|||
obj.agentapp.use(function (req, res, next) {
|
||||
// Set the real IP address of the request
|
||||
// If a trusted reverse-proxy is sending us the remote IP address, use it.
|
||||
const ipex = (req.ip.startsWith('::ffff:')) ? req.ip.substring(7) : req.ip;
|
||||
var ipex = '0.0.0.0';
|
||||
if (typeof req.ip == 'string') { ipex = (req.ip.startsWith('::ffff:')) ? req.ip.substring(7) : req.ip; }
|
||||
if (
|
||||
(obj.args.trustedproxy === true) ||
|
||||
((typeof obj.args.trustedproxy == 'object') && (obj.args.trustedproxy.indexOf(ipex) >= 0)) ||
|
||||
|
|
Loading…
Reference in New Issue