-
Notifications
You must be signed in to change notification settings - Fork 141
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
Opcua client fails to connect to Prosys Simulation Server configured with multiple endpoints #373
Comments
This is strange, I wonder if it's a binary layout issue? MessageSecurityMode is quite clearly either 1, 2, or 3. This is presumably in the It would be good to run wireshark and see what it thinks the payload is, but it really does look to me like the server is setting an invalid value for that field, for some reason. I can't find anything in the standard for modifying that specific enum, at least. |
A workaround that I think can be done with the upcoming rewrite of the type generation is to decode invalid values to the |
I tried analyzing the network packets with Wireshark, but it apparently does not support decrypting OPC UA. I have however gotten a bit closer to figuring it out. The data being parsed out when decoding the I have not figured out if this is caused by this library or by the server. |
I feel like I would need to spend a lot more time reading to figure out if you're right, but this is really good catch if so. I wonder if this applies to the send-side as well? |
Trying to investigate this by connecting to a server in the reference SDK and I can't make that work either, which may or may not be related. |
Not related, just a mistake on my end, and a tiny bug I will fix, not related to your problem. |
It occurs for me when there are many endpoints enabled on the server, so that the message gets chunked up. |
Managed to reproduce, I think, got a Different issue than you got, but that's probably just a coincidence, I imagine you would have gotten a similar error if the decoder managed to continue: |
Got it.
and
I did this deep in my own branch since the compile times are so much better, but I'll see about porting my changes, which includes some other tiny fixes, to the current master branch. I also want to see if I can write a test, though since the server uses the same code it's a bit limited in usefulness. |
This also does not do anything about |
The standard also talks about Authenticated encryption algorithms, which don't have padding? We also need to look into that. The secure_channel code is a total mess at this point, it could use a major cleanup and some more structure, but I want to put together a set of tests against a reference server before we do that. |
Great work! If there is any code you'd like me to try out I'd be glad to help.
I get errors relating to decoding of strings. Because the length becomes crazy when the parsed fields are off. |
I tried it out and it successfully connects to the server and receives the first Publish, but after that it gets an error over and over again every second. This happens with both Security Policy Basic256Sha256 and None. Here is the log output for the full run of simple-client. I terminated it after two errors.
|
Seems to me like the server has closed the client for whatever reason. I think this is almost certainly a different issue, and unrelated to the matter of padding. Anything from the server logs to indicate why the session is closed? |
The server might be making some weird choices when it comes to default session timeout. Could you try setting |
It works if I set So the behavior has changed in the client, do you know if this is intentional or not? But anyway, by setting the |
We should probably set a different session timeout, I'll look into that at some point. We should also revise the keep-alive interval based on revised session timeout, maybe. I'll give it some thought. |
I am trying to connect to Prosys Simulation Server while developing code with this library.
If I connect with SecurityMode None or Sign, it works without issues. But when connecting to the server with the SignAndEncrypt mode and SecurityPolicy Basic256Sha256 it fails with strange errors. I have tried using the simple-client from the examples folder, both with version 0.12 and the latest commit cf2d1bd on master.
simple-client 0.12 output with RUST_OPCUA_LOG=debug
The message
Invalid value 257 for enum MessageSecurityMode
changes values to 257, 513 and 769 depending on which Endpoints I have opened on the server. Interestingly the values correspond to 0x0101, 0x0201 and 0x0301.The only way I can get the simple-client to connect to this server with SignAndEncrypt is if I configure the server with only a single endpoint for SignAndEncrypt and the Basic256Sha256 policy.
I would like to be able to connect to the server with any possible combination of endpoints. If there is anything else I can provide to help debugging this issue I will gladly provide.
Thank you for your time creating this otherwise wonderful library!
The text was updated successfully, but these errors were encountered: