0.4.2 • Published 6 years ago
cmr1-ssl-validator v0.4.2
node-ssl-validator
Scan and validate SSL certificates
Table of contents
CLI
Install globally:
npm install -g cmr1-ssl-validatorShow help:
ssl-validator --helpBasic cli example:
# Scan & validate current directory
ssl-validator 
# Scan & validate default Let's Encrypt directory
ssl-validator /etc/letsencrypt/live --recursive
# Scan & validate default dehydrated directory
ssl-validator /etc/dehydrated/certs --recursiveAdvanced cli example:
ssl-validator \
  # Use recursive flag to group certs by directory
  --recursive \
  # Scan & validate default dehydrated directory
  --directory /etc/dehydrated/certs \          
  
  # Provide cert & key file regular expressions
  --certfile "^(fullchain|cert).pem$" \
  --keyfile "^privkey.pem$" \
  # Provide expiration period in days
  --time 30 \
  # Provide a slack webhook URL for notifications
  --slack https://hooks.slack.com/services/foo/bar/foobar \
  # Provide an executable hook to trigger with invalid certificate info
  --hook /usr/bin/foo-bar \
  # Validate certificates stored on AWS Certificate Manager (ACM)
  --acmModule
Install locally:
npm install --save cmr1-ssl-validatorBasic code example:
// Require cmr1-ssl-validator module
const SslValidator = require('cmr1-ssl-validator');
// Create a new validator with default options
const validator = new SslValidator();
// Run validator with default options
validator.run(err => {
  if (err) {
    // Something went wrong
    validator.error(err);
  } else {
    // All finished
    validator.log('Finished.');
  }
});Advanced code example:
// Require cmr1-ssl-validator module
const SslValidator = require('cmr1-ssl-validator');
// Create a new validator with default options
const validator = new SslValidator({
  // Use recursive flag to group certs by directory
  recursive: true,
  // Scan & validate default dehydrated directory
  directory: '/etc/dehydrated/certs',
  // Provide cert & key file regular expressions
  certfile: '^(fullchain|cert).pem$',
  keyfile: '^privkey.pem$',
  // Provide expiration period in days
  time: 30,
  // Provide a slack webhook URL for notifications
  slack: 'https://hooks.slack.com/services/foo/bar/foobar',
  // Provide an executable hook to trigger with invalid certificate info
  hook: '/usr/bin/foo-bar',
  // Validate certificates stored on AWS Certificate Manager (ACM)
  acm: true
});
// Run validator with default options
validator.run(err => {
  if (err) {
    // Something went wrong
    validator.error(err);
  } else {
    // All finished
    validator.log('Finished.');
  }
});Hooks
An executable can be called after completion with information about failure(s).
Hook arguments:
/path/to/hook EXIT_CODE [DOMAIN_LIST]EXIT_CODEis the exit status of the validator (0or1)DOMAIN_LISTa list of invalid domains, grouped by certificate- Domains are joined by 
, - Groups are joined by 
; - Example: 
abc.co,www.abc.co;xyz.co,www.xyz.co- Two certs: 
abc.co&xyz.co, both with alternate domain name:www. 
 - Two certs: 
 
- Domains are joined by 
 
Success example:
/path/to/hook 0Failure example:
/path/to/hook 1 abc.co,www.abc.co;xyz.co,www.xyz.co0.4.2
6 years ago
0.4.1
6 years ago
0.4.0
7 years ago
0.3.2
7 years ago
0.3.0
8 years ago
0.2.4
8 years ago
0.2.3
9 years ago
0.2.2
9 years ago
0.2.1
9 years ago
0.2.0
9 years ago
0.1.7
9 years ago
0.1.6
9 years ago
0.1.5
9 years ago
0.1.4
9 years ago
0.1.3
9 years ago
0.1.2
9 years ago
0.1.1
9 years ago
0.0.3
9 years ago
0.0.2
9 years ago
0.0.1
9 years ago