Giter Site home page Giter Site logo

xerox-xeon / https-certificate-expiry-checker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codebox/https-certificate-expiry-checker

0.0 1.0 0.0 8 KB

A Python script for checking when HTTPS certificates will expire

Home Page: https://codebox.net/pages/https-certificate-expiry-checker

License: MIT License

Python 100.00%

https-certificate-expiry-checker's Introduction

https-certificate-expiry-checker

This is a Python script for checking the expiry dates of website TLS/SSL certificates, used for creating secure HTTPS connections.

To use the script simply run it from the command line, along with a list of the domain names you wish to check. For example:

> python check-certificates.py codebox.net www.codebox.net api.codebox.net oldtime.radio c0debox.net

Checking 5 endpoints...
codebox.net     OK    expires in 48 days
www.codebox.net OK    expires in 48 days
api.codebox.net OK    expires in 48 days
oldtime.radio   WARN  expires in 6 days 21 hours 13 minutes
c0debox.net     ERROR [Errno 8] nodename nor servname provided, or not known

The script will list the status of each domain's certificate, displaying 'OK' if the certificate was retrieved and is not expiring soon, 'WARN' if the certificate's expiry date is getting close, or 'ERROR' if the certificate has already expired, or if there is some other problem such as the host could not be found, or no certificate could be retrieved.

By default 'WARN' will be displayed if there are less than 7 days until a certificate expires, but this interval can be changed by altering the value of the WARN_IF_DAYS_LESS_THAN variable.

If any of the domains are using a non-standard port for HTTPS then this should be specified using the usual notation of host:port, for example:

> python check-certificates.py test.codebox.net:8443

The script returns an exit code indicating whether the checks passed or not, making it easier to take appropriate action in a shell script (for example, send a email if the checks fail):

Condition Exit Code
Everything is fine, none of the certificates are expiring soon 0
At least one certificate is expiring soon 1
At least one certificate has expired, is invalid, or could not be retrieved 2
Both of the previous conditions occurred 3
No domain list was provided when running the script 9

Certificate checks are performed in parallel, making the process of checking multiple domains much quicker. The number of concurrent checks that will be performed is determined by the value of the WORKER_THREAD_COUNT variable.

https-certificate-expiry-checker's People

Contributors

codebox avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.