Last active
October 10, 2017 18:08
-
-
Save acidprime/28e0eb99e6af495a24507a8a01e2400d to your computer and use it in GitHub Desktop.
Simple example of deleting a cert via the HTTP API https://docs.puppet.com/puppet/latest/http_api/http_certificate_status.html#delete
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CERTNAME=$(puppet master --configprint certname) | |
# Revoke | |
curl \ | |
--verbose \ | |
-X PUT \ | |
-H "Content-Type: text/pson" \ | |
--data '{"desired_state":"revoked"}' \ | |
--cert /etc/puppetlabs/puppet/ssl/certs/$CERTNAME.pem \ | |
--key /etc/puppetlabs/puppet/ssl/private_keys/$CERTNAME.pem \ | |
--cacert /etc/puppetlabs/puppet/ssl/ca/ca_crt.pem \ | |
https://$CERTNAME:8140/production/certificate_status/erica_sivak | |
# Delete | |
curl -X DELETE \ | |
--verbose \ | |
-H "Accept: pson" \ | |
--cert /etc/puppetlabs/puppet/ssl/certs/$CERTNAME.pem \ | |
--key /etc/puppetlabs/puppet/ssl/private_keys/$CERTNAME.pem \ | |
--cacert /etc/puppetlabs/puppet/ssl/ca/ca_crt.pem \ | |
https://$CERTNAME:8140/production/certificate_status/erica_sivak |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tested with
puppet cert generate erica_sivak ./delete-cert.sh puppet cert --list --all | grep erica_sivak -c 0