Skip to content

Secureboot modifications for ephemeral key signing#499

Merged
lguohan merged 2 commits intosonic-net:masterfrom
bhouse-nexthop:secureboot
Oct 18, 2025
Merged

Secureboot modifications for ephemeral key signing#499
lguohan merged 2 commits intosonic-net:masterfrom
bhouse-nexthop:secureboot

Conversation

@bhouse-nexthop
Copy link
Copy Markdown
Contributor

@bhouse-nexthop bhouse-nexthop commented Jul 21, 2025

The current sonic secureboot implementation assumes all assets are signed with the DB Key. There are roughly 3600 kernel modules that get signed in the process.

Organizations may have varying security policy requirements where any signing requests may require signoff by one or more parties, this may simply be infeasible for that many requests.

Given that the DB key may be a long-lived key, and only RSA 2048 is often used or available, it is a security best-practice to sign as few assets as possible with such a key.

This is backwards-compatible so it can be applied prior to the sonic-buildimage patches.

Related PRs: sonic-net/sonic-buildimage#23405
Fixes sonic-net/sonic-buildimage#23406

The current sonic secureboot implementation assumes all assets are signed with the DB Key.
There are roughly 3600 kernel modules that get signed in the process.

Organizations may have varying security policy requirements where any signing requests may
require signoff by one or more parties, this may simply be infeasible for that many requests.

Given that the DB key may be a long-lived key, and only RSA 2048 is often used or available,
it is a security best-practice to sign as few assets as possible with such a key.

This is backwards-compatible so it can be applied prior to the sonic-buildimage patches.
@bhouse-nexthop bhouse-nexthop requested a review from a team as a code owner July 21, 2025 13:02
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@bhouse-nexthop
Copy link
Copy Markdown
Contributor Author

@davidpil2002 can you review this since you contributed the initial secureboot implementation?

@davidpil2002
Copy link
Copy Markdown
Contributor

davidpil2002 commented Jul 22, 2025 via email

@davidpil2002
Copy link
Copy Markdown
Contributor

In general the most of the flows look good to me.
I give for now one comment only,
but, I appreciate that a verification team run this version before merging, to assert that there is a good backward compatibility as planned.
@DavidZagury pls can you review as well

@tjchadaga tjchadaga requested a review from qiluo-msft July 30, 2025 15:47
@DavidZagury DavidZagury requested a review from Yarden-Z September 9, 2025 08:48
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@lguohan
Copy link
Copy Markdown
Contributor

lguohan commented Oct 18, 2025

You provided a pull request diff for https://github.com/sonic-net/sonic-linux-kernel/pull/499/files. Here is a review based on the changes shown:


Summary of Changes

Makefile

  • Introduces a new variable: SECURE_UPGRADE_KERNEL_CAFILE, which defaults to $(SECURE_UPGRADE_SIGNING_CERT).
  • Updates the call to ../manage-config to use SECURE_UPGRADE_KERNEL_CAFILE instead of SECURE_UPGRADE_SIGNING_CERT.

manage-config

  • Renames the variable SECURE_UPGRADE_SIGNING_CERT to SECURE_UPGRADE_KERNEL_CAFILE throughout the script.
  • Updates all usages, including assignment from arguments, echo statements, file existence checks, and config substitutions.

Purpose & Impact

Purpose:

  • This PR appears to clarify or generalize the naming of the certificate file used for secure kernel upgrades, switching from SIGNING_CERT to KERNEL_CAFILE.
  • The change makes the variable name more descriptive of its actual use: a CA file for kernel upgrades, not necessarily only a signing certificate.

Impact:

  • Improves code readability and maintainability by using a more accurate variable name.
  • Reduces ambiguity for developers and maintainers regarding what file is being referenced.
  • No functional change unless there are scripts or downstream consumers strictly expecting the old variable name.

Technical Review

