Closed brianeray closed 8 months ago
Holding off on merging until
0.2.0-SNAPSHOT
to release 0.2.0
.QAed by both an integration partner using DigiCert KeyLocker and by IA QA with a YubiKey 5 and a genuine, non self-signed cert.
See this IA forum post for instructions on using the new, 0.2.0
version of the plugin.
Oddly enough we had a GitHub workflow that is still publishing to the Gradle Plugin Portal. 0.2.0
is up there now.
๐ Background
The
signModule
custom task in thegradle-module-plugin
(a.k.a.io.ia.sdk.modl
) supports PKCS#12 file-based Java keystores for signing modules. Certain software supply chain best practices recommend using PKCS#11-based hardware security modules (HSMs) for more secure keystore implementations. The private keys never leave the HSM, and the HSM itself signs the module digests.โ๏ธ Summary
Enhance the
signModule
task to allow for signing via HSM and other PKCS#11-compliant keystores. (Which need not be hardware tokens like YubiKeys, but may be cloud-based or other keystores implemented in software that are typically not local to the build machine.)More specifically, add this capability via new property/option
pkcs11CfgFile
.๐ Reviewer Notes
Use the Hide whitespace setting on the Files changed tab to eliminate a bunch of the delinting noise.
Because we call down to
module-signer
to do the actual signing, and because its filter is narrowed to keys of typeSHA256withRSA
, the key in the keystore must be that type. (This constraint predates the current enhancement.) At some point we'll likely enhancemodule-signer
to support more key algorithms such as Elliptic Curve and whatever post-quantum algorithms ultimately pass muster with NIST and related entities.On initial PR submission the version is
0.2.0-SNAPSHOT
. After the PR is approved and any other validation--preferably some some testing by IA and partner developers--the PR will emerge from Draft status andthe version will bump to0.2.0
. We may have to hand-crank publication to the Gradle Plugin repository as I'm not sure whether therelease.yml
workflow is working.๐งช QA Notes
This was integration tested against a YubiKey 5 NFC with the wrinkle that the slot
9a
authorization key was used, not the9c
signing key. There are notes inSignModuleTest
as to why this workaround is necessary. (At some point we might be able to sign with the "correct" YK5 slot but it appears to require some tricky callback code.)Fixes IGN-7871 (inductiveautomation/ignition-module-tools/issues/41)