{"id":17306668,"url":"https://github.com/tcort/check-cert-expiration","last_synced_at":"2025-04-14T13:40:37.228Z","repository":{"id":5952133,"uuid":"54316515","full_name":"tcort/check-cert-expiration","owner":"tcort","description":"query an SSL/TLS server and report its certificate's expiry date","archived":false,"fork":false,"pushed_at":"2023-04-17T02:56:27.000Z","size":41,"stargazers_count":12,"open_issues_count":7,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T02:46:00.601Z","etag":null,"topics":["checker","ssl","ssl-certificates","tls"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tcort.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-20T12:33:08.000Z","updated_at":"2024-11-24T23:28:33.000Z","dependencies_parsed_at":"2024-06-18T23:00:32.544Z","dependency_job_id":"d4a56dac-4541-4cf1-954a-e121ffcf0806","html_url":"https://github.com/tcort/check-cert-expiration","commit_stats":{"total_commits":30,"total_committers":5,"mean_commits":6.0,"dds":"0.19999999999999996","last_synced_commit":"22c5440ec0d9e4a860c30926a69f4a56ee4fe951"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcort%2Fcheck-cert-expiration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcort%2Fcheck-cert-expiration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcort%2Fcheck-cert-expiration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcort%2Fcheck-cert-expiration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tcort","download_url":"https://codeload.github.com/tcort/check-cert-expiration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248578864,"owners_count":21127713,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["checker","ssl","ssl-certificates","tls"],"created_at":"2024-10-15T11:59:03.388Z","updated_at":"2025-04-14T13:40:37.177Z","avatar_url":"https://github.com/tcort.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# check-cert-expiration\n\nQueries an SSL/TLS server and reports when its certificate expires.\n\n## Installation\n\n    npm install --global check-cert-expiration # for the command line utility\n    npm install --save check-cert-expiration # for the library function\n\n## Command Line Interface\n\nThe `check-cert-expiration` script accepts 1 or more URLs as command line arguments and prints the results.\n\nOne optional command line argument is supported:\n\n- `--days-left N` exit with status code `1` if `N` is greater than or equal to `daysLeft`. Useful for warning about certificates expiring soon.\n\n### Examples\n\nHappy path (return code is `0`):\n\n    $ check-cert-expiration tomcort.com github.com\n    host=tomcort.com port=443 valid_to=2018-03-09T10:34:20.000Z daysLeft=89\n    host=github.com port=443 valid_to=2018-05-17T12:00:00.000Z daysLeft=159\n\n    $ check-cert-expiration --days-left 14 tomcort.com\n    host=tomcort.com port=443 valid_to=2020-05-16T17:38:41.000Z daysLeft=37\n\nError path (return code is `1`):\n\n    $ check-cert-expiration does-not-exist.example.com\n    { CHECK_CERT_EXPIRATION_COMM: getaddrinfo ENOTFOUND does-not-exist.example.com does-not-exist.example.com:443\n        at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)\n      errno: 'ENOTFOUND',\n      code: 'ENOTFOUND',\n      syscall: 'getaddrinfo',\n      hostname: 'does-not-exist.example.com',\n      host: 'does-not-exist.example.com',\n      port: 443,\n      name: 'CHECK_CERT_EXPIRATION_COMM' }\n\n    $ check-cert-expiration --days-left 42 tomcort.com\n    { CHECK_CERT_EXPIRATION_DAYS_LEFT: daysLeft is less than or equal to the --days-left command line option\n        at process.argv.forEach (/Users/thomasc/repos/check-cert-expiration/bin/check-cert-expiration:27:25)\n        at process._tickCallback (internal/process/next_tick.js:68:7)\n    name: 'CHECK_CERT_EXPIRATION_DAYS_LEFT',\n    host: 'tomcort.com',\n    port: 443,\n    valid_to: '2020-05-16T17:38:41.000Z',\n    daysLeft: 37,\n    warnDaysLeft: 42 }\n\n## API\n\n### checkCertExpiration(targetUrl)\n\nParameters:\n\n* `targetUrl` - a server URL (e.g. `https://www.tomcort.com/`) or hostname (e.g. `tomcort.com`).\n\nReturn Value:\n\n* result object with the following properties:\n  * `host` - hostname of the host checked.\n  * `port` - TCP port number of the host checked,\n  * `valid_to` - ISO8601 timestamp string.\n  * `daysLeft` - how many days left until the certificate expires.\n\nErrors:\n\nErrors with the following values of `err.name` may occur:\n* `CHECK_CERT_EXPIRATION_URL_PARSE` - when a URL parse error is encountered.\n* `CHECK_CERT_EXPIRATION_BAD_PROTOCOL` - when the protocol portion of the URL is not `https:`\n* `CHECK_CERT_EXPIRATION_COMM` - when there is some type of communications error. \n\n### Examples\n\n    'use strict';\n\n    const checkCertExpiration = require('check-cert-expiration');\n\n    (async function () {\n        try {\n            const { daysLeft, host, port } = await checkCertExpiration('tomcort.com');\n            console.log(`${daysLeft} days until the certificate expires for ${host}:${port}`);\n            process.exit(0);\n        } catch (err) {\n            console.error(`${err.name}:${err.message}`);\n            process.exit(1);\n        }\n    })();\n\n## Testing\n\n    npm test\n\n## License\n\nSee [LICENSE.md](https://github.com/tcort/check-cert-expiration/blob/master/LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftcort%2Fcheck-cert-expiration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftcort%2Fcheck-cert-expiration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftcort%2Fcheck-cert-expiration/lists"}