Added OpenSSL to make use of ADS Secure Protocols.#289
Open
UserwithnoUsername wants to merge 1 commit intoBeckhoff:masterfrom
Open
Added OpenSSL to make use of ADS Secure Protocols.#289UserwithnoUsername wants to merge 1 commit intoBeckhoff:masterfrom
UserwithnoUsername wants to merge 1 commit intoBeckhoff:masterfrom
Conversation
…connections.sh and a test_connections.cpp to show usage and test usual commands like Read Write. Supported Are Shared CA Certificate PSK SSC Plain is still working Tested on TwinCAT on Linux.
Member
|
Hi @UserwithnoUsername, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reason for the Pull Request
I had several Problems in the Past to acquire huge amounts of data, from different Beckhoff PLCs. For Security Reasons our PLCs and also most of the new PLCs have as default ADS Secure. Currently there is no clean way, to connect to a ADS Secure Route, without Installing TwinCAT on Windows, with an enormous overhead. Not to talk about a ADS Secure Route to Linux. When i found https://github.com/kevinherron/beckhoff-secure-ads/tree/main I thought, I also can Add it to this library. But to be fair the real Primary reason is, that i can switch to Linux at work because i don´t have the need for TwinCAT anymore as a Software Developer. Also i can change the Servers to Linux, which are connecting to the PLCs.
Summary
Adds TLS-secured ADS communication using OpenSSL, enabling connections to TwinCAT PLCs via three secure transport modes alongside the existing plain ADS. A new standalone test binary and interactive shell script are included
to validate all modes end-to-end.
New secure transport modes
SHA-256(UPPER(identity) + password)— no certificates requiredPlain ADS continues to work unchanged.
New files
AdsLib/SecureAdsConfig.hSecureAdsConfigstruct — unified config for all three modesAdsLib/standalone/TlsSocket.{h,cpp}select-based timeout)AdsLib/standalone/TlsConnectInfo.hAdsLib/standalone/SecureAmsConnection.{h,cpp}AmsConnectionBasesubclass that routes traffic throughTlsSockettools/test_connections.cpptools/test_connections.shChanged files
AdsLib/AdsLib.h/standalone/AdsLib.{h,cpp}— newAdsAddSecureRoute/AdsAddSecureRouteByDnsAPI entry pointsAdsLib/AmsRouter.{h,cpp}—AmsRouterdispatches toSecureAmsConnectionwhen aSecureAdsConfigis presentAdsLib/AmsConnection.h—AmsConnectionBaseinterface extended for virtual dispatchmeson.build/AdsLib/CMakeLists.txt— OpenSSL dependency wired up;test_connectionstarget addedHow to test
Run
tools/test_connections.sh. It builds the project automatically and presents an interactive menu to test each connection mode individually or all at once.PLC configuration per mode
SSC (Self-Signed Certificate)
Works out of the box — the script auto-generates a self-signed client certificate if none exists. No static route pre-configuration is required on the PLC; the first connection registers the route using the supplied
credentials.
SCA (Shared CA Certificate)
Requires a shared root CA. The client certificate must be signed by the same CA that the PLC trusts. Exchange the CA and signed certificates between client and PLC before connecting.
Required
StaticRoutesentry on the PLC:PSK (Pre-Shared Key)
No certificates needed. Identity and password must match what is configured on the PLC.
Required StaticRoutes entry on the PLC:
Important constraints
Dependencies
Test plan
Further Considerations
What is considerable, is to change the build, that it is an Optional Feature. So when OpenSSL is available and you want to have Secure ADS in your library that you can choose between the build Type.
Regards Thomas