Correctness:

  • All instances of SECURE_UPGRADE_SIGNING_CERT in both the Makefile and manage-config are replaced with SECURE_UPGRADE_KERNEL_CAFILE, including argument parsing, conditional checks, logs, and config file manipulation.
  • The Makefile maintains backwards compatibility by defaulting SECURE_UPGRADE_KERNEL_CAFILE to $(SECURE_UPGRADE_SIGNING_CERT).
  • No logic errors or typos are apparent.

Backward Compatibility:

  • The Makefile's default ensures that existing workflows setting only SECURE_UPGRADE_SIGNING_CERT will continue to work unless scripts or external dependencies rely on the old variable name within manage-config.

Documentation & Clarity:

  • The variable name is now more descriptive and less confusing.
  • Consider updating any external documentation, CI scripts, or developer guides that reference the old variable name.

Testing:

  • No test changes are shown. If you have CI for kernel upgrades, ensure that tests pass with the new variable name.

Suggestions

  1. Documentation: Update any relevant documentation or comments that mention SECURE_UPGRADE_SIGNING_CERT.
  2. Deprecation Notice: If this change affects downstream scripts or users, consider adding a deprecation warning or update instructions for users migrating from SECURE_UPGRADE_SIGNING_CERT to SECURE_UPGRADE_KERNEL_CAFILE.
  3. Test Coverage: Ensure CI covers cases where only the old variable is set, and where the new variable is explicitly set, to catch regressions.

Summary

This PR is a sensible refactor to clarify the purpose of a configuration variable used in secure kernel upgrades. The implementation is clean, and backward compatibility is considered. Please verify that any dependent scripts or documentation are updated accordingly.

If you need a more detailed review regarding usage or possible edge cases, let me know!

