Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save killbus/c97996a2271a7ba449bd524078f48c76 to your computer and use it in GitHub Desktop.
Save killbus/c97996a2271a7ba449bd524078f48c76 to your computer and use it in GitHub Desktop.

with bash

#!/bin/bash



[ ! -d splitted ] && mkdir splitted

while read domain

do

fqdn=$(echo $domain | tr '\n' ' ' | awk '{print $1}')

cert=$(echo $domain | awk '{print $2}' | base64 --decode )

key=$(echo $domain | awk '{print $3}' | base64 --decode )

echo $fqdn

cat > splitted/$fqdn.crt << EOF

$cert

EOF

cat > splitted/$fqdn.key << EOF

$key

EOF

openssl x509 -in splitted/$fqdn.crt -noout -text || less splitted/$fqdn.crt

done < <(cat acme.json | jq '.le.Certificates[]| "\(.domain.main) \(.certificate) \(.key)"' | sed 's/"//')

credit: https://www.reddit.com/r/Traefik/comments/g1hhen/how_do_you_get_the_certs_out_of_the_acmejson/fngq2pe?utm_source=share&utm_medium=web2x

useful commands

test

openssl s_client -showcerts -connect example.com:443

tools to parse certificate

online

https://gchq.github.io/CyberChef/#recipe=Parse_X.509_certificate('PEM')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment