Skip to content
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

Add clilent IP Address or host name to server side session #3014

Open
1 of 5 tasks
mheege-abb opened this issue Feb 24, 2025 · 7 comments
Open
1 of 5 tasks

Add clilent IP Address or host name to server side session #3014

mheege-abb opened this issue Feb 24, 2025 · 7 comments
Labels
enhancement API or feature enhancement Pending Feedback Pending on further feedbacks or clarification from person who create the issue.

Comments

@mheege-abb
Copy link
Contributor

Type of issue

  • Bug
  • Enhancement
  • Compliance
  • Question
  • Help wanted

Current Behavior

For security reasons, we want to examine the client IP address when a client tries to connect. Please add a property returning the IP address or the host name of the client to Opc.Ua.Server.Session.

Expected Behavior

No response

Steps To Reproduce

No response

Environment

- OS:
- Environment:
- Runtime:
- Nuget Version:
- Component:
- Server:
- Client:

Anything else?

No response

@romanett
Copy link
Contributor

@mheege-abb I am not shure if this is really the right apporach here, as OPC UA already provides some standardized data model for diagnosing sessions, e.g. the SessionDiagnostics Datatype or the or the SessionSecurityDiagnostics DataType.

If you want to injection additional verification in the Session Activation process, I would suggest overriding the ActivateSession Method of the SessionManager. I could also think of adding a "OnBeforeActivate" Callback to the SessionManager class.

@mheege-abb
Copy link
Contributor Author

@romanett Thanks for you quick reply.

For normal communication purposes, I would agree with your suggestion. However, we require the IP address for client validation during trust establishment via the OPC UA part 12 push sequence. At the point in time where we want evaluate the client's IP address, we do not yet trust the client's certificate. The information in the Session[Security]Diagnostics data type that might be helpful for us is SecurityDiagnostics.EndpointUrl. However, this information is not secure since is transferred either in plain text or secured with an untrusted certificate.

Therefore we need to know the IP address of the client. This information comes from the socket itself. If this is modified by an attacker, the client will not get responses and the connect attempt will fail.

@romanett
Copy link
Contributor

@mheege-abb not shure how to wire this up without a tight coupling to the transport channel. I would suggest (if you use Tcp Transport) to override the TcpServerChannel HandleIncomingMessage method & the ProcessOpenSecureChannelRequest to already block clients there? Are you shure none of the OPC UA specified security Mechanisms can help here? Are you familiar with the DeviceOnboarding spec Part 21(https://reference.opcfoundation.org/Onboarding/v105/docs/)(I am not, so not shure if it is helpful in this case).

@mregen
Copy link
Contributor

mregen commented Feb 25, 2025

I think the information you need is e.g. in the TcpMessageSocket. They expose a LocalEndpoint and RemoteEndpoint property. The socket is wired up to the TcpServerChannel. But since the channel implementation is different by transport (tcp, https), it would require a common property to get the information to the server session implementation.
Is the GDS spec demanding the IP check or is it just an additional check that you want to add? I am not familiar with latest releases.

@mheege-abb
Copy link
Contributor Author

mheege-abb commented Feb 27, 2025

@mregen thanks for the quick reply. The GDS spec does not demand IP check, but since establishing trust is a vulnerable process, investigating client information that is not easily spoofable can be quite important.

@romanett
Copy link
Contributor

@mheege-abb we will discuss this internally. However significant changes would be needed to achieve this on the library level.

@romanett romanett added the enhancement API or feature enhancement label Feb 27, 2025
@mheege-abb
Copy link
Contributor Author

@romanett and @mregen Thanks for your support. My solution would lead to a straightforward and easy to us interface, but I agree with you that this would not be easy to implement and it would solve a problem that is quite special. I envision a more generic approach but I am currently too deep into other topics to think through it enough to write it down. I am fine if you don't discuss this issue for now. Please keep the bug open for a month. Once I have time, I add a new comment with my proposal. Thanks again for being so responsive.

@EthanChangAED EthanChangAED added the Pending Feedback Pending on further feedbacks or clarification from person who create the issue. label Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement API or feature enhancement Pending Feedback Pending on further feedbacks or clarification from person who create the issue.
Projects
None yet
Development

No branches or pull requests

4 participants