To meet DCOM hardening requirements Authentication Level must be set to Packet Integrity for all servers/client participating in DCOM communication.
This applies where Microsoft DCOM Hardening Patch described in article KB5004442 (CVE-2021-26414)
Exactly what updates KB5004442 applies to depends on Windows version and might be hidden in Servicing stack updates. In practice all installed updates after June 8, 2021.
On March 14, 2023, where updates after June 8, 2021, are installed. Hardening changes are enabled by default with no ability to disable them. By this point, you must resolve any compatibility issues with the hardening changes and applications in your environment.
What to do, depending on environment
First, identify all OPC Classic (DA, HDA, AE) servers and clients in your system.
On recently updated systems with In DCOM Config, clarify whether active Authentication Level Is set to Packet Integrity, on both server and client side. Try to follow procedure described in Recommended DCOM settings section of thit article.
When adjusting DCOM configuration note that it might affect other applications depending on DCOM, like some SQL connections.
Possible solutions:
1. No updates - Unhardened server and client computers (no updates after June 8, 2021)
No action needed until updates are installed.
2. Hardened client computer - Updated OPC Classic Client computer (Client computer updated after June 8, 2021)
See Recommended DCOM settings below
3. Hardened Server & Client Computer (Client and Server computer updated after June 8, 2021)
4. Impossible to harden server Computer, Client Computer is hardened. Use OPC UA as gateway
In general, attempt to use Default settings for all COM Server application like ApisHive instances, ApisHoneystore and ApisOPCHDA. That makes life easier in many ways. The disadvantage is that server computer restart is mandatory when Default settings are changed to make new settings take place.
Start dcomcnfg snapin
It seems that clients where Authentication level is raced are allowed connection to servers where Authentication level is NOT raced. (Recent Windows update)
Restart of server when Default properties are changed is essential.
Inspect log in AMS or logfiles directly , you might find messages like this
2023-01-03 13:49:54,238.923| 6716|ERROR|ApisHive.m.OPC|ApisOPC.cpp:774|$RPT$ CreateOPCServer: Failed to create OPC server, Prediktor.ApisOPCServer.1, on 10.100.86.224. Error return: Access is denied. (0x80070005). CLSID: {8E423571-A67B-11D2-9418-00608CF4C421}. Duration: 4.9951 ms.
This is classical security issue, typically unknown user/password, or user lacking access.
If experiencing classic OPC connection issue the Windows System and Security logs are essential to figure out the source of the issue. Check the system log on server side for messages related to DCOM hardening. To assure DCOM error logging is active, follow these steps:
Inspecting the event logs might be like searching for the needle in the haystack if you don’t add a filter:
Filter the log Event sources == DistributedCOM
On server where Authentication level is raced to Packet Integrity and client is trying to connect with Authentication level less than Packet Integrity this message will appear in Windows System log on the server side:
The server-side authentication level policy does not allow the user W2019-201\testuser SID (S-1-5-21-3388131059-2642654006-1006207564-1000) from address 10.100.86.212 to activate DCOM server. Please raise the activation authentication level at least to RPC_C_AUTHN_LEVEL_PKT_INTEGRITY in client application.
Solution is to race Authentication to Packet Integrity both application and default on client side and restart computer.
NOTE! restart is required to activate the default setting.
The security log is helpful to identify access permission issues. Like unknown users or missing user access.
Filter the security log Keyword = Audit Failure
To help you identify the applications that might have compatibility issues after we enable DCOM security hardening changes, we added new DCOM error events in the System log; see the tables below. The system will log these events if it detects that a DCOM client application is trying to activate a DCOM server using an authentication level that is less than RPC_C_AUTHN_LEVEL_PKT_INTEGRITY. You can trace to the client device from the server-side event log and use client-side event logs to find the application.
Event ID |
Message |
10036 |
"The server-side authentication level policy does not allow the user %1\%2 SID (%3) from address %4 to activate DCOM server. Please raise the activation authentication level at least to RPC_C_AUTHN_LEVEL_PKT_INTEGRITY in client application." (%1 – domain, %2 – user name, %3 – User SID, %4 – Client IP Address) |
Event ID |
Message |
10037 |
"Application %1 with PID %2 is requesting to activate CLSID %3 on computer %4 with explicitly set authentication level at %5. The lowest activation authentication level required by DCOM is 5(RPC_C_AUTHN_LEVEL_PKT_INTEGRITY). To raise the activation authentication level, please contact the application vendor." |
10038 |
"Application %1 with PID %2 is requesting to activate CLSID %3 on computer %4 with default activation authentication level at %5. The lowest activation authentication level required by DCOM is 5(RPC_C_AUTHN_LEVEL_PKT_INTEGRITY). To raise the activation authentication level, please contact the application vendor." (%1 – Application Path, %2 – Application PID, %3 – CLSID of the COM class the application is requesting to activate, %4 – Computer Name, %5 – Value of Authentication Level) |
Update Release |
Behavior Change |
June 8, 2021 |
Hardening changes disabled by default but with the ability to enable them using a registry key. |
June 14, 2022 |
Hardening changes enabled by default but with the ability to disable them using a registry key. |
November 8, 2022 |
This update will automatically raise the requisite authentication level for all non-anonymous activation requests from DCOM clients to RPC_C_AUTHN_LEVEL_PKT_INTEGRITY if it is below Packet Integrity. With this change, most Windows DCOM client applications will automatically work with DCOM hardening changes on the server side without any modification to the DCOM client applications. |
March 14, 2023 |
Hardening changes enabled by default with no ability to disable them. By this point, you will need to have resolved any compatibility issues with the hardening changes and applications in your environment. |
Before starting any configuration, we must check Windows Firewall settings on all of the computers participating in the communication.
Following programs and ports must be open:
Do this from the firewall control panel configuration tool, or the most efficient way, from script
netsh advfirewall firewall add rule name="OPC DCOM (RPC)" protocol=TCP dir=in localport=135 action=allow profile=any
netsh advfirewall firewall add rule name="OPC DCOM (RPC)" protocol=TCP dir=out localport=135 action=allow profile=any
In this case ApisHive:
netsh advfirewall firewall add rule name="AllowApis" dir=in program="C:\apis\bin64\apishivex64.exe" action=allow
netsh advfirewall firewall add rule name="AllowApis" dir=out program="C:\apis\bin64\apishivex64.exe" action=allow
netsh advfirewall firewall add rule name= "Allow OpcEnum" dir=in
program="C:\Windows\SysWOW64\opcenum.exe" action=allow
netsh advfirewall firewall add rule name= "Allow OpcEnum" dir=out
program="C:\Windows\SysWOW64\opcenum.exe" action=allow
If possible, turn off UAC on all computers participating in the communication.
This saves us for painful popups, and it is more likely that programs and configurations installs correctly.
The most efficient way to do this is to run following command on W7/Vista/2008 computer:
reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f
NOTE! Reboot is required
This can be a bit confusing and over-complex from time to time and can cause a major trouble during commissioning.
There is no universal recipe, ALL cases are different, so basic knowledge to how the security model works is essential, along with thorough overview of user accounts, computers and client/servers participating in the communication, general assumptions of any of this parameter will lead to failure. Spend some time before starting any configuration to identify all OPC clients and servers with belonging User Accounts.
When all parameters are known, the (D)COM principals we are dealing with are basically simple:
User Access is the key!
OPC DA clients can principally operate in two main read modes:
The basic mechanism is comparable to a postal worker, carrying goods from a storage room in one building, to a storage room in another building. Each building has two locked doors: the main entrance door; and an internal door to the storage room. The postal worker must be known and have access to the two doors.
Example Term |
Computer Term |
Postal worker |
A user account |
The storage room |
An OPC server |
The buildings |
Two computers |
The mail |
Data |
The postal worker leaves the client building, enters the main door in the server building, then the storage room. He gets the goods he wants and returns home to the client building with his goods.
In this case, the postal worker from the client building must be well known and have access to the two doors in the server building.
The postal worker leaves the client building, enters the main door in the server building, then enters the storage room, but now he asks the caretaker:
“When you have any new goods I’m interested in; can you bring it to me at the storage room in the client building?”
“No problem!” the caretaker says, then the postal worker leaves home without any data.
Now, when new goods are produced in the server building and placed in storage, the caretaker collects them immediately and leaves to deliver them to the storage room in the client building. The caretaker from the server building has to enter the two doors in the client building to deliver the goods.
As in the polling case, the postal worker from client building must be well known and have access to the two doors in the server building to deliver his wishes. Then the caretaker from server building must be well known and have access to the two doors in the client building to deliver the goods.
To enable both computers to properly recognize User Accounts, it is necessary to ensure that User Accounts are recognized on both the OPC Client and Server computers. This includes all the User Accounts that will require OPC access. The account running the local client, might be different from the account running the remote OPC server.
In other words, we must have knowledge to all User Accounts for the various processes which are participating in the communication.
As mentioned OPC clients can operate in two read modes: Polling and Subscribe
Issue:
Polling:
Subscribing:
User(s) participating in communication must exists on both server and client.
Users must have appropriate rights to server and client.
Recommendations:
NOTE:
Assumptions used in this document (as mentioned all cases are different this is just an example):
Application |
User |
Password |
OPC server (ApisHive) |
OPCServerUser |
<some password> |
OPC client (ApisHive) |
Local System |
<some password> |
Find out what User account(s) are running, the OPC server, the OPC client and finally the local configuration tool. This overview is essential and the key for further configuration and cannot be repeated too often.
To be able to browse available OPC servers OpcEnum must be installed on the server computer.
Usually this is performed by the OPC server installer.
However, this should be part of the configuration checklist.
If Opcenum is not running as service, locate it and register it:
Installing client, server and creating all necessary users is not part of this description, when that is performed, it is time to set up user security in Component Services console (dcomcnfg)
Classic OPC depend on Microsoft’s DCOM for the data transportation. Consequently, you must configure DCOM settings properly. The system-wide changes affect all Windows applications that use DCOM, including OPC application. In addition, since some OPC Client applications do not have their own DCOM settings, they are affected by changes to the default DCOM configuration.
Allow OPC client to access OPC server host, check settings on remote computer.
Use Component Services to set the limits (the main entrance door) and default access configuration see troubleshooting section.
When system wide access is granted (access to the entrance main door) it’s time to assure access to the specific OPC server (the storage room).
On remote OPC server computer, start Component Services and browse to My Computer see example in troubleshooting section, assure user running the local client has access.
When experiencing disruption in communication, first of all, check the Windows event log for any messages related to your problem, if any messages containing:
Message contains |
Symptom |
Access is denied. (0x80070005) |
Can indicate DCOM security misconfiguration |
The RPC server is unavailable. (0x800706BA) |
Can indicate Windows firewall security misconfiguration |
The remote procedure call failed. (0x800706BE) |
When configuration of security setting of remote computer is incomplete, the OPC server list will be empty when browsing for OPC servers on remote computer and you might get error message(s) in the event log.
Message like this in the event log indicates that the problem likely is DCOM security related more than firewall. Remote server says “Access denied”
Failed to create OPC Server Lister object on 10.100.86.125.
As a result, OPC servers might not be available from the list of servers to choose from. Make sure OPCENUM.EXE is properly registered and configured on the server machine, consider both DCOM security and open the Firewall for OPCENUM.exe.
Or, you can enter the CLSID of your OPC server directly into the server property.
Error return: Access is denied. (0x80070005)
Let’s assume in this case, the local client is running on “System account” meaning that Anonymous logon must have access right to remote computer and the OpcEnum process on the remote computer.
Check computer wide limits for Anonymous logon on remote computer as well as access rights on the OpcEnum process.
On OPC server computer, start Component Services and browse to My Computer right click and Properties, select COM Security tab in Access Permissions section press Edit Limits, assure that Anonymous logon has Remote Access. If ANONYMOUS LOGIN does not exist in the list, it must be added.
Repeat for Launch and activation permissions.
Still in Component Services browse to OpcEnum right click and Properties, select Security tab, press Edit button in Access permissions section, an assure Anonymous login has Remote access. If ANONYMOUS LOGIN does not exist in the list, it must be added.
Repeat for Launch and activation permissions.
If you changed any of the settings, the OpcEnum service must be restarted for the changes to take effect
Failed to create OPC Server Lister object on 10.100.86.125.
As a result, OPC servers might not be available from the list of servers to choose from. Make sure OPCENUM.EXE is properly registered and configured on the server machine, consider both DCOM security and open the Firewall for OPCENUM.exe.
Or, you can enter the CLSID of your OPC server directly into the server property.
Error return: The RPC server is unavailable. (0x800706BA)
This message indicates that the problem likely is firewall or network related. There is no answer from remote server.
The firewall must be opened for the OpcEnum process.
Two alternatives to configure; script or firewall control panel.
From elevated command prompt run the following commands:
netsh advfirewall firewall add rule name="Allow OpcEnum" dir=in program="C:\Windows\SysWOW64\opcenum.exe" action=allow
netsh advfirewall firewall add rule name="Allow OpcEnum" dir=out program="C:\Windows\SysWOW64\opcenum.exe" action=allow
Beware of the OpcEnum installation path
On OPC server computer start Control panel-> Windows firewall->Advanced settings->New Rule select Program and press Next enter the program path to the OpcEnum executable like “C:\Windows\SysWOW64\OpcEnum.exe” press Next
Select Allow the connection Next
Apply to all networks Next
Give the rule a proper name like “Allow OpcEnum” and Finish
The Window firewall will now allow connections to the OpcEnum process.
When configuration of security setting of remote computer is incomplete, you are not able to connect to the remote OPC server, thus item browsing is unavailable and you might get error message(s) in the event log.
ALARM from OPC
»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
Failed to create OPC server, Prediktor.ApisOPCServer.1, on 10.100.86.125.
Error return: Access is denied. (0x80070005).
This message indicates that the problem is DCOM security related. Remote server says “Access denied”
Let’s assume in this case, the local client is running on “System account” meaning that Anonymous logon must have access right to remote computer and the Prediktor.ApisOPCServer.1 process on remote the computer
Check computer wide limits for Anonymous logon on remote computer as well as access rights on Prediktor.ApisOPCServer.1
See how to set Computer wide limits in previous section
Still in Component Services, in this case browse to ApisHive (OPC server) right click and Properties, select Security tab.
In this case the OPC server (ApisHive) is using default properties, we have two chooses:
In this example we choose to keep default, now close the ApisHive Properties dialog, browse to My Computer right click and Properties, select COM Security tab in Access Permissions section and now press Edit default, assure that Anonymous logon has Remote Access.
Repeat for Launch and activation permissions, assure Anonymous user has Remote Launch and activation permissions.
If you changed any of the settings, the OPC server (ApisHive) service must be restarted for the changes to take effect.
ALARM from OPC
»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
Failed to create OPC server, Prediktor.ApisOPCServer.1, on 10.100.86.125.
Error return: The RPC server is unavailable. (0x800706BA).
Like in the OPC enum case, this message indicates that the problem likely is firewall related. There is no answer from remote server.
The firewall must be opened for ApisHive process. Follow the procedure in Firewall configuration of OPC enum but in this case open for ApisHive ("<install dir>\Bin64\ApisHivex64.exe")
ALARM from OPC/opcda://10.100.86.125/Prediktor.ApisOPCServer.1 [Primary]
»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
Failed calling IOPCDataCallback::Advise - IOPCDataCallback! Error return: The RPC server is unavailable. (0x800706BA).
This message indicates that the problem likely is firewall related. There is no answer from remote server, the server tries to write back to client but hits the firewall.
The firewall on the local client computer must be opened for ApisHive process. Follow the procedure in Firewall configuration of OPC enum but in this case open for ApisHive ("<install dir>\Bin64\ApisHivex64.exe").
OPC server callback access rights
ALARM from OPC/opcda://10.100.86.125/Prediktor.ApisOPCServer.1 [Primary]
»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
Failed calling IOPCDataCallback::Advise - IOPCDataCallback! Error return: Access is denied. (0x80070005).
This message indicates that the problem is DCOM security callback related. Remote server tries to write back to client but gets “Access denied”
In this case server is running on “OPCServerUser” account meaning that when trying to write back to the client it must have access right to local computer and the process running the client as well (Prediktor.ApisOPCServer.1).
On local computer:
Assure OPCServerUser exist with same password as the corresponding user on remote server.
Assure OPCServerUser has computer wide limits remote access rights
Assure OPCServerUser has remote access rights to client process, in this case ApisHive, trough default access permissions.
If you changed any of the computer wide settings, the OPC server (ApisHive) service must be restarted for the changes to take effect.
Start Component Services system configuration and browse to My Computer, right click, select Properties and select COM Security tab in Access Permissions section: Press Edit Limits button and assure that that the specific user has Local and Remote Access.
Repeat for Launch and activation permissions.