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

[automate-cli] Generate unique serial for self-signed certs #411

Merged
merged 1 commit into from
May 24, 2019

Conversation

stevendanna
Copy link
Contributor

Automate CLI generates a self-signed SSL certificate for the front-end
load balancer if the user does not provide one.

Previously, this certificate had a hard-coded Serial of 1. This PR
changes it to a random serial to avoid errors in Firefox and
potentially other browsers.

Signed-off-by: Steven Danna [email protected]

Automate CLI generates a self-signed SSL certificate for the front-end
load balancer if the user does not provide one.

Previously, this certificate had a hard-coded Serial of 1. This PR
changes it to a random serial to avoid errors in Firefox and
potentially other browsers.

Signed-off-by: Steven Danna <[email protected]>
//
// Here, we set the limit to double this requirement.
limit := new(big.Int).Lsh(big.NewInt(1), 128)
ret, err := rand.Int(rand.Reader, limit)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just wondering how this is seeded... would it generate the same sequence the next time the service is started? And is that necessarily a bad thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@msorens Great question. The crypto/rand package uses an operating system entropy source.

On the systems we support, this means we'll likely be calling this system call:

http://man7.org/linux/man-pages/man2/getrandom.2.html

This means that we generally should be getting high-quality random data that will not be the same between runs. On systems that do not have that system call, it may fall back to another source that could produce predictable results if called during very early boot on some systems, but I don't think that is likely for our use case.

Copy link
Contributor

@srenatus srenatus left a comment

Choose a reason for hiding this comment

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

:buttonmash: thanks

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.

3 participants