Last active
May 16, 2016 18:21
-
-
Save tomdavidson/13dae1ad261b0bec69371c87abd6304c to your computer and use it in GitHub Desktop.
install ssl cert on aws, including creating intermediate for a complete chain
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 | |
# unofficial bash strict mode | |
set -euo pipefail | |
IFS=$'\n\t' | |
# Run script from dir with both certificate files and the private key | |
# certificate name on AWS | |
NAME=$1 | |
# certificate file (crt) | |
CRT=${2:-$NAME.crt} | |
# private key file (pem) | |
KEY=${3:-$NAME.key} | |
# DigicertCA2 path | |
CA=${4:-DigiCertCA.crt} | |
# TrustedRoot path | |
TR=${5:-TrustedRoot.crt} | |
# Download certificates on Digicert (Other formats > Individual crt files with | |
# a .cer extension) | |
# Generate intermediate cert - WSO2 Api Manager requires it. Intermediate is | |
# concatenation of CA and Root certs. | |
(openssl x509 -inform PEM -in $CA; openssl x509 -inform PEM -in $TR) > Intermediate.cer | |
# Upload to AWS with awscli | |
aws iam upload-server-certificate \ | |
--server-certificate-name $NAME \ | |
--certificate-body file://$CRT \ | |
--private-key file://$KEY \ | |
--certificate-chain file://Intermediate.cer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment