You are here

function Provision_Service_Certificate_LetsEncrypt::verify in Aegir HTTPS 7.3

Implementation of service verify.

Called from drush_certificate_provision_verify().

Overrides Provision_Service_Certificate::verify

File

submodules/letsencrypt/drush/Provision/Service/Certificate/LetsEncrypt.php, line 185

Class

Provision_Service_Certificate_LetsEncrypt
A LetsEncrypt implementation of the Certificate service type.

Code

function verify() {
  parent::verify();
  if ($this->context->type == 'server') {
    $source = dirname(dirname(dirname(dirname(__FILE__)))) . '/bin';

    // Create the configuration file directory.
    provision_file()
      ->create_dir($this->server->letsencrypt_config_path, dt("Let's Encrypt configuration directory"), 0711);

    // Create the ACME challenge directory.
    provision_file()
      ->create_dir($this->server->letsencrypt_challenge_path, dt("Let's Encrypt ACME challenge directory"), 0711);

    // Create the script directory.
    provision_file()
      ->create_dir($this->server->letsencrypt_script_path, dt("Let's Encrypt script + data directory"), 0711);

    // Initialize config.
    provision_file()
      ->copy($source . '/config', $this->server->letsencrypt_script_path . '/config');
    provision_file()
      ->copy($source . '/config.staging', $this->server->letsencrypt_script_path . '/config.staging');

    // Initialize hooks file.
    provision_file()
      ->copy($source . '/dehydrated-hooks.sh', $this->server->letsencrypt_script_path . '/dehydrated-hooks.sh');
    provision_file()
      ->chmod($this->server->letsencrypt_script_path . '/dehydrated-hooks.sh', 0755);
    if (drush_copy_dir($source . '/dehydrated', $this->server->letsencrypt_script_path . '/dehydrated', FILE_EXISTS_OVERWRITE)) {
      drush_log("Copied Let's Encrypt dehydrated script code into place.", 'success');
    }
    provision_file()
      ->chmod($this->server->letsencrypt_script_path . '/dehydrated/dehydrated', 0755);

    // Symlink the dehydrated code into place.
    provision_file()
      ->symlink($this->server->letsencrypt_script_path . '/dehydrated/dehydrated', $this->server->letsencrypt_script_path . '/script', dt("Create Let's Encrypt dehydrated symlink."), 0644);

    // Sync the directory to the remote server if needed.

    #  $this->sync($this->server->letsencrypt_config_path);
  }
}