Repository navigation
feat(opcua-server): upgrade Eclipse Milo from 0.6.16 to 1.1.8 - #783
Open
LivingLikeKrillin wants to merge 1 commit into
Open
LivingLikeKrillin wants to merge 1 commit into
LivingLikeKrillin wants to merge 1 commit into
Conversation
The opcua-server tool (plc4j/tools/opcua-server) moves from Eclipse Milo 0.6.16 to 1.1.8. Milo has published no 0.6.x release since 0.6.16; its releases since then are on the 1.x line. Milo 1.x reorganised the server SDK, certificate handling and transport bootstrap, so this is a port, not a version bump. - pom.xml: the five 0.6.16 artifacts (dictionary-manager, sdk-server, stack-server, stack-core, sdk-core) are replaced by milo-sdk-server and milo-transport 1.1.8; milo-sdk-core and milo-stack-core are transitive. - OPCUAServer: bootstrap rewritten for 1.x (FileBasedTrustListManager, FileBasedCertificateQuarantine, KeyStoreCertificateStore, RsaSha256CertificateFactory, DefaultApplicationGroup, DefaultServerCertificateValidator, DefaultCertificateManager) and bound through OpcTcpServerTransport. EndpointConfiguration becomes EndpointConfig. UsernameIdentityValidator constructor now takes only the username/password check. - Existing security directories keep working: the trust list keeps the 0.6 layout (pki/issuers instead of the pki/issuer default of FileBasedTrustListManager; rejected certificates directly in pki/rejected instead of the pki/rejected/certs used by Milo's example server), and the server certificate is taken from the keystore entry that is loaded (the first alias of an existing keystore, as in 0.6, or plc4x-certificate-alias for a new one), so Milo 1.x does not write a second server-rsa-sha256 entry into the keystore. - Plc4xNamespace and Plc4xCommunication: Identifiers becomes NodeIds; DataItem, MonitoredItem and ManagedNamespaceWithLifecycle move to their 1.x packages; Plc4xCommunication.getValue takes an AttributeFilterContext; the DataTypeDictionaryManager is removed (no types were registered with it), so its empty dictionary node is no longer published. - Behaviour change: anonymous access becomes opt-in (in 0.6 anonymous clients were granted read and write access to every configured tag). Milo 1.x dropped the anonymous flag from UsernameIdentityValidator, requiring a separate AnonymousIdentityValidator. allowAnonymousAccess (default false) adds it and the anonymous token policy together; otherwise the server offers username and X.509 tokens only. config.yml lists the key; a new ConfigurationTest checks the default and turning it on. - Milo's predefined username and X.509 user token policies now name Basic256Sha256 instead of Basic256. Closes apache#700 Signed-off-by: Jooyoung Jung <livinglikekrillin@gmail.com>
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.
Closes #700.
What
plc4j/tools/opcua-serverfrom Eclipse Milo 0.6.16 to 1.1.8. Milo has published no 0.6.x release since 0.6.16; its releases since then are on the 1.x line.OPCUAServerfollows the pattern of the example server that ships with Milo.pom.xml: the five 0.6.16 Milo artifacts are replaced bymilo-sdk-serverandmilo-transport1.1.8. 7 files change, one of them a new test.Compatibility
pki/issuers/{certs,crl}rather than thepki/issuer/{certs,crl}default of Milo 1.xFileBasedTrustListManager; rejected certificates stay directly inpki/rejected(the example server that ships with Milo usespki/rejected/certs).plc4x-certificate-aliasfor a newly generated one. Left to itself, Milo 1.x'sKeyStoreCertificateStorelooks for an entry namedserver-rsa-sha256, andDefaultApplicationGroupwrites a second entry into the keystore when it does not find one.Behaviour changes
UserAccessLevelREAD_WRITE, so anonymous clients were granted read and write access to every configured tag.UsernameIdentityValidator; anonymous access now needs a separateAnonymousIdentityValidator. A new YAML keyallowAnonymousAccess(defaultfalse) adds that validator and the anonymous user token policy together; without it, clients authenticate with username/password or an X.509 user token.allowAnonymousAccess: trueto the server configuration.X509IdentityValidator(c -> true)); this change adds no user-certificate trust or authorization checks.Basic256Sha256instead ofBasic256, because Milo's predefinedUSER_TOKEN_POLICY_USERNAME/USER_TOKEN_POLICY_X509changed between 0.6.16 and 1.1.8.DataTypeDictionaryManageris removed. No types were registered with it, but the (empty) data type dictionary node it published underOPCBinarySchema_TypeSystemis no longer there.Validation
Setup: Java 21, the repository Maven wrapper, a config with one
simulated://device (aRANDOMINT tag and aSTATEINT tag), and the PLC4X 1.0.0opcuadriver as the client, run from temporary local test classes that are not part of this PR../mvnw -Pwith-java -pl :plc4x-opcua-server -am verifysucceeds: 8 tests, 4 passed (including the newConfigurationTest), 4 skipped by the class-level@DisabledonOpcuaPlcDriverTest.developserver (Milo 0.6.16), added an issuer certificate topki/issuers/certsand a client certificate topki/trusted/certs, and started this branch on it. The keystore file stayed byte-for-byte unchanged, both certificates were loaded into the trust list, aBasic256Sha256/SignAndEncryptread with that client succeeded,pki/rejectedstayed empty and nopki/issuerwas created. With the keystore replaced by one whose only alias ismy-own-cert, the alias and the file stayed unchanged and a secure read succeeded. CRLs were not covered.plc4x-certificate-alias; a restart leaves it byte-for-byte unchanged and a secure read succeeds. An untrusted client certificate is refused (the server answersBad_SecurityChecksFailed) and written directly topki/rejected.allowAnonymousAccessnot set in the test configuration, the driver found noNoneendpoint offering anonymous login. WithallowAnonymousAccess: true, anonymous read and write requests returned OK over bothNoneandBasic256Sha256/SignAndEncrypt, and username login still worked.None: read OK.Basic256Sha256/SignAndEncryptwith a trusted client certificate and the server certificate pinned: read OK, write 1234 to theSTATEtag and read back 1234.Not in this PR
website/asciidoc/modules/users/pages/tools/opcua-server.adoc) and does not mentionallowAnonymousAccessyet; I will follow up there once this is merged.OpcuaPlcDriverTeststays@Disabled(its existing reason is OutOfMemoryErrors, which I did not investigate); its tests connect anonymously, so they need updating when re-enabled. The runtime checks above are not committed; I can add integration tests in a follow-up if wanted.DefaultTrustListManager; I left it unchanged.