fix: Fix legacy authentication for all PLCs with legacy firmware. - #849
Draft
bvanelli wants to merge 1 commit into
Draft
fix: Fix legacy authentication for all PLCs with legacy firmware.#849bvanelli wants to merge 1 commit into
bvanelli wants to merge 1 commit into
Conversation
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.
Changes
Legacy authentication was never really supported, and that caused authentication to fail on old hardware. The previous condition to authenticate with legacy was the cryptography package not being available:
The authentication mode is decided by reading the PLC model and firmware version, and using
decide_legitimation_modeto decide which auth to use. TheLegitimationTypealso clearly encodes the 1/2 value into an enum.This uses a capture from the C# driver to implement with a contract test the exact authentication that the legacy PLC expects. The capture was taken with an S7-1512 Series using 2.9.8 firmware.
Testing
Doing a browse and a variable read against a real PLC now works. The legitimation lowers the protection level correct and both the browse and read are successful:
The same code, when running it from master, uses the
_send_legitimation_newwhich gets rejected by the PLC: