-
Notifications
You must be signed in to change notification settings - Fork 184
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
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,7 +96,7 @@ local function issue_cert(auto_ssl_instance, storage, domain) | |
| return fullchain_pem, privkey_pem, err | ||
| end | ||
|
|
||
| local function get_cert(auto_ssl_instance, domain) | ||
| local function get_cert(auto_ssl_instance, domain, ssl_options) | ||
| -- Look for the certificate in shared memory first. | ||
| local fullchain_der = ngx.shared.auto_ssl:get("domain:fullchain_der:" .. domain) | ||
| local privkey_der = ngx.shared.auto_ssl:get("domain:privkey_der:" .. domain) | ||
|
|
@@ -113,9 +113,11 @@ local function get_cert(auto_ssl_instance, domain) | |
| end | ||
|
|
||
| -- Finally, issue a new certificate if one hasn't been found yet. | ||
| 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 | ||
| 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 | ||
|
Collaborator
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.
|
||
|
|
||
| -- Return an error if issuing the certificate failed. | ||
|
|
@@ -251,7 +253,7 @@ local function do_ssl(auto_ssl_instance, ssl_options) | |
| end | ||
|
|
||
| -- Get or issue the certificate for this domain. | ||
| local fullchain_der, privkey_der, newly_issued, get_cert_err = get_cert(auto_ssl_instance, domain) | ||
| local fullchain_der, privkey_der, newly_issued, get_cert_err = get_cert(auto_ssl_instance, domain, ssl_options) | ||
| if get_cert_err then | ||
| ngx.log(ngx.ERR, "auto-ssl: could not get certificate for ", domain, " - using fallback - ", get_cert_err) | ||
| return | ||
|
|
||
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.
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.
As far as I can tell, this defaults to not issuing any certificates when
ssl_optionsis 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.