Last active
February 2, 2017 14:25
-
-
Save hartfordfive/e35db9e7f37ed1667d2e55f06eaceeda to your computer and use it in GitHub Desktop.
Setting up keystone/trustore to use in StreamSets for Kafka hosted on CloudKarafka
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 | |
| # Notes: | |
| # - You must seperate the certificates CloudKarafka provides in the single file into three different files: ca.pem (CA certificate), cert.pem (certificate), key.pem (private key) | |
| # - Once completed, you must copy over the keystore.jks and truststore.jks files over to SDC server in the directory where your config parameters will point to. | |
| # - You SHOULD pick something other than "test1234" for your password | |
| echo -n "Enter a password to use for the keystore: " | |
| read -s PW | |
| echo "" | |
| echo -n -e "Enter path to existing CA certificate: " | |
| read CERT_CA | |
| echo -n -e "Enter path to existing certificate: " | |
| read CERT | |
| echo -n -e "Enter path to existing private key: " | |
| read CERT_PRIVATE_KEY | |
| echo -n -e "Enter destination path for new truststroe/keystore: " | |
| read PATH_KEYSTORE | |
| echo "" | |
| openssl pkcs12 -export -password pass:${PW} -out ${PATH_KEYSTORE}/store.pkcs12 -inkey ${CERT_PRIVATE_KEY} -certfile ${CERT_CA} -in ${CERT} -caname 'CA Root' -name client | |
| keytool -importkeystore -noprompt -srckeystore ${PATH_KEYSTORE}/store.pkcs12 -destkeystore ${PATH_KEYSTORE}/keystore.jks -srcstoretype pkcs12 -srcstorepass ${PW} -srckeypass ${PW} -destkeypass ${PW} -deststorepass ${PW} -alias client | |
| keytool -noprompt -keystore ${PATH_KEYSTORE}/truststore.jks -alias CARoot -import -file ${CERT_CA} -storepass ${PW} | |
| echo "" | |
| read -d '' CONFIGS <<EOF | |
| security.protocol : SSL | |
| ssl.keystore.location : /path/to/keystore.jks | |
| ssl.keystore.password : ${PW} | |
| ssl.key.password : ${PW} | |
| ssl.truststore.location : /path/to/truststore.jks | |
| ssl.truststore.password : ${PW} | |
| EOF | |
| echo "---------------------------------" | |
| echo "Ensure that you also set the folloing configuration parameters" | |
| echo "in your SDC Kafka origin." | |
| echo "You'll also need to copy over the keystore.jks and " | |
| echo "truststore.jks files to the appropriate directories" | |
| echo "---------------------------------" | |
| echo "$CONFIGS" | |
| echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment