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

Unable to start with custom url as endpoint #1098

Open
padraic-padraic opened this issue Jul 9, 2020 · 5 comments
Open

Unable to start with custom url as endpoint #1098

padraic-padraic opened this issue Jul 9, 2020 · 5 comments

Comments

@padraic-padraic
Copy link

Hello,

I am trying to setup an OPC-UA server and I'm not quite clear on the behaviour of Server.set_endpoint. If I try to use anything other than 0.0.0.0, I get an error from asyncio that it cannot bind to the address. For example, using localhost gives

server.set_endpoint(`opc.tcp://localhost:4840`) .....
OSError: [Errno 99] error while attempting to bind on address ('::1', 4840, 0, 0): cannot assign requested address

And a similar error, with the public IPv4 addres substituted for ::1, if using the server IP.

Am I not using this correctly?

@swamper123
Copy link
Contributor

swamper123 commented Jul 9, 2020

Linux User?
It sounds like an OS restriction.

@padraic-padraic
Copy link
Author

padraic-padraic commented Jul 9, 2020

Yep, necessary context: This is in a docker container based on debain buster. Testing on the server is slightly annoying as system python is stuck at 3.6....

@brubbel
Copy link
Contributor

brubbel commented Jul 9, 2020

Docker containers do not support ipv6 by default.
https://docs.docker.com/config/daemon/ipv6/

First check if you can bind to your specific address and port:
python3 -m http.server 4840 --bind localhost
python3 -m http.server 4840 --bind 127.0.0.1

Also, binding to localhost won't get you anywhere if you want to access from outside.
I don't know if this is good practice, but binding to 0.0.0.0 and publising the port always works.

@padraic-padraic
Copy link
Author

My question then I guess is about the resulting endpoints, which have addresses like 172.x.x.x and a discovery url of 0.0.0.0. Would this potentially cause issues when connecting with a client? For example, we're using the National Instruments client and it seems to use the endpointURL to verify the server certificate as part of opening a session.

@brubbel
Copy link
Contributor

brubbel commented Jul 9, 2020

Would this potentially cause issues when connecting with a client?

Yes.
#680
#687

The working solution is replying to the client with the address that is (or should be) included in the client's own discovery request.
This also works over VPN etc.
The complicated part is to keep a list of certificates at server side for each of the IP's where the server can be contacted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants