nrpe check ipsec certificates

Started by GaardenZwerch, June 20, 2022, 04:47:51 PM

Previous topic - Next topic
Hi,
I would like to include an nrpe check to warn me before cerrtificates in /usr/local/etc/ipsec.d/certs expire.
However those files are not readable to the nagios user and a sudoers entry to the liking of
CHMODIPSECCERTS = /bin/chmod a+r /usr/local/etc/ipsec.d/certs/*
is not working (and not desirable). Any other ideas how I could do this?
Thanks a lot
Frank

June 21, 2022, 08:50:55 AM #1 Last Edit: June 21, 2022, 09:03:59 AM by GaardenZwerch
Hi again,
in case anyone is interested, I circumvented this by running the entire script as root
(edit: open for comments, though :-) )
#!/usr/local/bin/perl -w
#copyto:/usr/local/libexec/nagios/check_ipsec_certs

#re-run as root if we are not root
if ($ENV{USER} ne 'root'){
    my $CMD='/usr/local/bin/sudo /usr/local/libexec/nagios/check_ipsec_certs';
    exec $CMD;     
}
#do the actual checking...