-
Notifications
You must be signed in to change notification settings - Fork 2.1k
adds public web addresses to self-signed cert #28766
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
389cfa1
adds public web addresses to self-signed cert
stevenGravy 6cb3607
skips adding ip addresses to self-signed cert
stevenGravy 2935cd5
skip error on public addresses
stevenGravy ab7e05f
lint fix
stevenGravy d14650d
optimize logic and log error
stevenGravy 2d2c5b8
Update lib/service/service.go
stevenGravy 4c74288
skip adding IP addresses to DNS SANS and log warning
stevenGravy e8c1a2a
lint fix and update log message
stevenGravy 135579d
Merge branch 'master' into stevenGravy/selfsigned
stevenGravy 833ae51
Merge branch 'master' into stevenGravy/selfsigned
stevenGravy 7c96e7b
add public addresses into IP sans if ips
stevenGravy fef4e9b
remove comment
stevenGravy 5607fb8
lint fix
stevenGravy 5581759
include empty ipaddress for GeneratedSelfSignedCert calls
stevenGravy c99992b
removed
stevenGravy 08c0408
Merge branch 'master' into stevenGravy/selfsigned
stevenGravy cd4d321
update function call
stevenGravy 0f06c8b
logic updates
stevenGravy 8fe4b82
handle when a IP addressed can't be parsed for self-signed cert
stevenGravy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,7 @@ type Credentials struct { | |
|
|
||
| // GenerateSelfSignedCert generates a self-signed certificate that | ||
| // is valid for given domain names and ips, returns PEM-encoded bytes with key and cert | ||
| func GenerateSelfSignedCert(hostNames []string) (*Credentials, error) { | ||
| func GenerateSelfSignedCert(hostNames []string, ipAddresses []string) (*Credentials, error) { | ||
| priv, err := native.GenerateRSAPrivateKey() | ||
| if err != nil { | ||
| return nil, trace.Wrap(err) | ||
|
|
@@ -87,6 +87,14 @@ func GenerateSelfSignedCert(hostNames []string) (*Credentials, error) { | |
| if ips != nil { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: It'd be tempted to rename |
||
| template.IPAddresses = append(ips, net.ParseIP("::1")) | ||
| } | ||
| for _, ip := range ipAddresses { | ||
| ipParsed := net.ParseIP(ip) | ||
| if ipParsed == nil { | ||
| return nil, trace.Errorf("Unable to parse IP address for self-signed certificate (%v)", ip) | ||
| } | ||
| template.IPAddresses = append(template.IPAddresses, ipParsed) | ||
| } | ||
|
|
||
| derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, &priv.PublicKey, priv) | ||
| if err != nil { | ||
| return nil, trace.Wrap(err) | ||
|
|
||
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
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.
Uh oh!
There was an error while loading. Please reload this page.