Update the example certificate to include the new scheme for hostname
This commit is contained in:
parent
a9acc073a0
commit
5d8972cc19
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* TLS Dashboard by Craine Runton
|
||||
* Source: https://github.com/cmrunton/tls-dashboard
|
||||
*
|
||||
*
|
||||
* See /LICENSE for licensing details
|
||||
*/
|
||||
|
||||
@ -18,17 +18,18 @@ var output = {},
|
||||
// Run the module
|
||||
monitored_hosts.forEach(get_cert_parameters)
|
||||
|
||||
/**
|
||||
/**
|
||||
* Creates a connection to the host, and then reads the resulting peer certificate to extract the desired info
|
||||
*
|
||||
* @param {string} element The
|
||||
* @param {int} index
|
||||
* @param {array} array The
|
||||
*
|
||||
* @param {string} element The
|
||||
* @param {int} index
|
||||
* @param {array} array The
|
||||
*/
|
||||
function get_cert_parameters(element, index, array) {
|
||||
console.log(element);
|
||||
var options = {
|
||||
hostname: element,
|
||||
port: 443,
|
||||
hostname: element.hostname,
|
||||
port: (element.port ? element.port : 443),
|
||||
method: 'GET'
|
||||
};
|
||||
|
||||
@ -40,7 +41,7 @@ function get_cert_parameters(element, index, array) {
|
||||
'org': cert.subject.O,
|
||||
'common_name': cert.subject.CN,
|
||||
'sans': cert.subjectaltname
|
||||
},
|
||||
},
|
||||
'issuer': {
|
||||
'org': cert.issuer.O,
|
||||
'common_name': cert.issuer.CN
|
||||
@ -81,7 +82,7 @@ function get_cert_parameters(element, index, array) {
|
||||
'org': 'Unknown',
|
||||
'common_name': '',
|
||||
'sans': 'Unknown'
|
||||
},
|
||||
},
|
||||
'issuer': {
|
||||
'org': 'Unknown',
|
||||
'common_name': ''
|
||||
@ -151,7 +152,7 @@ function get_cert_parameters(element, index, array) {
|
||||
|
||||
// Set the timeout threshold for the https connection. Set in config.js, default 5000ms
|
||||
req.setTimeout(config.connection_timeout);
|
||||
|
||||
|
||||
// End the request
|
||||
req.end();
|
||||
};
|
||||
@ -166,9 +167,9 @@ function parse_date(date_string) {
|
||||
return date;
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Takes a date string and returns the nuumber of days between now and the future date
|
||||
*
|
||||
*
|
||||
* @param {string} date_string The human readble date string that needs to be parsed
|
||||
*/
|
||||
function get_days_left(date_string) {
|
||||
@ -180,7 +181,7 @@ function get_days_left(date_string) {
|
||||
|
||||
/**
|
||||
* Helper function to put the resolved/parsed cert info into the module output object
|
||||
*
|
||||
*
|
||||
* @param {object} object Contains the parsed certificate info
|
||||
* @param {string} host The name of the host that the certificate info is taken from
|
||||
*/
|
||||
@ -189,7 +190,7 @@ function add_cert_details(object, host) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks the iteration count. If the forEach has iterated over all the hosts, then call the write_results function,
|
||||
* Checks the iteration count. If the forEach has iterated over all the hosts, then call the write_results function,
|
||||
* otherwise log the iteration to the console and increment the count
|
||||
*/
|
||||
function check_iterations() {
|
||||
@ -205,10 +206,10 @@ function check_iterations() {
|
||||
* Writes out the final object to a file, along with the run date to be used by the HTML page later
|
||||
*/
|
||||
function write_results() {
|
||||
fs.writeFile(config.output_file.path+config.output_file.name, 'var run_date = \''+run_date+'\'; \nvar cert_info = '+JSON.stringify(output, null, 2), function(err) {
|
||||
fs.writeFile(__dirname+'/'+config.output_file.path+config.output_file.name, 'var run_date = \''+run_date+'\'; \nvar cert_info = '+JSON.stringify(output, null, 2), function(err) {
|
||||
// If the write errored out, notify
|
||||
if (err) {
|
||||
console.log('Error writing file. \n');
|
||||
if (err) {
|
||||
assert(false, 'Error writing file to the specified location.');
|
||||
}
|
||||
})
|
||||
};
|
||||
|
@ -1,7 +1,9 @@
|
||||
var run_date = 'Fri Jun 17 2016';
|
||||
var cert_info = {
|
||||
"1": {
|
||||
"server": "http-only.runtondev.com",
|
||||
"server": {
|
||||
"hostname":"http-only.runtondev.com"
|
||||
},
|
||||
"subject": {
|
||||
"org": "Unknown",
|
||||
"common_name": "The connection was refused by the remote server",
|
||||
@ -18,7 +20,9 @@ var cert_info = {
|
||||
}
|
||||
},
|
||||
"2": {
|
||||
"server": "www.google.com",
|
||||
"server": {
|
||||
"hostname":"www.google.com"
|
||||
},
|
||||
"subject": {
|
||||
"org": "Google Inc",
|
||||
"common_name": "www.google.com",
|
||||
@ -37,7 +41,9 @@ var cert_info = {
|
||||
}
|
||||
},
|
||||
"3": {
|
||||
"server": "expired.badssl.com",
|
||||
"server": {
|
||||
"hostname":"expired.badssl.com"
|
||||
},
|
||||
"subject": {
|
||||
"org": "Unknown",
|
||||
"common_name": "The certificate has expired",
|
||||
@ -54,7 +60,9 @@ var cert_info = {
|
||||
}
|
||||
},
|
||||
"4": {
|
||||
"server": "incomplete-chain.badssl.com",
|
||||
"server": {
|
||||
"hostname":"incomplete-chain.badssl.com"
|
||||
},
|
||||
"subject": {
|
||||
"org": "Unknown",
|
||||
"common_name": "The server provided a self-signed certificate or the provided certificate chain was incomplete",
|
||||
@ -71,7 +79,9 @@ var cert_info = {
|
||||
}
|
||||
},
|
||||
"5": {
|
||||
"server": "wrong.host.badssl.com",
|
||||
"server": {
|
||||
"hostname":"wrong.host.badssl.com"
|
||||
},
|
||||
"subject": {
|
||||
"org": "Unknown",
|
||||
"common_name": "There was mismatch between the requested hostname and the certificate presented by the server",
|
||||
@ -88,7 +98,9 @@ var cert_info = {
|
||||
}
|
||||
},
|
||||
"6": {
|
||||
"server": "self-signed.badssl.com",
|
||||
"server": {
|
||||
"hostname":"self-signed.badssl.com"
|
||||
},
|
||||
"subject": {
|
||||
"org": "Unknown",
|
||||
"common_name": "The server provided a self-signed certificate or the provided certificate chain was incomplete",
|
||||
@ -105,7 +117,9 @@ var cert_info = {
|
||||
}
|
||||
},
|
||||
"7": {
|
||||
"server": "sha256.badssl.com",
|
||||
"server": {
|
||||
"hostname":"sha256.badssl.com"
|
||||
},
|
||||
"subject": {
|
||||
"common_name": "*.badssl.com",
|
||||
"sans": "DNS:*.badssl.com, DNS:badssl.com"
|
||||
@ -123,7 +137,9 @@ var cert_info = {
|
||||
}
|
||||
},
|
||||
"8": {
|
||||
"server": "www.twitter.com",
|
||||
"server": {
|
||||
"hostname":"www.twitter.com"
|
||||
},
|
||||
"subject": {
|
||||
"org": "Twitter, Inc.",
|
||||
"common_name": "twitter.com",
|
||||
@ -142,7 +158,9 @@ var cert_info = {
|
||||
}
|
||||
},
|
||||
"9": {
|
||||
"server": "nonexistent.runtondev.com",
|
||||
"server": {
|
||||
"hostname":"nonexistent.runtondev.com"
|
||||
},
|
||||
"subject": {
|
||||
"org": "Unknown",
|
||||
"common_name": "The connection was reset by the server or timed out",
|
||||
@ -159,7 +177,9 @@ var cert_info = {
|
||||
}
|
||||
},
|
||||
"10": {
|
||||
"server": "warning.runtondev.com",
|
||||
"server": {
|
||||
"hostname":"warning.runtondev.com"
|
||||
},
|
||||
"subject": {
|
||||
"common_name": "warning.runtondev.com",
|
||||
"sans": ""
|
||||
@ -177,7 +197,9 @@ var cert_info = {
|
||||
}
|
||||
},
|
||||
"11": {
|
||||
"server": "danger.runtondev.com",
|
||||
"server": {
|
||||
"hostname":"danger.runtondev.com"
|
||||
},
|
||||
"subject": {
|
||||
"common_name": "danger.runtondev.com",
|
||||
"sans": ""
|
||||
|
@ -50,7 +50,7 @@ $(function () {
|
||||
*/
|
||||
function create_card(element, index, array){
|
||||
var json = {
|
||||
'server': element.server,
|
||||
'server': element.server.hostname,
|
||||
'days_left': element.info.days_left,
|
||||
'issuer': element.issuer.org,
|
||||
'common_name': element.subject.common_name,
|
||||
@ -172,8 +172,6 @@ $(function () {
|
||||
* Start running the program *
|
||||
************************************************************/
|
||||
$('#created_date').html(run_date);
|
||||
sorted_certificates.forEach(function(element, index, array){
|
||||
create_card(element, index, array)
|
||||
});
|
||||
sorted_certificates.forEach(create_card);
|
||||
create_typeahead();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user