Skip to main content 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 the plugin from my github
Download the plugin from




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/

Make sure that the script is executable:

chmod +x /etc/nagios/plugins/

Now test it:

/etc/nagios/plugins/check_ocsp_hard.shOK: OCSP up and running - status of certificate for GOOD by OCSP:

Nagios config

Here's some example nagios config:

Lets create a command definition:

define command{    command_name    check_ocsp    command_line    /etc/nagios-plugins/ -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!!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/}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