Custom variables in serverConfig.xml file

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
aparna22
Full Member
Full Member
Posts: 9
Joined: 03 Feb 2022, 17:38

Custom variables in serverConfig.xml file

Post by aparna22 »

In self signed certificate endpoint settings we have a place holder [NodeName] to get the host name. Now we have a requirement to generate self signed certificate based on the device IP address of the device which has opcua server installed in it. Any place holder is available to get the IP address of the device name like hostname( for hostname place holder is [NodeName]) or can we use any custom variables in serverConfig.xml file.?

In below Endpoint example:
<CertificateSettings>
<CommonName>[ServerName]</CommonName>
<DomainComponent>[NodeName]</DomainComponent>
<Organization>Organization</Organization>
<OrganizationUnit>Unit</OrganizationUnit>
<Locality>LocationName</Locality>
<State></State>
<Country>DE</Country>
<YearsValidFor>5</YearsValidFor>
<KeyLength>2048</KeyLength>
<CertificateType>RsaSha256</CertificateType>
<IPAddress>2a00:1158:400:407:0:0:0:1b2</IPAddress>
<IPAddress>213.95.4.190</IPAddress> ---------------> Is it possible to update IP address once we receive the value from configuration (some other application)
<DNSName>demo.unifiedautomation.com</DNSName>
<DNSName>[NodeName]</DNSName>
</CertificateSettings>

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Custom variables in serverConfig.xml file

Post by Support Team »

Hi,

unfortunately no custom variables in config.xml.

1) there is no option to create you "own" placeholders in the config.xml
2) there is no placeholder for ip-adress, because a device can have multiple NIC and multiple IPs per each NIC, which one to use?
3) there are only 2 options: i) place holder [NodeName], will bind to "all", ii) or second option specify a distict IP (either IP4 or IP6)

If you go for the 3) option, you must consider to "re-create" your self-signed certificate (private and public key).
Example: your own self written config tool for your server would "obtain" the IP from the system, user can select the one IP he wants to use, your tool writes it to the config.xml, you delete the "own" certificate of the server, and you force restart the server, to make server create new cert and explicitely bind to exactly this IP as given in the config.xml.
Best regards
Unified Automation Support Team

aparna22
Full Member
Full Member
Posts: 9
Joined: 03 Feb 2022, 17:38

Re: Custom variables in serverConfig.xml file

Post by aparna22 »

Hi,

Thanks You for your reply.

I have a little confusion on below point.

"your tool writes it to the config.xml" -> can you please elaborate this point. How to update the config.xml once we receive the IP address from the tool.

Appreciate for the help.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Custom variables in serverConfig.xml file

Post by Support Team »

Hi,

you could write your own tool to modify the config.xml (e.g. integrate into your engineering tool). However, the parsing code in the SDK will only parse and assign the parameters known to the SDK, hence you can not add additional parameters, you must use what is already there.

1) the server can startup and bind to "all" NIC in you system (use the [hostname] placeholder in config.xml), OR the server can bind to "one" distict IP (use a distinct ip4 or ip6 address).
2) you can modify the config.xml (e.g. with your engineering tool) and thereafter force restart of the server process
3) you should consider re-creating the certificate, because hostname and IP is used within content of x509.
Best regards
Unified Automation Support Team

Post Reply