admin管理员组

文章数量:1291202

I am connecting to a Kepware OPCUA server using node-opcua. I will have more than one app that is connected to the server so I want to name the client certs. Here is the configuration I currently have where I am trying to give the cert a name but every time I connect the client name is "NodeOPCUA-Client". How do I name this cert so I can tell which one is trying to connect to my server?

const clientOptions = {
    applicationName: "WBFNodeOPCUA-Client",
    endpointMustExist: true,
    securityMode: MessageSecurityMode.SignAndEncrypt,
    securityPolicy: SecurityPolicy.Basic256Sha256,
    connectionStrategy: {
        maxRetry: 5,
        initialDelay: 1000,
        maxDelay: 10000
    },
    certificateManager: new OPCUACertificateManager({
        automaticallyAcceptUnknownCertificate: true,
        rootFolder: pkiDir,
        keySize: 2048,
    }),
};

let client = OPCUAClient.create(clientOptions);

I am connecting to a Kepware OPCUA server using node-opcua. I will have more than one app that is connected to the server so I want to name the client certs. Here is the configuration I currently have where I am trying to give the cert a name but every time I connect the client name is "NodeOPCUA-Client". How do I name this cert so I can tell which one is trying to connect to my server?

const clientOptions = {
    applicationName: "WBFNodeOPCUA-Client",
    endpointMustExist: true,
    securityMode: MessageSecurityMode.SignAndEncrypt,
    securityPolicy: SecurityPolicy.Basic256Sha256,
    connectionStrategy: {
        maxRetry: 5,
        initialDelay: 1000,
        maxDelay: 10000
    },
    certificateManager: new OPCUACertificateManager({
        automaticallyAcceptUnknownCertificate: true,
        rootFolder: pkiDir,
        keySize: 2048,
    }),
};

let client = OPCUAClient.create(clientOptions);
Share Improve this question asked Feb 13 at 18:38 Avi4nFLuAvi4nFLu 3462 silver badges15 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

I figured it out thanks to this post.

"Turns out that node-opcua does create some kind of certificate that is used for the server even if the server does not use tls. And after I run my software for the first time that certificate was created with the current hostname of my computer. Not long ago I did change my hostname so this certificate was not valid anymore.

The location of those files is C:\Users\user\AppData\Roaming\node-opcua-default-nodejs.

Deleting the whole folder will prompt node-opcua to recreate them with all certificates at software start and after that the error message was gone."

I deleted this file and the next time I ran it created the certs where it was defined in my server file.

本文标签: opc uaHow do I set the client name when connecting to a OPCUA Kepware server using nodeopcuaStack Overflow