-
Notifications
You must be signed in to change notification settings - Fork 5.9k
8044609: javax.net.debug options not working and documented as expected #18764
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
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back coffeys! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
Webrevs
|
Tidied up the help menu output to capture current options |
src/java.base/share/classes/sun/security/ssl/CertificateMessage.java
Outdated
Show resolved
Hide resolved
@coffeys This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@coffeys This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the |
System.err.println("\thandshake print each handshake message"); | ||
System.err.println("\tkeygen print key generation data"); | ||
System.err.println("\tkeymanager print key manager tracing"); | ||
System.err.println("\tpluggability print pluggability tracing"); |
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.
Shouldn't this just be removed completely, or marked with "(obsolete)" and moved to the bottom?
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.
/open
good catch. Looks like there hasn't been a use case for years with this option. Removed it.
/open |
@coffeys This pull request is now open |
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.
The issues noted in the previous main comment apparently got missed.
SSLEngineImpl/SSLContextImpl/etc.
This changeset was mostly <=80 and a help comment.
Thanks.
new changes pushed which use the enum design approach for component token management. The new test coverage has been very useful in helping me validate the changes. after checking with Brad, Regards the sub-component options used in the security implementation classes, I think it's better to cover this work via JDK-8344158 where a full audit can be done. I've only updated logging values where an illegal string option was present. " logged https://bugs.openjdk.org/browse/JDK-8344685 to track your request to add back the |
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.
More suggestions which I think will ease user understanding of the option combinations, and simplify the code as well.
Some of my other comments from last week should probably be addressed in this bug, e.g. TLSInputRecord/SSLContextImpl/SSLEngineImpl/SSLTransport
having only verbose
, as several other of this type were also already cleaned up in previous changesets for this bug.
Also note the CSR comments. I can mark that as reviewed when ready.
Thanks.
for (ComponentToken o : ComponentToken.values()) { | ||
if (tmpProperty.contains(o.component)) { | ||
activeComponents.add(o); | ||
// remove the pattern to avoid it being reused |
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.
Brilliant! Great idea!
} | ||
} | ||
// some rules to check | ||
if ((activeComponents.contains(ComponentToken.PLAINTEXT) |
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 logic is so much easier to parse. Great job here too!
} | ||
isOn = true; | ||
isOn = (property.isEmpty() || property.equals("all")) |
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.
What would you think about including EMPTYALL
as an enum option, rather than a separate String property using separate processing checks? This would simplify the logic, and you no longer need to store property
in the class as it's no longer needed. e.g.:
isOn = activeComponents.contains(ComponentToken.EMPTYALL)
|| activeComponents.contains(ComponentToken.SSL));
This would help in the isOn()
section, where you just check for EMPTYALL
} else if (property.isEmpty()) { // use System.Logger | ||
} | ||
|
||
if (property.isEmpty() || property.equals("all")) { |
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.
Then here this becomes:
if (activeComponents.contains(EMPTYALL)) {
return true;
}
return true; | ||
} | ||
|
||
if (checkPoints.equals("ssl")) { |
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 always thought that the ssl
options were additive.
The presence of ssl
in the property outputs those debug statements which only have ssl
defined. The presence of additional options turns on additional debug info. i.e. The property ssl,handshake
turns on both ssl
and ssl,handshake
statements. ssl,handshake,verbose
turns on ssl
, ssl,handshake
, and ssl,handshake,verbose
statements.
I think this style would eliminate these special cases, and the code would just go to the split
/options loop after the EMPTYALL 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.
No, the ssl
option is designed to return all debug statements except those that are extra verbose (data
, packet
, plaintext
). At least that's how the old (JDK 7) and newer TLSv1.3 stacks have been implemented. (with the exception of bug 8044609 which is being addressed here!)
The record
, handshake
, keygen
, session
, defaultctx
, sslctx
, keymanager
, trustmanager
options have always struck me as odd. I reckon no one uses them. The only logic I can see with them is as filtering operations, since the all
or ssl
option is mandatory.
I think the filtering option (if we choose to keep them) is the only purpose we can have for these sub options.
I can't imagine telling users to use ssl
for some TLS debugging but turn on record
or handshake
or keygen
or session
or defaultctx
or sslctx
or keymanager
or trustmanager
options if you fancy other bits of TLS debugging.
Happy to address your CSR comments shortly. Let's agree on the implementation some more first. Nice suggestion on that EMPTYALL value. I'll get that change in shortly.
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 can't imagine telling users...if you fancy other bits of TLS debugging.
That's exactly what I thought it was previously. Have a look at the usage examples in the JSSE Ref Guide, ...To view the hexadecimal dumps of each handshake message, and to print trust manager tracing...
This is just like what is done in the JDK java.security.debug
property in Troubleshooting Security
this.component = this.toString().toLowerCase(Locale.ROOT); | ||
} | ||
|
||
static boolean isSslFilteringEnabled() { |
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 is probably no longer needed if you agree with my additive comment above.
@@ -62,6 +62,7 @@ public final class SSLLogger { | |||
private static final System.Logger logger; | |||
private static final String property; | |||
public static final boolean isOn; | |||
static EnumSet<ComponentToken> activeComponents = EnumSet.noneOf(ComponentToken.class); |
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 could be private/final.
@coffeys This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@coffeys This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the |
/open |
@coffeys This pull request is now open |
Seems to be agreement that the javax.net.debug property should behave in the following manner: "all" indicates that all debug data will be logged As always, an empty value means a System Logger is used. Overhaul of SSLLogger to represent debug levels via a new enum (SSLLogger.Opt) - this has a couple of benefits:
the new isOn method boils down to much simpler logic :
test coverage also improved. |
@coffeys This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply issue a |
The
javax.net.debug
TLS debug option is buggy since TLSv1.3 implementation was introduced many years ago.Where "ssl" was previously a value to obtain all TLS debug traces (except network type dumps, verbose data), it now prints only a few lines for a standard client TLS connection.
The property parsing was also lax and allowed users to declare verbose logging options by themselves where the documentation stated that such verbose options were only meant to be used in conjunction with other TLS options :
as part of this patch, I've also moved the log call to the more performant friendly
System.Logger#log(java.lang.System.Logger.Level,java.util.function.Supplier)
method.the output has changed slightly with respect to that - less verbose
e.g. old style:
e.g. new format:
note one line less per verbose entry and dropping of brackets around verbose output
new test case added to exercise
javax.net.debug
options including the use of theSystem.Logger
option.Progress
Issues
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18764/head:pull/18764
$ git checkout pull/18764
Update a local copy of the PR:
$ git checkout pull/18764
$ git pull https://git.openjdk.org/jdk.git pull/18764/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 18764
View PR using the GUI difftool:
$ git pr show -t 18764
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18764.diff
Using Webrev
Link to Webrev Comment