Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bundle agent dane {
- vars::
- #Populate how you like
- "cert_subject" string => "/C=/ST=/L=/O=/CN=$(sys.fqhost)";
- classes::
- "certificate_exists" expression => fileexists("/etc/pki/tls/certs/$(sys.fqhost).pem");
- "key_exists" expression => fileexists("/etc/pki/tls/private/$(sys.fqhost).pem");
- "certificate_date_ok" expression => returnszero("/usr/lib64/nagios/plugins/check_http -H localhost -C 30,30 &> /dev/null", "useshell");
- commands:
- !certificate_exists|!key_exists::
- "/usr/bin/openssl"
- comment => "Generate Self Signed Certificate",
- args => "req -x509 -nodes -days 365 -subj '$(cert_subject)' -newkey rsa:2048 -keyout /etc/pki/tls/private/$(sys.fqhost).pem -out /etc/pki/tls/certs/$(sys.fqhost).pem";
- !certificate_date_ok.certificate_exists.key_exists::
- "/usr/bin/openssl"
- comment => "Generate Self Signed Certificate",
- args => "req -x509 -nodes -days 365 -subj '$(cert_subject)' -newkey rsa:2048 -keyout /etc/pki/tls/private/$(sys.fqhost).pem -out /etc/pki/tls/certs/$(sys.fqhost).pem";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement