-
-
Notifications
You must be signed in to change notification settings - Fork 80
Add support for adding additional identity material at runtime #655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for adding additional identity material at runtime #655
Conversation
Hi @nfalco79 I have created an initial implementation of your feature request. Can you maybe give it a try on your side if that is possible. You need to checkout the poject, switch to the feature branch, run mvn install and add the snapshot version to your project. SSLFactory sslFactory = SSLFactory.builder()
.withDummyIdentityMaterial()
.withInflatableIdentityMaterial()
.build();
KeyStore keyStore = null; // your additional keystore file
KeyManagerUtils.addIdentityMaterial(sslFactory.getKeyManager().get(), keyStore, "password".toCharArray());
KeyManagerUtils.addIdentityRoute(sslFactory.getKeyManager().get(), "some-alias", "https://google.com:443"); You can also clear & override the the identity routes with the following snippet: KeyManagerUtils.overrideIdentityRoute(sslFactory.getKeyManager().get(), "some-alias", "https://google.com:443"); Can you give it a try and share your results or give feedback? |
Hi, i will try to apply this SNAPSHOT branch to the jenkins plugin. Premise: I am not an expert in SSL, most of the time I limited myself to installing self-signed certificates on the servers or at most importing the public/private keys into some software to sign some content. Looking at the methods you have exposed I have a doubt. I thought that the host routes were associated with a specific KeyStore (in fact in my example the method took 3 parameters, one of which was the host route), so based on the host towards which to perform the handlesnake, the associated KeyStore was retrieved. I also thought that the alias was any string key of my choice to retrieve a host route or the associated keystore, but perhaps I did not understand what they are for and how to use them.
if I have two different keystores, one to perform mTSL to the
To clear do you mean |
thank you very much for the explanation, now it is clear how the alias is used. So before I can add an identity material I must first extract the aliases from the keystore, because in my case I do not know them in advance. The piece of code is simply
it works but after a few call I notice that it does not check if the identity material exists or not so this is after two rest call and this after I scan again a jenkins project There are no API to check if an indentity material has been already registered, and there not API to override existing one. I see another potential issue, if a user provide different keyStore to use against different servers they could use the same alias. Users do not know that alias must be unique in the Jenkins application and Jenkins could provide multiple company if provided as a SaaS service. |
Thank you for testing it on your side, I will address all of your remarks this evening as it makes sense. You dont want to keep adding keymanager unconditionally and want some mechanism to check whether it is already present and conditionally ovverride it. I will keep you posted! |
@nfalco79 I added new methods, which should do the trick for you. I added these:
With get alias you can check. whether the keymanager with the alias name is already present. You can add new or ovveride existing ones with the addIdentityMaterial, and remove the one with removeIdentityMaterial. Can you give it a try with the latest commit from this pr? |
I have added a new function to get the mapped aliases, see here https://github.com/Hakky54/sslcontext-kickstart/pull/655/files#diff-edac107cac3e21aab77f6d1a5ea528c69a0ab7d57a5cdab1054893d32652f549R476 It uses a
I think this is the limitation of using multiple keystores as identity material. I will update the readme to address this limitation and mention that the alias across all keystores should be unique. |
|
No description provided.