OPNsense Forum

English Forums => General Discussion => Topic started by: GaardenZwerch on June 20, 2022, 04:47:51 PM

Title: nrpe check ipsec certificates
Post by: GaardenZwerch on June 20, 2022, 04:47:51 PM
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
Title: [SOLVED] Re: nrpe check ipsec certificates
Post by: GaardenZwerch on June 21, 2022, 08:50:55 AM
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...