summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-09-15 16:34:19 -0600
committermo khan <mo.khan@gmail.com>2020-09-15 16:34:19 -0600
commitc8057b3b01baeaa10fcb075260901e63fdce449f (patch)
tree97c8cc3b60bec56627d520bc1cd539cf4e7c7adb /lib
parentb9f82cd57910e02bbe6cf5bd6ae36b28eb7b0e83 (diff)
fix: install x509 cert into java 11 keystore
Diffstat (limited to 'lib')
-rw-r--r--lib/license/management/tool_box.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/license/management/tool_box.rb b/lib/license/management/tool_box.rb
index 0e39a61..4c41b36 100644
--- a/lib/license/management/tool_box.rb
+++ b/lib/license/management/tool_box.rb
@@ -26,7 +26,7 @@ module License
shell.execute([:asdf, :reshim], env: env)
end
install_common_libraries(env: env) if C_BASED_TOOLS.include?(tool.to_sym)
- install_certificates_into_java_keystore(env) if tool == :java
+ install_certificates_into_java_keystore(env, version) if tool == :java
end
def install_common_libraries(env: {})
@@ -116,10 +116,11 @@ module License
asdf_detected_version_of(:java)
end
- def install_certificates_into_java_keystore(env)
+ def install_certificates_into_java_keystore(env, version)
Dir.chdir shell.custom_certificate_path.dirname do
Dir.glob('custom.*.crt').each do |path|
- keystore_path = "#{env['JAVA_HOME']}/jre/lib/security/cacerts"
+ java_home = Pathname.new(env['JAVA_HOME'])
+ keystore_path = "8" == version ? java_home.join("jre/lib/security/cacerts") : java_home.join("lib/security/cacerts")
shell.execute([:keytool, '-importcert', '-alias', Time.now.to_i, '-file', File.expand_path(path), '-trustcacerts', '-noprompt', '-storepass', 'changeit', '-keystore', keystore_path], env: env)
shell.execute([:keytool, '-list', '-v', '-storepass changeit', '-keystore', keystore_path], env: env)
end