Skip to content

Generate a new certificate unless ssl_options["generate_certs"] == false #92

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 4 commits into from
Jan 28, 2018

Conversation

mklauber
Copy link
Contributor

Sometimes its beneficial to be able to serve requests using the letsencrypt certificates without also generating new ones. This allows a new ssl_options option generate_certs that, if false, results in resty-auto-ssl using certs from memory or the storage, but not requesting new ones.

@mklauber
Copy link
Contributor Author

This is in response to #91

@GUI
Copy link
Collaborator

GUI commented Dec 25, 2017

@mklauber: Thanks for the pull request, but apologies for the delayed response! I've been tied up with other things, but I'll try to take a look at this more closely in the coming weeks and get this released. Thanks again.

@luto
Copy link
Collaborator

luto commented Dec 25, 2017

@mklauber this change looks very useful, thank you 👍 🙂

@luto luto self-assigned this Dec 25, 2017
Copy link
Collaborator

@luto luto left a comment

Choose a reason for hiding this comment

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

Would you mind adding a test so we can easily ensure that it still works in the future?

Also, documentation in the README would be great, so people can actually use this without reading the code.

Thank you!

fullchain_pem, privkey_pem = issue_cert(auto_ssl_instance, storage, domain)
if fullchain_pem and privkey_pem then
return convert_to_der_and_cache(domain, fullchain_pem, privkey_pem, true)
if ssl_options and ssl_options["generate_certs"] ~= false then
Copy link
Collaborator

Choose a reason for hiding this comment

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

As far as I can tell, this defaults to not issuing any certificates when ssl_options is not there or the value is not specified. When users update to a version containing this change, their setup will stop working for new domains.

As to not break existing setups without need, I suggest to change the default for this to true.

fullchain_pem, privkey_pem = issue_cert(auto_ssl_instance, storage, domain)
if fullchain_pem and privkey_pem then
return convert_to_der_and_cache(domain, fullchain_pem, privkey_pem, true)
end
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

get_cert returns an error message as the very last parameter. Please add a appropriate message telling the users what is going on, in case certificates are not being generated because of this setting:

return nil, nil, nil, "did not issue certificate, because the generate_certs setting is false"

@mklauber
Copy link
Contributor Author

@luto I'll make the defaults, error message and documentation changes. I actually don't really know lua, and basically just hacked this together via google till it worked for my needs, so I don't actually know how to write tests. Is there a tutorial for your test framework or something I can learn from somewhere?

Default to issuing certs, and return an error message if certs disabled
@GUI GUI merged commit f80daf7 into auto-ssl:master Jan 28, 2018
@GUI GUI added this to the v0.12.0 milestone Jan 29, 2018
@GUI
Copy link
Collaborator

GUI commented Feb 5, 2018

Thanks for the PR, @mklauber, and thanks for reviewing @luto! This is part of the v0.12.0 release.

I also added some tests for this in 69e416c.

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