-
Notifications
You must be signed in to change notification settings - Fork 306
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
APPSERV-149 Add Command to Generate Self-Signed Certificate #4694
Conversation
Jenkins test please |
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.
Can't say I can reason much about the process or its details. Managed to find two NPE issues. Otherwise only some minor style comments.
...main/java/fish/payara/certificate/management/admin/GenerateSelfSignedCertificateCommand.java
Show resolved
Hide resolved
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
public class GenerateSelfSignedCertificateCommandTest extends CertificateManagementUtils { |
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.
Extending the util has a bit of a taste. I'd prefer using static method imports to use the util methods without qualified access.
truststorePassword = CertificateManagementUtils.getPasswordFromListener(parser, listener, "trust-store-password"); | ||
} | ||
|
||
if (keystorePassword != null || keystorePassword.length > 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.
Testing suggests that this should be if (keystorePassword != null && keystorePassword.length > 0) {
for (Map<String, String> listenerAttributes : parser.getProtocolAttributes()) { | ||
if (listenerAttributes.get("name").equals(listener)) { | ||
// Get the keystore from the listener if it has a custom one | ||
password = listenerAttributes.get(attribute).toCharArray(); |
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.
This causes a NPE when listenerAttributes does not have a password attribute which I apparently managed to create as test case. I suspect the same applies to the assignment in 312.
Jenkins test please |
Description
Adds a CLI command for generating a self-signed certificate and storing in a target instance's or listener's key and trust stores.
Testing
New tests
Unit test that ensures that alternatives names are added to the keytool command in the expected format.
Testing Performed
set
command)set
command)set
command)Testing Environment
Windows 10, JDK 8.
Notes for Reviewers
HTTP and IIOP listeners do not automatically reload any changes to their configuration, which includes changes to a configured key store or certificate. You do not need to restart the server to refresh the configuration however, you can simply restart the listener by disabling and re-enabling it.
Also note listeners are lazy loaded.
I'd appreciate it if you also redid all (or at least some) of my manual tests, or any scenarios I've missed.
To build please specify the BuildExtras profile and manually copy-pasta the Jar from
appserver/extras/certificate-management/
into thepayara5/glassfish/lib/asadmin directory
.