Add support for client certificates#89
Closed
jtdowney wants to merge 1 commit intoFiloSottile:masterfrom
jtdowney:client-certificate-support
Closed
Add support for client certificates#89jtdowney wants to merge 1 commit intoFiloSottile:masterfrom jtdowney:client-certificate-support
jtdowney wants to merge 1 commit intoFiloSottile:masterfrom
jtdowney:client-certificate-support
Conversation
This change adds a new flag for client certificates. When this flag is passed, the extended key usage for the generated certificate is for client authentication instead of server authentication.
adamdecaf
reviewed
Nov 2, 2018
|
|
||
| var extKeyUsage []x509.ExtKeyUsage | ||
| if m.client { | ||
| extKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth} |
Contributor
There was a problem hiding this comment.
Why not just add ClientAuth as a usage if the flag is set?
Contributor
Author
There was a problem hiding this comment.
In my case, I wanted separate certificates. If the certificate is meant for client auth, then it doesn't need the server auth extension. To me, it would seem weird that a client certificate could be used for server authentication as well.
|
Hi! I would like to see this kind of change as well. Will this this PR be merged or does it break your thoughts about simplicity? Personally I don't mind adding the extended key usage for both client and server if that's more in line with your thoughts. This is the only diff I needed to fix my issues: diff --git a/cert.go b/cert.go
index 13ed35f..8c40aa8 100644
--- a/cert.go
+++ b/cert.go
@@ -62,7 +62,7 @@ func (m *mkcert) makeCert(hosts []string) {
NotBefore: time.Now(),
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
- ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
+ ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth},
BasicConstraintsValid: true,
}
for _, h := range hosts { |
Owner
|
Rebased and merged, thank you! |
|
\o/!!!!!
…On Sat, Feb 2, 2019 at 1:28 PM Filippo Valsorda ***@***.***> wrote:
Rebased and merged, thank you!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#89 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABJ68JKq_qlSiqUxp6Q9txy7jfXvwRLks5vJgLpgaJpZM4YMT6Z>
.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change adds a new flag for client certificates. When this flag is passed, the extended key usage for the generated certificate is for client authentication instead of server authentication.
I am not 100% sure this is a good idea, but I found myself needing to generate both server and client certificates for a project and thought that
mkcertcould fit both of those cases.The change was remarkably easy to make so I figured I'd submit a PR.