An open API service indexing awesome lists of open source software.

https://github.com/developerstoolbox/ssl-expiry-gem

A simple ruby gem for checking when ssl certificates expire
https://github.com/developerstoolbox/ssl-expiry-gem

Last synced: 11 months ago
JSON representation

A simple ruby gem for checking when ssl certificates expire

Awesome Lists containing this project

README

          



DevelopersToolbox logo




Github Build Status


License


Created




Release


Released


Commits since release















## Overview

This is a simple little gem for checking when an SSL will expire.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'ssl_expiry'
```

And then execute:

```
$ bundle
```

Or install it yourself as:

```
$ gem install ssl_expiry
```

## Usage

### Simple Usage
```ruby
require 'ssl_expiry'

SSLExpiry::SSLExpiry.check_certificates('wolfsoftware.com')

Results:
{"wolfsoftware.com"=>{"status"=>200, "expires_on"=>"02 Aug 2024", "expires_in"=>57, "common_name"=>"wolfsoftware.com", "issuer"=>"Let's Encrypt"}}
```

#### Multiple Domains

It is possible to check a list of domains rather than just single domains, this is done by passing a list[] to SSLExpiry::SSLExpiry.check_certificates.

```ruby
require 'ssl_expiry'

SSLExpiry::SSLExpiry.check_certificates(['wolfsoftware.com', 'wolfsoftware.net'])
```

### Displaying the output

```ruby
require 'ssl_expiry'

results = SSLExpiry::SSLExpiry.check_certificates('wolfsoftware.com')
SSLExpiry::SSLExpiry.display_results(results)
```

This would give the following output

```shell
----------------------------------------------------------------------------------------------------
Domain | Status
----------------------------------------------------------------------------------------------------
wolfsoftware.com | expires on 02 Aug 2024 (in 57 days) [CN=wolfsoftware.com]
----------------------------------------------------------------------------------------------------
```

## Command Line Tools

There is a command line tool included with this gem.

```shell
check-ssl -d wolfsoftware.com

----------------------------------------------------------------------------------------------------
Domain | Status
----------------------------------------------------------------------------------------------------
wolfsoftware.com | expires on 02 Aug 2024 (in 57 days) [CN=wolfsoftware.com]
----------------------------------------------------------------------------------------------------
```

### Multiple Domains

To check multiple domains at the same time, simply supply a comma separated list.

```shell
check-ssl -d wolfsoftware.com,wolfsoftware.net

------------------------------------------------------------------------------------------------------------------------
Domain | Status
------------------------------------------------------------------------------------------------------------------------
wolfsoftware.com | expires on 02 Aug 2024 (in 57 days) [CN=wolfsoftware.com]
wolfsoftware.net | expires on 02 Aug 2024 (in 57 days) [CN=wolfsoftware.net]
------------------------------------------------------------------------------------------------------------------------
```

### Custom port

If you want to check an SSL expiry on a custom port you can do this by adding the port to the end of the domain.

```
check-ssl -d wolfsoftware.com:8080
```