-
Notifications
You must be signed in to change notification settings - Fork 53
feat(api): validate a certificate's private key #1157
Conversation
@helgi and @Joshua-Anderson are potential reviewers of this pull request based on my analysis of |
f608714
to
5b890a2
Compare
@ineu feel free to give this one a try. It should fix your issue. |
Current coverage is 87.32% (diff: 100%)
|
Thanks @bacongobbler, going to try. Could you please point me to some documentation on how to update a single component? And also is there some kind of automatic build or do I need to build a Docker image from the repo? |
You can just use the image CI built and uploaded to quay.io. After installing v2.9.0, try
Change the image to |
{ | ||
'name': 'random-test-cert', | ||
'certificate': self.cert, | ||
'key': 'I am Groot.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😺
@@ -106,14 +113,23 @@ def domains(self): | |||
def __str__(self): | |||
return self.name | |||
|
|||
def _get_certificate(self): | |||
def _load_certificate(self): | |||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this be a bit more DRY if it just called validate_private_key(self.certificate)
from above and re-raised ValidationError
as SuspiciousOperation
? I guess validate_private_key
would need to return the key as well then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be, absolutely. I can refactor this.
Tried it:
So if you upload something other but the correct private key it throws an error, as expected. Though it's not the problem I've faced in #1155. I think to completely cover the cases when nginx would print an error (and fail to start) following usecases should be taken into account:
|
Thank you for providing your use cases. It wasn't clear in the original ticket. If you feel like hacking on some tests/fixes for this in another PR that'd be great. I'll keep your ticket open in the meantime. |
37d014a
to
3b80f77
Compare
3b80f77
to
927d42e
Compare
927d42e
to
be44896
Compare
closes #1155