-
Notifications
You must be signed in to change notification settings - Fork 216
Add Integration tests with Custom SSL IdentityStore/TrustSore #2282
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
Conversation
@@ -0,0 +1,21 @@ | |||
# Copyright (c) 2020, 2021, Oracle and/or its affiliates. | |||
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new file, remove 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
public class SslTestClient { | ||
private String url; | ||
|
||
public SslTestClient(String[] args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we call it ssl client? there the ssl invoke happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It takes t3s URL to get initial context.
adminServerPodName, domainNamespace); | ||
checkPodReadyAndServiceExists(adminServerPodName, domainUid, domainNamespace); | ||
// Generate JKS Keystore using openssl before | ||
// managed server services and pods are ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is JKS Keystore required before the managed server service and pods are ready? How do you control the keystore is copied before the managed server service and pods are ready?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copy the file immediately after the admin pod is ready and before managed server is being started. That is why insert the copy command between admin server service check and managed server service check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there will be possible race condition. If the keystore is required before the managed server is started, then you can start the admin server first, then copy the files and start the managed servers. CheckPodReady() method only checks the status of the pod and does not control when to start the pod.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After admin server is started it takes few seconds to create the table/JKS files before introspector picks the managed server which takes a minutes to start the server. I also checks if the JMS Server MBean are in proper managed server before proceeding tests. If I see the failure in nightly I have to create a dummy WebLogic Pod to create the table before the domain starts.
-storepass changeit -noprompt | ||
|
||
#keytool -list -v -keystore TrustKeyStore.jks -storepass changeit | ||
#keytool -list -v -keystore IdentityKeyStore.jks -storepass changeit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented out lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,51 @@ | |||
// Copyright (c) 2020, 2021, Oracle and/or its affiliates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
public SslTestClient(String[] args) | ||
{ | ||
url = args[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reformat this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
url = args[0];
url = args[0]; | ||
try { | ||
Context ctx = getInitialContext(); | ||
System.out.println("Got the Initial JNDI Context ["+ctx+"]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add space around "+"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
System.out.println("Got the Initial JNDI Context ["+ctx+"]"); | ||
String cfName="weblogic.jms.ConnectionFactory"; | ||
ConnectionFactory qcf=(ConnectionFactory)ctx.lookup(cfName); | ||
System.out.println("Looked up default JMS connection factory ["+qcf+"]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add space around "+"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
ConnectionFactory qcf=(ConnectionFactory)ctx.lookup(cfName); | ||
System.out.println("Looked up default JMS connection factory ["+qcf+"]"); | ||
} catch ( Exception ex ) { | ||
System.out.println("Got Unknown Exception ["+ ex + "]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add space around "+"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Here is the usecase description
Create a MII domain with an attached persistent volume.
Configure custom identity and custom trust on server template
Enable SSL on server template with port 8002 (default 7002 does not work)
Put the IdentityKeyStore.jks and TrustKeyStore.jks on /shared directory
after administration server pod is started so that it can be accessible
from all managed server pods
Once all servers are started get the JNDI initial context using cluster
service URL with t3s protocol.
Repeat the same after scaling the cluster
Note - Added a new SslUtils class to deal with SSL related tasks
Jenkin Result
https://build.weblogick8s.org:8443/job/weblogic-kubernetes-operator-kind-new/4413/
https://build.weblogick8s.org:8443/job/weblogic-kubernetes-operator-kind-new/4419/