Skip to content

Instantly share code, notes, and snippets.

@Kehet
Created January 10, 2021 17:15
Show Gist options
  • Save Kehet/8ec65385a16f52c3874065544e29099f to your computer and use it in GitHub Desktop.
Save Kehet/8ec65385a16f52c3874065544e29099f to your computer and use it in GitHub Desktop.
Extract certificate from Traefik and use it with Weechat
#!/bin/sh
ACME_PATH="/home/kehet/traefik/acme.json"
DOMAIN="secret.example.com"
WEECHAT_PATH="/home/kehet/weechat/weechat"
cat "${ACME_PATH}" | jq '.myresolver.Certificates[] | select( .domain.main == "${DOMAIN}" ) | .key' --raw-output | base64 -d > "${WEECHAT_PATH}/ssl/relay.pem"
cat "${ACME_PATH}" | jq '.myresolver.Certificates[] | select( .domain.main == "${DOMAIN}" ) | .certificate' --raw-output | base64 -d >> "${WEECHAT_PATH}/ssl/relay.pem"
echo "*/relay sslcertkey" > "${WEECHAT_PATH}/weechat_fifo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment