Last active
March 26, 2018 20:52
-
-
Save lukebakken/484e1184b9f11d76daa32570bfb388a0 to your computer and use it in GitHub Desktop.
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
*.pkcs12 | |
rabbitmq-perf-test-*/ |
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/sh | |
set -x | |
set -e | |
readonly password='test1234' | |
readonly dir="$(realpath $PWD)" | |
readonly key_store="$dir/client-keystore.pkcs12" | |
readonly trust_store="$dir/client-truststore.pkcs12" | |
readonly perf_test_dir="$dir/rabbitmq-perf-test-2.1.0.M3" | |
# TLS debug: | |
# -Djavax.net.debug=ssl | |
# NOTE: use this if testing the binary artifact | |
# JAVA_OPTS="-Djavax.net.ssl.trustStore=$trust_store -Djavax.net.ssl.trustStoreType=PKCS12 -Djavax.net.ssl.trustStorePassword=$password -Djavax.net.ssl.keyStore=$key_store -Djavax.net.ssl.keyStoreType=PKCS12 -Djavax.net.ssl.keyStorePassword=$password" "$perf_test_dir/bin/runjava" com.rabbitmq.perf.PerfTest -h amqps://localhost:5671 --rate 1 --producers 1 --consumers 1 | |
onexit() | |
{ | |
popd | |
} | |
trap onexit EXIT | |
pushd "$HOME/development/rabbitmq/rabbitmq-perf-test" | |
# NOTE: use this if testing from source | |
mvn -e exec:java "-Djavax.net.ssl.trustStore=$trust_store" \ | |
"-Djavax.net.ssl.trustStoreType=PKCS12" \ | |
"-Djavax.net.ssl.trustStorePassword=$password" \ | |
"-Djavax.net.ssl.keyStore=$key_store" \ | |
"-Djavax.net.ssl.keyStoreType=PKCS12" \ | |
"-Djavax.net.ssl.keyStorePassword=$password" \ | |
-Dexec.mainClass=com.rabbitmq.perf.PerfTest -Dexec.args='-h amqps://localhost:5671 -se --rate 1 --producers 1 --consumers 1' |
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/sh | |
# https://stackoverflow.com/a/1710543 | |
set -x | |
set -e | |
readonly password='test1234' | |
readonly certs_root_dir="$HOME/development/michaelklishin/tls-gen/basic" | |
readonly ca_cert="$certs_root_dir/testca/cacert.cer" | |
readonly client_cert="$certs_root_dir/client/cert.pem" | |
readonly client_key="$certs_root_dir/client/key.pem" | |
readonly client_pfx="$certs_root_dir/client/client.pfx" | |
rm -rf *.jks *.pkcs12 | |
keytool -genkey -dname "cn=client-truststore" -alias client-truststore -keyalg RSA -keystore ./client-truststore.pkcs12 -storetype pkcs12 -keypass "$password" -storepass "$password" | |
keytool -noprompt -import -keystore ./client-truststore.pkcs12 -storepass "$password" -trustcacerts -file "$ca_cert" -alias tls-gen_basic_ca | |
keytool -genkey -dname "cn=client-keystore" -alias client-keystore -keyalg RSA -keystore ./client-keystore.pkcs12 -storetype pkcs12 -keypass "$password" -storepass "$password" | |
openssl pkcs12 -export -out "$client_pfx" -passout "pass:$password" -inkey "$client_key" -in "$client_cert" | |
keytool -importkeystore -srckeystore "$client_pfx" -srcstoretype pkcs12 -srcstorepass "$password" -destkeystore ./client-keystore.pkcs12 -destkeypass "$password" -deststorepass "$password" -deststoretype pkcs12 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment