NAME

Monitoring::Sneck::Checks::cert_dir - checks every certificate in directories

VERSION

Version 0.0.1

SYNOPSIS

ssl_dir|perl:cert_dir -d /usr/local/etc/ssl
le_certs|perl:cert_dir -d /usr/local/etc/letsencrypt/live -r -m 'cert\.pem$' -w 21 -c 7

DESCRIPTION

Checks every certificate in the PEM files in each directory, without having to name each file. Files with no certificates, such as keys kept next to them, are skipped. A file reached more than once, such as through a symlink, is only checked once, by its own name.

A directory that can not be read is CRITICAL. So is a expired certificate, or one that is not good yet. Otherwise each certificate is WARNING or CRITICAL by the days it has left. A file that can not be read or parsed is UNKNOWN, as is finding no certificates at all.

The status line says how many were checked and which expires soonest. Each one that is not OK gets its own line after it.

OPTIONS

- -d, --dir :: A directory. May be given more than once. Required.

- -r, --recursive :: Look in the directories under them too.

- -m, --match :: A regex the file names must match. Default :: \.(?:pem|crt|cer)$

- -w, --warning :: Days left at or under which it is WARNING. Default :: 30

- -c, --critical :: Days left at or under which it is CRITICAL. Default :: 14

METHODS

check

Does the check.

files

Finds the files to check.

Returns a array ref of the files whose names match, each only once, real files first and then symlinks, each sorted, and a array ref of the directories that could not be read.

my ( $files, $unreadable ) = $check->files;