Skip to main content

Raymii.org Logo (IEC resistor symbol)logo

Quis custodiet ipsos custodes?
Home | About | All pages | RSS Feed | Gopher

Nagios plugin to check an OCSP server

Published: 06-05-2013 | Author: Remy van Elst | Text only version of this article


Table of Contents


This is a nagios plugin to check an OCSP server. It does so by having either aPEM encoded certificate in the code, and the PEM encoded certificate of theissuer in the code, or by using two given PEM files. This is sent to the OCSPserver and the response is then parsed to give the correct nagios result. It istargeted at administrators who have their own OCSP and need to know when it isnot working.

This version has contributions from Pali Sigurdsson.

If you like this article, consider sponsoring me by trying out a Digital OceanVPS. With this link you'll get $100 credit for 60 days). (referral link)

Download

Download the plugin from my github
Download the plugin from raymii.org

Usage

./check_ocsp.sh:

Installation

This guide covers the steps needed for Ubuntu 10.04/12.04 and Debian 6. Itshould also work on other distro's, but make sure to modify the commands whereneeded (package installation for example).

First make sure you have the required tools:

apt-get install gawk grep bash sed wget curl openssl

Place the script on the nagios host (I've placed it in /etc/nagios/plugins/ ):

wget -O */etc/nagios/plugins/check_ocsp_hard.sh http://raymii.org/s/inc/downloads/check_ocsp_hard.sh

Make sure that the script is executable:

chmod +x /etc/nagios/plugins/check_ocsp_hard.sh

Now test it:

/etc/nagios/plugins/check_ocsp_hard.shOK: OCSP up and running - status of certificate for raymii.org GOOD by OCSP: http://ocsp.comodoca.com/

Nagios config

Here's some example nagios config:

Lets create a command definition:

define command{    command_name    check_ocsp    command_line    /etc/nagios-plugins/check_ocsp.sh -H $USER1$ -p $USER2$ --cert $USER3$ --issuer $USER4$}

And a service check:

define service {        use                             generic-service        host_name                       localhost        service_description             OCSP check of $OCSP for $DOMAIN        contact                         nagiosadmin                         check_command                   check_ocsp!raymii.org!443!/etc/ssl/certs/raymiiorg.pem!/etc/ssl/certs/comodo.pem}

Or if you use a hardcoded certificate:

define command{    command_name    check_ocsp_hard    command_line    /etc/nagios-plugins/check_ocsp.sh}define service {        use                             generic-service        host_name                       localhost        service_description             OCSP check of $OCSP for $DOMAIN with hardcoded certificate        contact                         nagiosadmin                         check_command                   check_ocsp_hard}
Tags: certificates, dogtag, monitoring, nagios, ocsp, openssl, software, ssl