Need private packages and team management tools?Check out npm Orgs. »


1.1.9 • Public • Published

SSL/TLS Certificate Monitor Build Status Maintainability Test Coverage

This module can be used as a stand-alone CLI utility or integrated with a third party monitoring service combined with AWS Lambda.

Stand-Alone CLI

(TODO: provide bash wrapper/install into /usr/local)

$ node index.js --help
Usage: node index.js [--urlsfrom file] [url]
    --help              This message
    --urlsfrom filename File to read newline separated urls
    --cafile filename   Use separate CA file to confirm authority
    --date date         Specify the date to check against for validity
    --days number       If this many days away from expiration, warn, default 30
    --json              Return info as JSON
    [url]               Check this single URL
  Checks each the SSL/TLS certificate for a specified URL
  or URLs from a file (each new-line separated)
  The checks determine if the certificate is considered valid
  Including if the date is considered valid
  By default, uses the system hosts CA resources but you can
  specify a custom CA file to determine if the authority of the
  returned certificates are trusted
  • Check a single URL and process the output via Bunyan:
$ node index.js | ./node_modules/.bin/bunyan
[2017-11-23T19:52:53.414Z]  INFO: certificate-monitor/37777 on Tethys:
    Checking: Url { protocol: 'https:',
      slashes: true,
      auth: null,
      host: '',
      port: null,
      hostname: '',
      hash: null,
      search: null,
      query: null,
      pathname: '/',
      path: '/',
      href: '' }
[2017-11-23T19:52:53.415Z]  INFO: certificate-monitor/37777 on Tethys: subject CN: *
[2017-11-23T19:52:53.415Z]  INFO: certificate-monitor/37777 on Tethys: subject alt: DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*, DNS:*,,,,,,,,,,,,,,,,
[2017-11-23T19:52:53.415Z]  INFO: certificate-monitor/37777 on Tethys: authorized: true
[2017-11-23T19:52:53.415Z]  INFO: certificate-monitor/37777 on Tethys: valid_from: 2017-11-01T13:42:45.000Z
[2017-11-23T19:52:53.415Z]  INFO: certificate-monitor/37777 on Tethys: valid_to: 2018-01-24T13:30:00.000Z
[2017-11-23T19:52:53.415Z]  INFO: certificate-monitor/37777 on Tethys: date_warning: false
[2017-11-23T19:52:53.415Z]  INFO: certificate-monitor/37777 on Tethys: date_checked_against: 2017-11-23T19:52:53.308Z
  • Check multiple URLs using a file with line-separated URLs by passing the name of the file via --urlsfrom
  • By default, the date_warning will check 30 days in advance and will be true if the detected SSL certificate is going to expire within that time period. You can specify different numbers of days via --days. You can specify a particular date to test from via --date

Arbitrary API setup

const cm = require('certificate-monitor');
cm.checkCertificateAtURL("", (certInfo) => {

certInfo will contain information about the certificate and when it will expire/has expired.

AWS API and Lambda Integration

$ make lambda

Creates Upload this to your Lambda function and deploy it, e.g.

Create an API end-point in AWS that points to this Lambda function. API Gateway proxy setup

See lambda.js for the response sent back via the AWS API Proxy.

Upload the that you've created to the Lambda function.

Invokation/testing using cURL:

$ curl -X POST -d '{ "urlList": [ "" ] }'

Pingdom Integration and AWS Lambda

Post Body example:

{ "urlList" : [""] }

Response should look like:

    "headers": {...},
    "statusCode": 200,
    "body": "{\"\":{\"ssl_ok\":true}}"

ssl_ok translates into a check on if the SSL certificate will expire within the next 30 days and if the certificate appears to pass CA checks. If either one of these fails, then ssl_ok will be false.

If you wish to check multiple domains via one uptime pingdom check, you can add more to the urlList, e.g. ["", "...",...] and then check that the returned result does not contain "ssl_ok":false


npm i certificate-monitor

Downloadsweekly downloads









last publish


  • avatar
Report a vulnerability