Created
March 17, 2020 22:27
-
-
Save blackknight36/05a1d31d5cb5939f7076255d8d6fda1b 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 | |
if [ $# -lt 1 ]; | |
then echo "Please provide a host name. For example: $0 spmasv-ignap01" | |
exit 1 | |
fi | |
hostname=$1 | |
domain='dartcontainer.com' | |
ip=`dig +short $hostname.$domain` | |
keystore="$hostname-keystore.key" | |
storepass="ignition" | |
alias="tomcat" | |
rm -f $keystore | |
keytool -genkey -dname "CN=$hostname.$domain, OU=IT, O=Dart Container Corporation, L=Mason, ST=Michigan, C=US" -alias $alias -keyalg RSA -keysize 2048 -keystore $keystore -storepass $storepass -keypass $storepass 2>/dev/null | |
keytool -certreq -alias $alias -file $hostname.csr.txt -keystore $keystore -storepass $storepass -ext "SAN=dns:$hostname.$domain,dns:$hostname,ip:$ip" 2>/dev/null | |
keytool -import -trustcacerts -alias root -file DCIssuingCa.crt -keystore $keystore -storepass $storepass 2>/dev/null | |
echo "Here is your CSR: " | |
cat $hostname.csr.txt | |
echo "To verify this CSR run this command:" | |
echo "openssl req -in $hostname.csr.txt -noout -text" | |
echo "This CSR can be signed by the Dart CA at https://mas-ca02.dartcontainer.com/certsrv/certrqxt.asp" | |
echo "After signing import the cert with this command." | |
echo "keytool -import -trustcacerts -alias $alias -file $hostname.crt.txt" -keystore $keystore -storepass $storepass" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment