class CertCheck::Cert
Attributes
path[R]
Public Class Methods
new(path)
click to toggle source
# File lib/openvpn_cert_nagios/certs.rb, line 3 def initialize(path) @path = path end
Public Instance Methods
chk_command()
click to toggle source
# File lib/openvpn_cert_nagios/certs.rb, line 28 def chk_command Shell.exe("openssl x509 -in #{path} -inform PEM -text -noout -enddate -startdate") end
expiration_date()
click to toggle source
# File lib/openvpn_cert_nagios/certs.rb, line 20 def expiration_date Date.parse(expiration_row.split("=", 2)[1]) end
expiration_row()
click to toggle source
# File lib/openvpn_cert_nagios/certs.rb, line 24 def expiration_row chk_command.find { |x| x =~ /^notAfter=/ } end
expires_in()
click to toggle source
# File lib/openvpn_cert_nagios/certs.rb, line 8 def expires_in expiration_date - Date.today end
message()
click to toggle source
# File lib/openvpn_cert_nagios/certs.rb, line 12 def message "%4d:%s" % [expires_in, name] end
name()
click to toggle source
# File lib/openvpn_cert_nagios/certs.rb, line 16 def name File.basename(path, ".crt") end