Skip to content

Instantly share code, notes, and snippets.

@kimsterv
Created August 20, 2010 00:29
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 kimsterv/539295 to your computer and use it in GitHub Desktop.
Save kimsterv/539295 to your computer and use it in GitHub Desktop.
http://download.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#CreateKeystore
Make the keystore:
keytool -genkeypair -alias sg -keyalg RSA -validity 7 -keystore keystore
Take a look at it:
keytool -list -v -keystore keystore
Sign it (makes it into a .cer):
keytool -export -alias sg -keystore keystore -rfc -file sgflume.cer
Check it out!:
cat sgflume.cer
Import the certificate into a new truststore (this is where it gets good!):
keytool -import -alias sgflumecert -file sgflume.cer -keystore truststore
"Examine the truststore": keytool -list -v -keystore truststore
Set the options:
Special JOPTS
JOPTS+="-Djavax.net.ssl.keyStore=/home/kim/code/flume/conf/keystore "
JOPTS+="-Djavax.net.ssl.keyStorePassword=password "
JOPTS+="-Djavax.net.ssl.trustStore=/home/kim/code/flume/conf/truststore "
JOPTS+="-Djavax.net.ssl.trustStorePassword=trustword "
(*note the space before the last '"' in the JOPTS above)
(** JOPTS assume you create the keystore and truststore in flume/conf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment