-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Integration test failure #1461
Comments
Indeed it looks very similar 🤔 and as previously I have no idea about what could be the issue. Did you try : #952 (comment) ? |
😬 Without too much surprise I'm not able to reproduce this issue with :
|
Java 11 gives the same result. Will add the logback config later today :) |
mvn 3.9.3 on master with openjdk 17.0.7 on fedora 38, no build/test issues |
Looks like there's a DTLS issue, the generated x509 certificate during integration tests is not validated (see log file)... I'll see if Windows updates may be responsible for this as I haven't changed any tls/crypto-related packages or libraries myself |
I just looked at it. There is some code in Leshan where we verify that Certificate subject matches hostname.
The certificates for integration tests are created with a I see some Anyway the log message is not so good, we should change it to display what is received and what is expected. protected void validateSubject(final InetSocketAddress peerSocket, final X509Certificate receivedServerCertificate)
throws HandshakeException {
if (X509CertUtil.matchSubjectDnsName(receivedServerCertificate, peerSocket.getHostName()))
return;
if (X509CertUtil.matchSubjectInetAddress(receivedServerCertificate, peerSocket.getAddress()))
return;
AlertMessage alert = new AlertMessage(AlertLevel.FATAL, AlertDescription.BAD_CERTIFICATE);
throw new HandshakeException(String.format(
"Certificate chain could not be validated - server identity %s:%s does not match certificate %s",
peerSocket.getHostName(), peerSocket.getAddress(), receivedServerCertificate), alert);
} then run your test again and share just the stacktrace about |
I fixed the kubernetes thing that was apparently written to my hosts file for no legitimate reason and reverted to the good old 127.0.0.1 localhost line. However there's still something going on with the way the InetSocketAddress looks up the address/hostname. With the additional logging you recommended:
I can successfully resolve 127.0.0.1 to be localhost with ping or other network tools |
Are you sure this a log corresponding to a failing tests ? |
I basically get the same error on all failing tests. Here's an extract. I get this is related to my network setup but I One of the failing test can be run with |
Very hard to me to understand 🤔, especially as I can not reproduce on my side 😬. I tried to launch that test : And check how behave : leshan/leshan-core/src/main/java/org/eclipse/leshan/core/util/X509CertUtil.java Lines 290 to 299 in a356488
line 295, |
@Sylphe88 any news about that ? |
@sbernard31 Not much, I still have the same issue on my machine (but at least the CI runs - as the target is Debian). The problem lies with both matchSubjectInetAddress and matchSubjectDnsName. There's a mismatch in the second one ( Even more odd, a small test java app running InetSocketAddress.getHostName() returns A colleague of mine experiences the same inability to test/build on his Windows machine |
Thx for details. 🙏 The javadoc about
And looking at Leshan Integrations tests code, I see that the InetSocketAddress is created with IP literal, so a name service reserve lookup should be done and for some reason it does not return "localhost". So maybe we could modify the code to create the InetSocketAddress with "localhost". Could you test with private URI getServerUri() {
LwM2mServerEndpoint endpoint = server.getEndpoint(protocolToUse);
URI serverUri = endpoint.getURI();
if (proxy != null) {
// if server is behind a proxy we use its URI
return EndpointUriUtil.replaceAddress(serverUri,
new InetSocketAddress("localhost", proxy.getClientSideProxyAddress().getPort()));
} else {
return EndpointUriUtil.replaceAddress(serverUri, new InetSocketAddress("localhost", serverUri.getPort()));
}
} |
@Sylphe88 did you test this solution ☝️ ? |
Sorry @sbernard31, I've been super busy. I'll try that next week if that's fine |
That's fine 👍 |
I was still late to test it, but it worked fine this time, with the master branch and the return condition you mentioned 💪 Is that "localhost" condition acceptable in all test conditions? 🤔 |
Has this issue been resolved? A similar phenomenon occurs to me. |
@malrancau, when this will be resolved, the issue will be commented and closed.
Did you try : #1461 (comment) ? does it solved your issue ? |
@Sylphe88, Oops I totally missed your comment.
I think using localhost should be OK. I will integrate this kind of fix soon. |
(I created a PR about that #1527) |
The PR is integrated in @Sylphe88 thx a lot for taking time to reporting this 🙏 |
Version(s)
2.0.0
Which components
server- Integration tests
Tested With
No response
What happened
I've got the same issue as #952 , the build log is attached.
My environment is as follows:
Apache Maven 3.8.7 (b89d5959fcde851dcb1c8946a785a163f14e1e29)
Maven home: C:\apache-maven-3.8.7
Java version: 17.0.6, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-17
Default locale: fr_FR, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
I recall being able to build Leshan a few months back on Windows and my environment is likely to be the same as then. The build succeeds on my WSL (most notable difference is Java 11 there).
Any thought?
How to reproduce
Just run a mvn clean install
Relevant Output
No response
leshan-build-fail-SecurityTest.txt
The text was updated successfully, but these errors were encountered: