You are here

function drush_letsencrypt_force_key_regenerate in Aegir HTTPS 7.3

Implements the letsencrypt-force-key-regenerate command.

File

submodules/letsencrypt/drush/letsencrypt.drush.inc, line 119
A Let's Encrypt implementation of the Certificate service for Provision.

Code

function drush_letsencrypt_force_key_regenerate() {
  $https_key = d()->https_key;
  $certs = d()->platform->web_server
    ->service('Certificate')
    ->get_certificate_paths($https_key);
  drush_log(print_r($certs, 1), 'warning');

  // Remove only the symlink to the certificate.
  unlink($certs['https_cert_source']);

  // Re-verify the site, this re-generates the certificate.
  $options = array();
  $target = d()->uri;
  provision_backend_invoke($target, 'provision-verify', array(), $options);
}