-
Notifications
You must be signed in to change notification settings - Fork 659
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
Missing ClientNonce in OpenSecureChannel message #393
Comments
What is in ClientNonde when using uaexpert (or another client that works)? |
This is what it looks like in UaExpert:
and as Hex Dump
and for direct comparison, the freeopcua version again
|
so uaexpert sends an empty bytestring and not None. Then try to change code and let us know |
If clientNonce is modfied to some bytetring, the channel can be opened. The problem seems to be that freeopcua tries to generate a nonce with 0 bytes length (which is None) when no symmetric key is given However, we fail now at ActivateSessionRequest:
Here, I have no idea why it is failing. |
You have no other choice than comparing data to one that succeed with another client. Not accepting a null bytestring is clearly a bug in your server, but we could change default.. |
But this should be somehow parametrized, for the servers that accept Null bytestring and for that which not. Otherwise we possibly drift from the standard... |
If I set ClientSignature.Signature to None, also the second problem is solved for this server. Can I achieve this also by correctly using client.set_security(...)? So, which parameters do I have to use to set freeopcua to use no security? |
so what does work at the end? ClientNonde must be of length 0 and not None and Signature must be None? Isn't None the default? |
This server works when ClientNonce is not of length 0 and when Signature is None. However, I have no idea how to integrate this in a wise way into the freeopcua code? |
The default for signature is Nevertheless, now I have a userspace work around that allows me to communicate with this server with an unmodified freeopcua from opcua import Client
from opcua.crypto import security_policies
from opcua.ua.uaprotocol_hand import CryptographyNone
import types
client = Client("opc.tcp://10.0.51.9:4840")
# Fix ClientNonce isssue (let symmetric_key_size of securityPolicy let be something else than 0)
sec_policy = security_policies.SecurityPolicy()
sec_policy.symmetric_key_size = 8
self.client.security_policy = sec_policy
# Fix signature method of CryptographyNone
def signature(self, data):
return None
fixed_signature = types.MethodType(signature, CryptographyNone)
self.client.security_policy.asymmetric_cryptography.signature = fixed_signature
client.connect() so, this issue is fixed for me now. |
OK thanks. leave the bug open |
I am trying to connect to a OPC UA server on a Wago PLC. I am using freeopcua-0.90.1 under Python 3.5.2+. Other clients can connect well to the server.
However, using freeopcua leads to following error:
The difference in the wireshark dumps is that the OpenSecureChannel message of freeopcua has a missing ClientNonce
So, I think that clientNonce should not be empty to be conform to the standard.
The text was updated successfully, but these errors were encountered: