Azure-Samples / iot-edge-opc-plc

Sample OPC UA server with nodes that generate random and increasing data, anomalies and much more ...
MIT License
220 stars 95 forks source link

certdnsnames and plchostname not used in the certificate #318

Closed JeremyTheocharis closed 9 months ago

JeremyTheocharis commented 9 months ago

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

docker run --rm -it -p 50000:50000 -p 8080:8080 --name opcplc mcr.microsoft.com/iotedge/opc-plc:latest --pn=50000 --autoaccept --sph --sn=5 --sr=10 --st=uint --fn=5 --fr=1 --ft=uint --gn=5 --plchostname=localhost --showpnjsonph --certdnsnames=localhost

Any log messages given by the failure

2023-11-27_11h46_37

Expected/desired behavior

localhost should show up in the DNS names in the certificate

OS and Version?

Docker Desktop on Windows 11

Versions

docker latest

Mention any other details that might be useful

We are integrating the simulator as test simulator for the open-source project "benthos-umh" (https://github.com/united-manufacturing-hub/benthos-umh). We are troubleshooting why the server is closing the connection unexpectedly, and came up with this smaller problem. Maybe fixing this will solve the larger problem we are working on. If this does not fix our actual problem, we will probably create a separate issue for this.


Thanks! We'll be in touch soon.

luiscantero commented 9 months ago

Hi, the stack SDK replaces localhost automatically. For your use-case you could do something like this:

docker run --rm -it -p 50000:50000 -p 8080:8080  -h someservername --name opcplc mcr.microsoft.com/iotedge/opc-plc:latest --pn=50000 --autoaccept --sph --sn=5 --sr=10 --st=uint --fn=5 --fr=1 --ft=uint --gn=5 --plchostname=localhost --showpnjsonph

You can also replace someservername above with localhost and it shows in the dnsnames list. Please let me know if this helps.

luiscantero commented 9 months ago

@JeremyTheocharis any updates?

JeremyTheocharis commented 9 months ago

I can confirm it solved the issue, however the underlying issue is still there. But let me close this one. Thank you for your help!

luiscantero commented 9 months ago

Thanks for confirming. Could you please open an issue for the OPC UA SDK. Just copy-paste some info from here and post a link to this one. I will make sure that it gets triaged.