Repository navigation
fix(site): don't report a manual DNS renewal as completed #530
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -64,6 +64,11 @@ abstract class EE_Site_Command { | |||||||
| */ | ||||||||
| private $ssl_failure_handled_by_caller = false; | ||||||||
|
|
||||||||
| /** | ||||||||
| * @var bool $le_dns_verify_pending Whether init_le() left a manual DNS challenge for `ee site ssl-verify` to finish. | ||||||||
| */ | ||||||||
| private $le_dns_verify_pending = false; | ||||||||
|
|
||||||||
| /** | ||||||||
| * @var resource $ssl_lock_handle Handle of the process-wide SSL lock. | ||||||||
| * | ||||||||
|
|
@@ -2078,6 +2083,7 @@ protected function init_le( $site_url, $site_fs_path, $wildcard = false, $www_or | |||||||
| $api_key_absent = empty( get_config_value( 'cloudflare-api-key' ) ); | ||||||||
| if ( $is_solver_dns && $api_key_absent ) { | ||||||||
| echo \cli\Colors::colorize( '%YIMPORTANT:%n Run `ee site ssl-verify ' . $site_url . '` once the DNS changes have propagated to complete the certification generation and installation.', null ) . PHP_EOL; | ||||||||
| $this->le_dns_verify_pending = true; | ||||||||
| } else { | ||||||||
| if ( ! $api_key_absent && $is_solver_dns ) { | ||||||||
| EE::log( 'Waiting for DNS entry propagation.' ); | ||||||||
|
|
@@ -2581,6 +2587,14 @@ public function ssl_renew( $args, $assoc_args ) { | |||||||
| } | ||||||||
| EE::error( $e->getMessage() . $kept ); | ||||||||
| } | ||||||||
| // Without a Cloudflare API key the DNS challenge is manual, so no certificate was issued yet. | ||||||||
| if ( $this->le_dns_verify_pending ) { | ||||||||
| // `ssl-renew --force` on a site still waiting for its first certificate has none to keep. | ||||||||
| $still_kept = \EE\Site\Utils\is_le_ssl_pending( $this->site_data['site_url'], 'le' ) ? '' : ' The current certificate is kept until then.'; | ||||||||
| EE::warning( sprintf( 'SSL renewal of %1$s is pending: no new certificate was issued yet. Run `ee site ssl-verify %1$s` once the DNS TXT records have propagated.%2$s', $this->site_data['site_url'], $still_kept ) ); | ||||||||
|
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. Pass After Suggested fix
Committable suggestion
|
||||||||
|
|
||||||||
| return; | ||||||||
| } | ||||||||
| } | ||||||||
| EE::success( 'SSL renewal completed.' ); | ||||||||
| } | ||||||||
|
|
||||||||
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.
Report pending renewals in batch mode.
For a non-wildcard DNS site without a Cloudflare key,
ssl-renew --all --forcesets the pending flag. The batch branch does not check it and still printsSSL renewal completed.Report the pending site without stopping the loop, and avoid reporting the batch as fully completed.