Skip to content

Instantly share code, notes, and snippets.

@matthiasbaldi
Created October 22, 2019 17:14
Show Gist options
  • Save matthiasbaldi/d1e34e1f12529bf324056d611ea5e570 to your computer and use it in GitHub Desktop.
Save matthiasbaldi/d1e34e1f12529bf324056d611ea5e570 to your computer and use it in GitHub Desktop.
Traefik 2.0 revoke Let's Encrypt cerificate
#!/usr/bin/env bash
# credits: https://github.com/containous/traefik/issues/635#issuecomment-400423859
# usage: revokeCert.sh {yourDomainToRevoke}
# the JSON path changed a bit compared with Traefik v1
set -e
ACME_FILE=/traefik/path/traefik/acme.json # change
jq -r ".default.Certificates | .[] | select(.domain.main == \"$1\").key" < $ACME_FILE | base64 --decode > /tmp/a.key
jq -r ".default.Certificates | .[] | select(.domain.main == \"$1\").certificate" < $ACME_FILE | base64 --decode > /tmp/a.pem
letsencrypt revoke -d "$1" --key-path /tmp/a.key --cert-path /tmp/a.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment