Working on this current code, which doesn't work:

  // These values tested many times
  $clone_args = array(    'new_uri' => $url,
    'new_uri' => $url,
    'new_db_server' => $new_db_server,
    'target_platform' => $new_platform_nid,
    'aliases' => '',
    'redirection' => '',
  );
  
  // Use the template site's SSL settings
  $template_node = node_load($template_nid);
  if (!empty($template_node)) {
    // Not all sites will automatically have an SSL object property...
    if (isset($template_node->ssl_enabled) && $template_node->ssl_enabled) {
      $clone_args['ssl_enabled'] = $template_node->ssl_enabled; // this is 1, see screenshot
      $clone_args['ssl_key'] = $template_node->ssl_key;  // this is 1, see screenshot
    }
  } else {
    // Nothing to clone
    throw new Exception(t('Service is misconfigured (missing template node).'));
  }
  
  ddl('clone args:');
  ddl($clone_args);
  $result = hosting_add_task($template_nid, 'clone', $clone_args);

Put simply, this should set the certificate of the cloned site but doesn't. I think we should be able to set the SSL certificate through hosting_add_task, it's useful and worked in Aegir2 I think (can someone confirm this?).

Alternatively (or additionally), clones of sites with SSL should use the same certificate by default, since we now support SNI.

Comments

helmo’s picture

Issue summary: View changes

In provision's platform/clone.provision.inc we unset the SSL settings while cloning.

Implemented as a safety measure ... but maybe we can do better now.

bgm’s picture

Would it make sense to add an option in the clone UI to let the user select the certificate?

I have two main use-cases:

- farm sites: we clone a model site, so we want the clone to use a wildcard certificate
- client test sites: we clone the production site to test, but we still need to use https because the site contains client/user data.

helmo’s picture

That sound like a useful feature.