You are here

function https_apache_provision_apache_vhost_config in Aegir HTTPS 7.3

Implements hook_provision_apache_vhost_config().

Adds HTTPS client authentication to sites that require it.

File

submodules/apache_https/drush/https_apache.drush.inc, line 31
Register with Provision autoloader.

Code

function https_apache_provision_apache_vhost_config($uri, $data) {
  $http_service = $data['server']
    ->service('http');
  if (d()->type != 'site' || !isset($http_service->https_enabled) || !$http_service->https_enabled || !isset(d()->https_enabled) || !d()->https_enabled || !isset(d()->https_client_authentication_enabled) || !d()->https_client_authentication_enabled) {
    return '';
  }
  $lines = array();
  $lines[] = "  ###################################";
  $lines[] = "  ### Aegir HTTPS (hosting_https) ###";
  $lines[] = "  ###################################";
  $lines[] = "  # Enable HTTPS client authentication as per site settings.";
  if (!empty(d()->https_client_authentication_path)) {
    $lines[] = "  <Location '" . strip_tags(d()->https_client_authentication_path) . "'>";
  }
  $lines[] = "  SSLVerifyClient optional_no_ca";
  $lines[] = "  SSLVerifyDepth 1";
  $lines[] = "  SSLOptions +StdEnvVars +ExportCertData";
  if (!empty(d()->https_client_authentication_path)) {
    $lines[] = "  </Location>";
  }
  $lines[] = "\n";
  return implode("\n", $lines);
}