Skip to content

Instantly share code, notes, and snippets.

@RalphORama
Created February 8, 2020 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RalphORama/919b7caa3dec80dc0fe3c1861d0d871e to your computer and use it in GitHub Desktop.
Save RalphORama/919b7caa3dec80dc0fe3c1861d0d871e to your computer and use it in GitHub Desktop.
Script for generating a pcks12 Java keystore for Plan Player Analytics
#!/usr/bin/env bash
# This script will generate a keystore for use with Plan
# https://www.spigotmc.org/resources/plan-player-analytics.32536/
# After running the script, plug in the details as follows:
# KeyStore_path: the path you specified
# Key_pass: the password you specified
# Store_pass: the same password as Key_pass
# Alias: plan
USAGE="Usage: $0 <domain> <keystore password> [keystore filename]"
if [ -z "$1" ] || [ -z "$2" ]; then
echo "$USAGE"
exit 1
fi
[ -z "$3" ] && KEYSTORE_FILE="Cert.jks" || KEYSTORE_FILE="$3"
echo "$KEYSTORE_FILE"
/usr/bin/openssl pkcs12 -export \
-in "/etc/letsencrypt/live/$1/fullchain.pem" \
-inkey "/etc/letsencrypt/live/$1/privkey.pem" \
-out "$KEYSTORE_FILE" \
-name "plan" \
-passout pass:"$2" \
-passin pass:"$2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment