Skip to content

Instantly share code, notes, and snippets.

@brodygov
Created January 10, 2020 17:24
Show Gist options
  • Save brodygov/6b0547ef1a48c1ba206b52fb81150fec to your computer and use it in GitHub Desktop.
Save brodygov/6b0547ef1a48c1ba206b52fb81150fec to your computer and use it in GitHub Desktop.
#!/bin/bash
set -euo pipefail
usage() {
cat >&2 <<EOM
usage: $(basename "$0") COMMON_NAME
Generate saml certificate and key in the current directory for COMMON_NAME.
For example:
$(basename "$0") staging.login.gov
EOM
}
if [ $# -lt 1 ]; then
usage
exit 1
fi
cn="$1"
year=$(date +%Y)
set -x
openssl req -newkey rsa:2048 -sha256 -x509 -days 395 \
-subj "/C=US/ST=District of Columbia/L=Washington/O=GSA/OU=Login.gov/CN=$cn" \
-keyout "saml$year.key.enc" -out "saml$year.crt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment