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

Server certificate validation fails in latest Publisher #416

Closed
vslepakov opened this issue May 4, 2020 · 1 comment
Closed

Server certificate validation fails in latest Publisher #416

vslepakov opened this issue May 4, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@vslepakov
Copy link
Member

Describe the bug
Latest publisher version always reports OPC-UA server cert as invalid.
Exactly the same configuration (certs and createOptions) works just fine with Publisher 2.5.3

To Reproduce
Steps to reproduce the behavior:

  1. Use Publisher with latest tag
  2. use these createOptions:
    "{"Hostname":"publisher","Cmd":["--pf=/appdata/pn.json","--di=10","--si=10","--tp=/appdata/pki/trusted","--rp=/appdata/pki/rejected","--ap=/appdata/pki/own","--ip=/appdata/pki/issuer","--lf=/appdata/publisher.log"],"HostConfig":{"Binds":["/home/<path>:/appdata"]}}"
  3. Put server certificate under /appdata/pki/trusted/certs
  4. see following error in the log:
Opc.Ua.ServiceResultException: Certificate is not trusted.
SubjectName: DC=opcua-srv.i2uvk10rqycefadk3kvhbmhdgc.ax.internal.cloudapp.net, O=Prosys OPC, CN=SimulationServer@opcua-srv
IssuerName: DC=opcua-srv.i2uvk10rqycefadk3kvhbmhdgc.ax.internal.cloudapp.net, O=Prosys OPC, CN=SimulationServer@opcua-srv
 ---> Opc.Ua.ServiceResultException: Certificate is not trusted.
SubjectName: DC=opcua-srv.i2uvk10rqycefadk3kvhbmhdgc.ax.internal.cloudapp.net, O=Prosys OPC, CN=SimulationServer@opcua-srv
IssuerName: DC=opcua-srv.i2uvk10rqycefadk3kvhbmhdgc.ax.internal.cloudapp.net, O=Prosys OPC, CN=SimulationServer@opcua-srv
   at Opc.Ua.CertificateValidator.InternalValidate(X509Certificate2Collection certificates)
   at Opc.Ua.CertificateValidator.Validate(X509Certificate2Collection chain)
   --- End of inner exception stack trace ---
   at Opc.Ua.CertificateValidator.Validate(X509Certificate2Collection chain)
   at Opc.Ua.Client.Session.Open(String sessionName, UInt32 sessionTimeout, IUserIdentity identity, IList`1 preferredLocales, Boolean checkDomain)
   at Opc.Ua.Client.Session.Create(ApplicationConfiguration configuration, ConfiguredEndpoint endpoint, Boolean updateBeforeConnect, Boolean checkDomain, String sessionName, UInt32 sessionTimeout, IUserIdentity identity, IList`1 preferredLocales)
   at Opc.Ua.Client.Session.Create(ApplicationConfiguration configuration, ConfiguredEndpoint endpoint, Boolean updateBeforeConnect, String sessionName, UInt32 sessionTimeout, IUserIdentity identity, IList`1 preferredLocales)
   at Microsoft.Azure.IIoT.OpcUa.Protocol.Services.DefaultSessionManager.GetOrCreateSessionAsync(ConnectionModel connection, Boolean createIfNotExists) in D:\a\1\s\components\opc-ua\src\Microsoft.Azure.IIoT.OpcUa.Protocol\src\Services\DefaultSessionManager.cs:line 70
   at Microsoft.Azure.IIoT.OpcUa.Protocol.Services.SubscriptionServices.SubscriptionWrapper.GetSubscriptionAsync(SubscriptionConfigurationModel configuration) in D:\a\1\s\components\opc-ua\src\Microsoft.Azure.IIoT.OpcUa.Protocol\src\Services\SubscriptionServices.cs:line 415
   at Microsoft.Azure.IIoT.OpcUa.Protocol.Services.SubscriptionServices.SubscriptionWrapper.ApplyAsync(IEnumerable`1 monitoredItems, SubscriptionConfigurationModel configuration) in D:\a\1\s\components\opc-ua\src\Microsoft.Azure.IIoT.OpcUa.Protocol\src\Services\SubscriptionServices.cs:line 162
   at Microsoft.Azure.IIoT.OpcUa.Protocol.Services.SubscriptionServices.SubscriptionWrapper.ApplyAsync(IEnumerable`1 monitoredItems, SubscriptionConfigurationModel configuration) in D:\a\1\s\components\opc-ua\src\Microsoft.Azure.IIoT.OpcUa.Protocol\src\Services\SubscriptionServices.cs:line 176
   at Microsoft.Azure.IIoT.OpcUa.Edge.Publisher.Engine.WriterGroupMessageTrigger.DataSetWriterSubscription.OpenAsync(CancellationToken ct) in D:\a\1\s\components\opc-ua\src\Microsoft.Azure.IIoT.OpcUa.Edge.Publisher\src\Engine\WriterGroupMessageSource.cs:line 127
   at Microsoft.Azure.IIoT.OpcUa.Edge.Publisher.Engine.WriterGroupMessageTrigger.RunAsync(CancellationToken ct) in D:\a\1\s\components\opc-ua\src\Microsoft.Azure.IIoT.OpcUa.Edge.Publisher\src\Engine\WriterGroupMessageSource.cs:line 63
   at Microsoft.Azure.IIoT.OpcUa.Edge.Publisher.Engine.DataFlowProcessingEngine.RunAsync(ProcessMode processMode, CancellationToken cancellationToken) in D:\a\1\s\components\opc-ua\src\Microsoft.Azure.IIoT.OpcUa.Edge.Publisher\src\Engine\DataFlowProcessingEngine.cs:line 105
   at Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker.JobProcess.ProcessAsync() in D:\a\1\s\common\src\Microsoft.Azure.IIoT.Agent.Framework\src\Agent\Default\Worker.cs:line 320
[18:09:45 INF] Worker: StandalonePublisher_0, Job: LegacyPublisher_vislepak-edge_publisher processing completed ...  (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[18:09:45 INF] Worker: StandalonePublisher_0, start processing new job: LegacyPublisher_vislepak-edge_publisher, mode: Active (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[18:09:45 INF]
   DIAGNOSTICS INFORMATION
   =======================
   # Messages invoked by the message trigger: 0
   # Messages Sent to IoT Hub: 0
   # Number of connection retries since last error: 0
   # EncodingBlock input/output count: 0/0
   # BatchBlock output count: 0
   # SinkBlock input count: 0
   =======================
 (Microsoft.Azure.IIoT.OpcUa.Edge.Publisher.Engine.DataFlowProcessingEngine)
[18:09:51 INF] Trying to create session 95922ac072ce7db850c4c8da9679c273db54dfb6... (Microsoft.Azure.IIoT.OpcUa.Protocol.Services.DefaultSessionManager)
[18:09:51 INF] 95922ac072ce7db850c4c8da9679c273db54dfb6 took 00:00:00.0357363. (Microsoft.Azure.IIoT.OpcUa.Protocol.Services.DefaultSessionManager)

Expected behavior
Certificate is trusted, session can be created exactly as 2.5.3 which works without any changes to the setup .

@cristipogacean cristipogacean added the bug Something isn't working label May 4, 2020
@cristipogacean cristipogacean self-assigned this May 4, 2020
@marcschier marcschier added this to the 2.7 milestone May 4, 2020
@cristipogacean
Copy link
Contributor

fixed in #423

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants