Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add priv key uri support to SignerStore #451

Merged
merged 1 commit into from
Feb 7, 2024

Conversation

lukpueh
Copy link
Collaborator

@lukpueh lukpueh commented Feb 5, 2024

implements option 2 from repository-service-tuf/repository-service-tuf#580
supersedes #427 (does not include a custom "relative file path signer", can be added in a follow-up PR)

--

Change SignerStore.get to load non-cached signers from private key uri configured on the passed public key in a "x-rstuf-online-key-uri" field.

If the public key does not include a uri, RSTUF_KEYVAULT_BACKEND is used as fallback.

securesystemslib.signer.CryptoSigner is "registered" to load signers from private key files. No key specific secrets handling is added. This means the keys must be stored unencryped, preferrably using the secrets handling of the deployment platform (e.g. docker secrets).

Default schemes in securesystemslib.signer.SIGNER_FOR_URI_SCHEME can be used but are untested.

Tests
Add test to load actual signer from private key file.

Uses new unencrypted ed25519 private key copied from: secure-systems-lab/securesystemslib@7952c3f

Public key stubs in other tests are updated, because signer store now reads the unrecognized_fields attribute, which is mandatory in Key objects.

implements option 2 from repository-service-tuf/repository-service-tuf#580
supersedes repository-service-tuf#427 (does not include a custom "relative file path signer",
can be added in a follow-up PR)

--

Change `SignerStore.get` to load non-cached signers from private key uri
configured on the passed public key in a  "x-rstuf-online-key-uri" field.

If the public key does not include a uri, RSTUF_KEYVAULT_BACKEND is used
as fallback.

securesystemslib.signer.CryptoSigner is "registered" to load signers
from private key files. No key specific secrets handling is added. This
means the keys must be stored unencryped, preferrably using the secrets
handling of the deployment platform (e.g. docker secrets).

Default schemes in `securesystemslib.signer.SIGNER_FOR_URI_SCHEME` can
be used but are untested.

**Tests**
Add test to load actual signer from private key file.

Uses new unencrypted ed25519 private key copied from:
secure-systems-lab/securesystemslib@7952c3f

Public key stubs in other tests are updated, because signer store now
reads the `unrecognized_fields` attribute, which is mandatory in Key
objects.

--

implements option 2 described in
repository-service-tuf/repository-service-tuf#580

mostly supersedes repository-service-tuf#427 (does not include a custom "relative file path
signer")

Signed-off-by: Lukas Puehringer <[email protected]>
@lukpueh lukpueh requested a review from kairoaraujo February 5, 2024 18:38
Copy link

codecov bot commented Feb 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (331e7e7) 100.00% compared to head (d5d915c) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #451   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           15        15           
  Lines         1035      1039    +4     
=========================================
+ Hits          1035      1039    +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

lukpueh added a commit to lukpueh/repository-service-tuf-worker that referenced this pull request Feb 6, 2024
Add test setup and test to load a signer from AWS KMS (localstack) via
SignerStore (pending in repository-service-tuf#451), with 0 worker code changes.

Run as `tox -e local-aws-kms`

**Change details**

* Add independent tox environment to init/cleanup localstack,
  configure ambient AWS KMS credentials, create a test key,
  and run the test.

* Add test to "import" test public key from AWS KMS and configure
  private key URI - this would typically happen in a key management UI
  (e.g. RSTUF CLI) - and use `SignerStore.get` to load the signer.

Signed-off-by: Lukas Puehringer <[email protected]>
@lukpueh lukpueh merged commit b70143c into repository-service-tuf:main Feb 7, 2024
11 checks passed
lukpueh added a commit to lukpueh/repository-service-tuf-worker that referenced this pull request Feb 7, 2024
Add test setup and test to load a signer from AWS KMS (localstack) via
SignerStore (pending in repository-service-tuf#451), with 0 worker code changes.

Run as `tox -e local-aws-kms`

**Change details**

* Add independent tox environment to init/cleanup localstack,
  configure ambient AWS KMS credentials, create a test key,
  and run the test.

* Add test to "import" test public key from AWS KMS and configure
  private key URI - this would typically happen in a key management UI
  (e.g. RSTUF CLI) - and use `SignerStore.get` to load the signer.

Signed-off-by: Lukas Puehringer <[email protected]>
lukpueh added a commit to lukpueh/repository-service-tuf-worker that referenced this pull request Feb 13, 2024
Add test setup and test to load a signer from AWS KMS (localstack) via
SignerStore (pending in repository-service-tuf#451), with 0 worker code changes.

Run as `tox -e local-aws-kms`

**Change details**

* Add independent tox environment to init/cleanup localstack,
  configure ambient AWS KMS credentials, create a test key,
  and run the test.

* Add test to "import" test public key from AWS KMS and configure
  private key URI - this would typically happen in a key management UI
  (e.g. RSTUF CLI) - and use `SignerStore.get` to load the signer.

Signed-off-by: Lukas Puehringer <[email protected]>
lukpueh added a commit to lukpueh/repository-service-tuf-worker that referenced this pull request Feb 14, 2024
Add test setup and test to load a signer from AWS KMS (localstack) via
SignerStore (pending in repository-service-tuf#451), with 0 worker code changes.

Run as `tox -e local-aws-kms`

**Change details**

* Add independent tox environment to init/cleanup localstack,
  configure ambient AWS KMS credentials, create a test key,
  and run the test.

* Add test to "import" test public key from AWS KMS and configure
  private key URI - this would typically happen in a key management UI
  (e.g. RSTUF CLI) - and use `SignerStore.get` to load the signer.

Signed-off-by: Lukas Puehringer <[email protected]>
kairoaraujo pushed a commit to lukpueh/repository-service-tuf-worker that referenced this pull request Mar 2, 2024
Add test setup and test to load a signer from AWS KMS (localstack) via
SignerStore (pending in repository-service-tuf#451), with 0 worker code changes.

Run as `tox -e local-aws-kms`

**Change details**

* Add independent tox environment to init/cleanup localstack,
  configure ambient AWS KMS credentials, create a test key,
  and run the test.

* Add test to "import" test public key from AWS KMS and configure
  private key URI - this would typically happen in a key management UI
  (e.g. RSTUF CLI) - and use `SignerStore.get` to load the signer.

Signed-off-by: Lukas Puehringer <[email protected]>
kairoaraujo pushed a commit to lukpueh/repository-service-tuf-worker that referenced this pull request Mar 7, 2024
Add test setup and test to load a signer from AWS KMS (localstack) via
SignerStore (pending in repository-service-tuf#451), with 0 worker code changes.

Run as `tox -e local-aws-kms`

**Change details**

* Add independent tox environment to init/cleanup localstack,
  configure ambient AWS KMS credentials, create a test key,
  and run the test.

* Add test to "import" test public key from AWS KMS and configure
  private key URI - this would typically happen in a key management UI
  (e.g. RSTUF CLI) - and use `SignerStore.get` to load the signer.

Signed-off-by: Lukas Puehringer <[email protected]>
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.

2 participants