feat(package): sing windows binaries [NR-489681]#1938
Conversation
048c73f to
e84c8fb
Compare
DavSanchez
left a comment
There was a problem hiding this comment.
Looking good! A few doubts
e84c8fb to
4b3d13a
Compare
gsanchezgavier
left a comment
There was a problem hiding this comment.
LGTM, wonder if makes sense to have some sort of test (outside this task) that validates that we are releasing signed binaries , i think we are covering with linux due to the gpg check when installing from package managers
| PFX_CERTIFICATE_BASE64: ${{ secrets.OHAI_PFX_CERTIFICATE_BASE64 }} # base64 encoded | ||
| PFX_PASSPHRASE: ${{ secrets.OHAI_PFX_PASSPHRASE }} |
There was a problem hiding this comment.
would make sense to pass this as secrets , using them only in the pre-release wf to make more difficult to sign testing assets? i think same for the GPG
There was a problem hiding this comment.
It makes total sense!
There was a problem hiding this comment.
i pasted somehting complealty unrelated in the link 😆 , just updated it
There was a problem hiding this comment.
I got the point anyway, thanks!
🤔 I also think we should check it. I can trigger a nightly before merging and, at very least, check manually that the binaries are signed as expected. Once that is verified, we can figure out a way check the signature on Windows machines (when packages are signed and uploaded) |
|
I've just triggered a nightly and checked the signature of the corresponding binaries. It works as expected 🎉 Signature checkI'm trying to add a validation step to check the binaries are signed right after packaging |
389e376 to
3c62815
Compare
3c62815 to
d147e26
Compare
|
The validation for Windows binaries signatures was added in the latest commit. After triggering a nightly, the check is working as expected: workflow execution |
f339411 to
475b1e1
Compare
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| GPG_PASSPHRASE: ${{ secrets.OHAI_GPG_PASSPHRASE }} | ||
| GPG_PRIVATE_KEY_BASE64: ${{ secrets.OHAI_GPG_PRIVATE_KEY_BASE64 }} # base64 encoded | ||
| GITHUB_TOKEN: ${{ secrets.gh_token }} |
There was a problem hiding this comment.
Why are we using that instead of ${{ secrets.GITHUB_TOKEN }}?
There was a problem hiding this comment.
We are using it to accomplish this. I decided to name them differently (using the lowercase and gh_token instead of github_token to avoid colliding with a Github reserved word) to be very explicit when using the workflow (and prevent us from using secrets: inherit again).
There was a problem hiding this comment.
Question: This is not used anywhere right? What's the purpose of adding it? Future tests or manual tests?
There was a problem hiding this comment.
Its purpose is having a quick way of testing the signature part locally, in case we are changing the goreleaser script or anything that could affect the windows binaries. Is it clear enough or does it needs more docs/comments?
Implementation details
Implements Windows binary signing for
newrelic-agent-controlandnewrelic-agent-control-cliexecutables using PFX code signing certificates during the GoReleaser build process.The implementation uses a containerized Docker-based signing workflow that integrates with GoReleaser's post-build hooks. When Windows binaries are compiled, a signing script is executed. It uses osslsigncode for signing.
Pipelines
The GitHub Actions workflow exposes signing credentials as environment variables to GoReleaser. When the
skip_signinput parameter is set totrue, both packages signing and Windows executable signing are disabled (SKIP_WINDOWS_SIGNenvironment variable disables Windows executable signing).Manual testing
To test the signing implementation locally with self-signed certificates:
Generate Test Credentials:
Sent environment variables:
Run goreleaser or sing directly
Check signature (on Windows):
The self-signed certificate will not be trusted by Windows but we still can check that the binary contains the signature.
File properties example
Checklist
docsis aligned with the change.CONTRIBUTING.md.log level guidelines.