@lguohan lguohan merged commit 15e4ad9 into sonic-net:master Oct 18, 2025
6 checks passed
lguohan pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Oct 27, 2025
…s and bugfixes) (#23405)

#### Why I did it

The current sonic secureboot implementation assumes all assets are signed with the DB Key.  There are roughly 3600 kernel modules that get signed in the process.

Organizations may have varying security policy requirements where any signing requests may require signoff by one or more parties, this may simply be infeasible for that many requests.

Given that the DB key may be a long-lived key, and only RSA 2048 is often used or available, it is a security best-practice to sign as few assets as possible with such a key.

This PR is fully backwards compatible with any pre-existing usages.  It introduces a new `rules/config` setting of `SECURE_UPGRADE_KERNEL_CAFILE` which is a path to a file for all trusted keys to embed into the kernel.  If that setting is not specified, it defaults to `SECURE_UPGRADE_SIGNING_CERT`.  There are no other infrastructure changes to support ephemeral keys for kernel module signing.  It is up to the organization to generate the ephemeral keys and pass them into their own signing scripts as required.

Dependent PR:
 * sonic-net/sonic-linux-kernel#499

Related PRs:
 * sonic-net/sonic-utilities#3989
 * #23732
 * #23733
 * #23734
 * #23735
 * #23736

Fixes #23406

##### Work item tracking

#### How I did it

Worked through production signing steps and hit issues when requiring signing approval with our HSM.  This was the most elegant solution that required the minimal changes.

This has been fully tested.

#### How to verify it

Since there are no provided production signing script examples this would require a vendor with an existing implementation to validate.  Nexthop has validated this internally.

#### Which release branch to backport (provide reason below if selected)


#### Tested branch (Please provide the tested image version)

master as of 20250721

#### Description for the changelog
Secureboot: Production signing enhancement to allow ephemeral kernel module keys

#### Link to config_db schema for YANG module changes
N/A

#### A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Brad House <bhouse@nexthop.ai>
FengPan-Frank pushed a commit to FengPan-Frank/sonic-buildimage that referenced this pull request Dec 4, 2025
…s and bugfixes) (sonic-net#23405)

#### Why I did it

The current sonic secureboot implementation assumes all assets are signed with the DB Key.  There are roughly 3600 kernel modules that get signed in the process.

Organizations may have varying security policy requirements where any signing requests may require signoff by one or more parties, this may simply be infeasible for that many requests.

Given that the DB key may be a long-lived key, and only RSA 2048 is often used or available, it is a security best-practice to sign as few assets as possible with such a key.

This PR is fully backwards compatible with any pre-existing usages.  It introduces a new `rules/config` setting of `SECURE_UPGRADE_KERNEL_CAFILE` which is a path to a file for all trusted keys to embed into the kernel.  If that setting is not specified, it defaults to `SECURE_UPGRADE_SIGNING_CERT`.  There are no other infrastructure changes to support ephemeral keys for kernel module signing.  It is up to the organization to generate the ephemeral keys and pass them into their own signing scripts as required.

Dependent PR:
 * sonic-net/sonic-linux-kernel#499

Related PRs:
 * sonic-net/sonic-utilities#3989
 * sonic-net#23732
 * sonic-net#23733
 * sonic-net#23734
 * sonic-net#23735
 * sonic-net#23736

Fixes sonic-net#23406

##### Work item tracking

#### How I did it

Worked through production signing steps and hit issues when requiring signing approval with our HSM.  This was the most elegant solution that required the minimal changes.

This has been fully tested.

#### How to verify it

Since there are no provided production signing script examples this would require a vendor with an existing implementation to validate.  Nexthop has validated this internally.

#### Which release branch to backport (provide reason below if selected)

#### Tested branch (Please provide the tested image version)

master as of 20250721

#### Description for the changelog
Secureboot: Production signing enhancement to allow ephemeral kernel module keys

#### Link to config_db schema for YANG module changes
N/A

#### A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Brad House <bhouse@nexthop.ai>
Signed-off-by: Feng Pan <fenpan@microsoft.com>
xwjiang-ms pushed a commit to xwjiang-ms/sonic-buildimage that referenced this pull request Dec 22, 2025
…s and bugfixes) (sonic-net#23405)

#### Why I did it

The current sonic secureboot implementation assumes all assets are signed with the DB Key.  There are roughly 3600 kernel modules that get signed in the process.

Organizations may have varying security policy requirements where any signing requests may require signoff by one or more parties, this may simply be infeasible for that many requests.

Given that the DB key may be a long-lived key, and only RSA 2048 is often used or available, it is a security best-practice to sign as few assets as possible with such a key.

This PR is fully backwards compatible with any pre-existing usages.  It introduces a new `rules/config` setting of `SECURE_UPGRADE_KERNEL_CAFILE` which is a path to a file for all trusted keys to embed into the kernel.  If that setting is not specified, it defaults to `SECURE_UPGRADE_SIGNING_CERT`.  There are no other infrastructure changes to support ephemeral keys for kernel module signing.  It is up to the organization to generate the ephemeral keys and pass them into their own signing scripts as required.

Dependent PR:
 * sonic-net/sonic-linux-kernel#499

Related PRs:
 * sonic-net/sonic-utilities#3989
 * sonic-net#23732
 * sonic-net#23733
 * sonic-net#23734
 * sonic-net#23735
 * sonic-net#23736

Fixes sonic-net#23406

##### Work item tracking

#### How I did it

Worked through production signing steps and hit issues when requiring signing approval with our HSM.  This was the most elegant solution that required the minimal changes.

This has been fully tested.

#### How to verify it

Since there are no provided production signing script examples this would require a vendor with an existing implementation to validate.  Nexthop has validated this internally.

#### Which release branch to backport (provide reason below if selected)

#### Tested branch (Please provide the tested image version)

master as of 20250721

#### Description for the changelog
Secureboot: Production signing enhancement to allow ephemeral kernel module keys

#### Link to config_db schema for YANG module changes
N/A

#### A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Brad House <bhouse@nexthop.ai>
Signed-off-by: xiaweijiang <xiaweijiang@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: Secureboot production signing of kernel modules using ephemeral keys + bug fixes

6 participants