Last active
May 16, 2017 12:35
-
-
Save raphink/f76d2542d833a3ec34c602d036a5067e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
CATTLE_CONFIG_URL_V2=${CATTLE_CONFIG_URL/v1/v2-beta} | |
CERT_NAME="$1" | |
function get_cert_val() { | |
local name="$1" k="$2" | |
curl -s -H "Authorization: ${CATTLE_AGENT_INSTANCE_AUTH}" "${CATTLE_CONFIG_URL_V2}"/certificates | \ | |
jq -r ".data[] | select(.name == \"${name}\").${k}" | |
} | |
get_cert_val $CERT_NAME "key" > ${CERT_NAME}.key | |
get_cert_val $CERT_NAME "cert" > ${CERT_NAME}.crt | |
get_cert_val $CERT_NAME "certchain" > ${CERT_NAME}.certchain |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment