provision_ssl.drush.inc 1.41 KB
Newer Older
1
2
3
4
5
6
7
8
<?php

/**
 * @file
 *
 * Drush hooks and commands for SSL stuff in the Aegir backend
 */

9
10
11
12
13
/**
 * Implementation of hook_provision_apache_vhost_config()
 *
 * Add SSL configuration to the virtual host and create redirection if
 * necessary (if the ssl_redirect option is set). This all takes
anarcat's avatar
anarcat committed
14
 * effect only if the ssl option is on
15
16
17
18
19
20
21
 *
 * The configuration we add to the virtual host are those two simple
 * lines:
 *
 * php_value session.cookie_secure 1
 * SSLEngine On
 */
22
function provision_ssl_provision_apache_vhost_config($url, $options) {
anarcat's avatar
anarcat committed
23
  if ($options['ssl']) {
24
25
26
27
28
    if ($options['ssl_redirect'] && provision_path('exists', drush_get_option('vhost_path') . '/' . $url . '_80', FALSE, NULL, t("The redirection port is not available, no redirction installed"))) {
      $newoptions = $options;
      $newoptions['site_port'] = 80;
      _provision_apache_create_config($url . '_80', $newoptions, _provision_apache_redirect_template());
    }
29
30
31
32
33
    return array("php_value session.cookie_secure 1", "SSLEngine On");
  } else {
    return NULL;
  }
}
34
35
36
37
38
39
40

/**
 * Implementation of hook_provision_apache_delete_vhost()
 *
 * This will delete the redirection vhost if it was created.
 */
function provision_ssl_provision_apache_delete_vhost($url, $options) {
anarcat's avatar
anarcat committed
41
  if ($options['ssl'] && $options['ssl_redirect']) {
42
43
44
    provision_path('unlink', drush_get_option('vhost_path') . '/' . $url . '_80', TRUE, NULL, t("Failed deleting redirection vhost."));
  }
}