node-openssl-rest
Advanced tools
Comparing version 0.0.14 to 0.0.18
@@ -11,2 +11,3 @@ var express = require('express'), | ||
var md5 = require('md5'); | ||
var ocsplib = require('../lib/ocsp_checker.js'); | ||
@@ -702,2 +703,50 @@ /*var rsakeyoptions = { | ||
router.post('/ocspChecker', function(req, res) { | ||
var ocsp = new ocsplib(); | ||
console.log(req.body) | ||
var netcertoptions = { | ||
hostname: req.body.hostname, | ||
port: 443, | ||
starttls: false, | ||
protocol: 'https' | ||
} | ||
ocsp.getCertFromNetwork(netcertoptions, function(err, response, cmd) { | ||
var data = { | ||
error: err, | ||
response: response, | ||
command: cmd | ||
} | ||
//console.log(cmd.cert); | ||
//console.log(response); | ||
if(response) { | ||
if(response.indexOf('unauthorized') >= 0) { | ||
ocsp.query(cmd.cert, function(err, response, cmd) { | ||
data = { | ||
error: err, | ||
response: response, | ||
command: cmd | ||
} | ||
if(err) { | ||
//console.log(data); | ||
res.json(data); | ||
} else { | ||
//console.log(resp); | ||
//for(var i = 0; i <= cmd.ca.length - 1; i++) { | ||
// console.log(cmd.ca[i]); | ||
//} | ||
//console.log(cmd.cert); | ||
//console.log(data); | ||
res.json(data); | ||
} | ||
}); | ||
} else { | ||
res.json(data); | ||
} | ||
} else { | ||
res.json(data); | ||
} | ||
}); | ||
}); | ||
router.post('/pasteECCKey', function(req, res) { | ||
@@ -704,0 +753,0 @@ //console.log(req.body); |
@@ -0,0 +0,0 @@ var express = require('express'), |
var config = { | ||
//for public hosted, create CA directory for source IP | ||
caIPDir: true, | ||
caIPDir: process.env.CAIPDIR || false, | ||
hosted: process.env.HOSTED || false, | ||
httpport: 8081, | ||
httpport: process.env.HTTPPORT || 8080, | ||
httpsport: 8444, | ||
httpsport: process.env.HTTPSPORT || 8443, | ||
@@ -10,0 +12,0 @@ //will enable ocsp and aia |
@@ -6,5 +6,9 @@ module.exports = { | ||
env: { | ||
PUBLICHTTP: "certificatetools.com:8080" | ||
PUBLICHTTP: false, | ||
CAIPDIR: false, | ||
HTTPPORT: 8080, | ||
HTTPSPORT: 8443, | ||
HOSTED: false | ||
} | ||
}] | ||
} |
18
email.js
var email = { | ||
//email address to send usage data | ||
emailParams: true, | ||
emailParams: process.env.EMAILPARAMS || true, | ||
nodemailertransportparams: { | ||
host: 'notjustnetworks.com', | ||
port: 465, | ||
secure: true | ||
host: process.env.EMAILHOST || 'notjustnetworks.com', | ||
port: process.env.EMAILPORT || 465, | ||
secure: process.env.EMAILSECURE || true | ||
}, | ||
nodemailermailoptions: { | ||
from: '"Node OpenSSL Rest" <notifications@notjustnetworks.com>', // sender address | ||
to: 'notifications@notjustnetworks.com', // list of receivers | ||
subject: 'node-openssl-rest data', // Subject line | ||
from: process.env.EMAILFROM || '"Node OpenSSL Rest" <notifications@notjustnetworks.com>', // sender address | ||
to: process.env.EMAILTO || 'notifications@notjustnetworks.com', // list of receivers | ||
subject: process.env.EMAILSUBJECT || 'node-openssl-rest data', // Subject line | ||
auth: { | ||
user: 'notifications', // generated ethereal user | ||
pass: 'Ls67593176043!' // generated ethereal password | ||
user: process.env.EMAILUSER || 'notifications', // generated ethereal user | ||
pass: process.env.EMAILPASS || 'Ls67593176043!' // generated ethereal password | ||
} | ||
@@ -20,0 +20,0 @@ } |
var ocsplib = require('../lib/ocsp_checker.js'); | ||
var fs = require('fs'); | ||
@@ -12,4 +13,24 @@ var ocsp = new ocsplib(); | ||
ocsp.getCertFromNetwork(netcertoptions, function(err, response) { | ||
console.log(response); | ||
}); | ||
ocsp.getCertFromNetwork(netcertoptions, function(err, response, cmd) { | ||
if(err) { | ||
console.log(err); | ||
} else { | ||
console.log(response); | ||
console.log(cmd); | ||
} | ||
}); | ||
/*fs.readFile('./test.crt', function(err, contents) { | ||
//console.log(contents); | ||
ocsp.query(contents.toString(), function(err, resp, cmd) { | ||
if(err) { | ||
console.log(err); | ||
} else { | ||
console.log(resp); | ||
//for(var i = 0; i <= cmd.ca.length - 1; i++) { | ||
// console.log(cmd.ca[i]); | ||
//} | ||
//console.log(cmd.cert); | ||
} | ||
}); | ||
});*/ |
18
index.js
//var openssl = require('./lib/openssl.js') | ||
var express_ssl = require('./lib/express_ssl.js') | ||
var config = require('./config.js'); | ||
var html = require('./html.js'); | ||
var express = require('express') | ||
@@ -21,3 +22,7 @@ //var multer = require('multer'); | ||
console.log('PUBLICHTTP is set to "' + process.env.PUBLICHTTP + '"'); | ||
console.log('CAIPDIR is set to "' + config.caIPDir + '"'); | ||
console.log('HOSTED is set to "' + config.hosted + '"'); | ||
console.log('HTTPPORT is set to "' + config.httpport + '"'); | ||
console.log('HTTPSPORT is set to "' + config.httpsport + '"'); | ||
console.log('PUBLICHTTP is set to "' + config.publichttp + '"'); | ||
@@ -48,3 +53,4 @@ express_ssl.getSSL(function(sslOptions) { | ||
capabilities: capabilities, | ||
hosted: true | ||
hosted: config.hosted, | ||
header: html.header.join('\r\n') | ||
} | ||
@@ -57,3 +63,9 @@ //console.log(template); | ||
}); | ||
app.get('/ocsp_checker', function(req, res) { | ||
let ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress; | ||
console.log('HTTPS connection from ' + ip); | ||
res.render('ocsp_checker.html', template); | ||
}); | ||
app.use('/', express.static(__dirname + '/views')); | ||
@@ -60,0 +72,0 @@ }); |
var openssl = require('./openssl.js'); | ||
var maxchain = 5; | ||
var curchain = 0; | ||
//var chain = []; | ||
//var maxlength = 4 | ||
/*fs.readFile('./google.crt', function(err, contents) { | ||
openssl.getIssuerURI(contents.toString(), function(err, uri, cmd) { | ||
console.log(uri); | ||
openssl.downloadIssuer(uri, function(err, cert) { | ||
if(err) { | ||
console.log(err); | ||
} else { | ||
console.log(cert); | ||
} | ||
}); | ||
}); | ||
});*/ | ||
/*var getChain = function(cert, callback) { | ||
openssl.getIssuerURI(cert, function(err, uri, cmd) { | ||
if(uri) { | ||
//console.log(uri); | ||
openssl.downloadIssuer(uri, function(err, ca) { | ||
if(err) { | ||
callback('Failed to download CA.', false, false); | ||
} else { | ||
console.log(chain.length); | ||
if(chain.length <= maxlength) { | ||
chain.push(ca); | ||
getChain(ca, callback); | ||
} else { | ||
callback('Too many iterations getting certificate chain', false, false); | ||
} | ||
} | ||
}); | ||
//callback(false, uri); | ||
} else { | ||
if(chain.length >= 1) { | ||
callback(false, chain, false); | ||
} else { | ||
callback('Cannot get issuer from certificate', false, false); | ||
} | ||
} | ||
}); | ||
}*/ | ||
module.exports = function() { | ||
var chain = []; | ||
var maxlength = 4 | ||
var getChain = function(cert, callback) { | ||
openssl.getIssuerURI(cert, function(err, uri, cmd) { | ||
if(uri) { | ||
//console.log(uri); | ||
openssl.downloadIssuer(uri, function(err, ca) { | ||
if(err) { | ||
callback('Failed to download CA.', false, false); | ||
} else { | ||
//console.log(chain.length); | ||
if(chain.length <= maxlength) { | ||
chain.push(ca); | ||
getChain(ca, callback); | ||
} else { | ||
callback('Too many iterations getting certificate chain', false, false); | ||
} | ||
} | ||
}); | ||
//callback(false, uri); | ||
} else { | ||
if(chain.length >= 1) { | ||
callback(false, chain, false); | ||
} else { | ||
callback('Cannot get issuer from certificate', false, false); | ||
} | ||
} | ||
}); | ||
} | ||
this.getCertFromNetwork = function(netcertoptions, callback) { | ||
@@ -11,15 +85,53 @@ openssl.getCertFromNetwork(netcertoptions, function(err, cert, cmd) { | ||
//console.log(cmd); | ||
openssl.getOCSPURI(cert[0], function(err, uri, cmd) { | ||
//console.log(err); | ||
//console.log(cmd); | ||
console.log(uri); | ||
let leaf = cert[0]; | ||
let ca = cert.splice(1).join('\r\n'); | ||
openssl.queryOCSPServer(ca, leaf, uri, function(err, resp, cmd) { | ||
console.log(cmd); | ||
callback(err, resp); | ||
if(err) { | ||
callback('Failed to download certificate(s) for domain.', false, false); | ||
} else { | ||
openssl.getOCSPURI(cert[0], function(err, uri, cmd) { | ||
//console.log(err); | ||
//console.log(cmd); | ||
//console.log(uri); | ||
if(err) { | ||
callback(err, false, false); | ||
} else { | ||
let leaf = cert[0] + '\n'; | ||
let ca = cert.splice(1).join('\n') + '\n'; | ||
//console.log(ca); | ||
//for(let i = 0; i <= ca.length - 1; i++) { | ||
// console.log(ca[i]); | ||
//} | ||
openssl.queryOCSPServer(ca, leaf, uri, function(err, resp, cmd) { | ||
//console.log(resp); | ||
callback(err, resp, cmd); | ||
}); | ||
} | ||
}); | ||
}); | ||
} | ||
}); | ||
} | ||
} | ||
this.query = function(cert, callback) { | ||
//openssl.getIssuerURI(cert, function(err, uri, cmd) { | ||
// callback(false, uri); | ||
//}); | ||
openssl.getOCSPURI(cert, function(err, uri, cmd) { | ||
if(err) { | ||
//console.log(uri); | ||
callback('Failed to get OCSP URI from certificate.', false, false); | ||
} else { | ||
getChain(cert, function(err, chain) { | ||
if(err) { | ||
callback(err, false, false); | ||
} else { | ||
openssl.queryOCSPServer(chain, cert, uri, function(err, resp, cmd) { | ||
if(err) { | ||
console.log(resp); | ||
callback(err, false, false); | ||
} else { | ||
callback(false, resp, cmd); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
} |
@@ -0,0 +0,0 @@ var openssl = require('./openssl.js'); |
const node_openssl = require('node-openssl-cert'); | ||
module.exports = new node_openssl(); | ||
var options = { | ||
binpath: 'C:/Program Files/OpenVPN/bin/openssl.exe' | ||
} | ||
module.exports = new node_openssl(options); |
{ | ||
"name": "node-openssl-rest", | ||
"version": "0.0.14", | ||
"version": "0.0.18", | ||
"description": "REST API and UI for node-openssl-cert", | ||
@@ -12,3 +12,3 @@ "main": "index.js", | ||
"mustache-express": "^1.2.5", | ||
"node-openssl-cert": "*", | ||
"node-openssl-cert": "0.0.69", | ||
"nodemailer": "*", | ||
@@ -15,0 +15,0 @@ "tmp": "0.0.33" |
@@ -0,0 +0,0 @@ # node-openssl-rest |
@@ -0,0 +0,0 @@ module.exports = [ |
@@ -0,0 +0,0 @@ User-agent: * |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
1511987
2135
2
+ Addednode-openssl-cert@0.0.69(transitive)
- Removedcrypto-random-string@4.0.0(transitive)
- Removednode-openssl-cert@0.1.43(transitive)
- Removedtmp@0.2.3(transitive)
- Removedtype-fest@1.4.0(transitive)
Updatednode-openssl-cert@0.0.69