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

Move support for encrypted private key #78

Merged
merged 6 commits into from
Jul 19, 2024

Conversation

sergei-maertens
Copy link
Member

This library is no longer responsible for decrypting the private key, instead the django-simple-certmanager library takes care of it at upload time.

Includes a data migration to perform the decryption for existing instances.

This matches words like 'password' and 'passphrase'.
Version 2.2.0 is the one that will have support for encrypted private
keys.
Using the configured private key, decrypt the certificate's private
key and 'replace' the file to point to the decrypted private key
instead.

Security wise this makes little difference - if you had access to the
DB, you could already grab the passphrase to decrypt it yourself.

The private media storage and database access are expected to be
properly secured by your infra/ops team.
Systems may be in a broken state to begin with,
our migration may not crash when trying to process
this.
The form field is now a part of django-simple-certmanager,
which in turn uses it to decrypt the private key so that
the file is ready to use and no additional decryption is
needed in django-digid-eherkenning.
Copy link

codecov bot commented Jul 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.91%. Comparing base (170d6a9) to head (ffb17ba).
Report is 34 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #78      +/-   ##
==========================================
+ Coverage   90.86%   90.91%   +0.05%     
==========================================
  Files          51       51              
  Lines        1653     1674      +21     
  Branches      152      156       +4     
==========================================
+ Hits         1502     1522      +20     
  Misses        110      110              
- Partials       41       42       +1     
Flag Coverage Δ
base 89.44% <ø> (+0.07%) ⬆️
oidc 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@sergei-maertens sergei-maertens requested a review from Viicos July 18, 2024 15:08
Copy link
Contributor

@Viicos Viicos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if I understand correctly, simple certmanager was updated to support adding a priv. key with a password, but the password is not stored at all and we decrypt the key on the fly before saving it?
And then on the django-digid-eherkenning side we "remove" support for storing priv. key passwords, as simple certmanager will decrypt them on the fly?

@sergei-maertens
Copy link
Member Author

@Viicos correct!

@sergei-maertens sergei-maertens merged commit fc9abd3 into master Jul 19, 2024
17 checks passed
@sergei-maertens sergei-maertens deleted the chore/encrypted-private-key-support branch July 19, 2024 08:43
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