Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move vhost add-ons for LE ACME challenges path to submodule
Related issue: https://www.drupal.org/node/2731605
- Loading branch information
Showing
8 changed files
with
198 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Does some of the things. | ||
*/ | ||
|
||
class Provision_Service_Le extends Provision_Service { | ||
public $service = 'Le'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
|
||
/** | ||
* Register our directory as a place to find provision classes. | ||
*/ | ||
function hosting_le_vhost_register_autoload() { | ||
static $loaded = FALSE; | ||
if (!$loaded) { | ||
$loaded = TRUE; | ||
$list = drush_commandfile_list(); | ||
$provision_dir = dirname($list['provision']); | ||
if (is_readable($provision_dir . '/provision.inc')) { | ||
include_once($provision_dir . '/provision.inc'); | ||
include_once($provision_dir . '/provision.service.inc'); | ||
if (function_exists('provision_autoload_register_prefix')) { | ||
provision_autoload_register_prefix('Provision_', dirname(__FILE__)); | ||
} | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Implements hook_drush_init(). | ||
*/ | ||
function hosting_le_vhost_drush_init() { | ||
hosting_le_vhost_register_autoload(); | ||
} | ||
|
||
/** | ||
* Implements hook_provision_services(). | ||
*/ | ||
function hosting_le_vhost_provision_services() { | ||
hosting_le_vhost_register_autoload(); | ||
return array('Le' => NULL); | ||
} | ||
|
||
/* | ||
* Implementation of hook_provision_nginx_vhost_config() | ||
*/ | ||
function hosting_le_vhost_provision_nginx_vhost_config($uri, $data) { | ||
|
||
$aegir_root = d('@server_master')->aegir_root; | ||
|
||
if (d()->type == 'site' && d()->ssl_enabled) { | ||
|
||
$lines = array(); | ||
|
||
$lines[] = ""; | ||
$lines[] = " ###"; | ||
$lines[] = " ### Allow access to letsencrypt.org ACME challenges directory."; | ||
$lines[] = " ###"; | ||
$lines[] = " location ^~ /.well-known/acme-challenge {"; | ||
$lines[] = " alias $aegir_root/tools/le/.acme-challenges;"; | ||
$lines[] = " try_files \$uri 404;"; | ||
$lines[] = " }"; | ||
$lines[] = "\n"; | ||
|
||
return implode("\n", $lines); | ||
} | ||
|
||
return ''; | ||
} | ||
|
||
/* | ||
* Implementation of hook_provision_apache_vhost_config() | ||
*/ | ||
function hosting_le_vhost_provision_apache_vhost_config($uri, $data) { | ||
|
||
$aegir_root = d('@server_master')->aegir_root; | ||
|
||
if (d()->type == 'site' && d()->ssl_enabled) { | ||
|
||
$lines = array(); | ||
|
||
$lines[] = ""; | ||
$lines[] = " Alias /.well-known/acme-challenge $aegir_root/tools/le/.acme-challenges"; | ||
$lines[] = ""; | ||
$lines[] = " # Allow access to letsencrypt.org ACME challenges directory."; | ||
$lines[] = " <Directory \"$aegir_root/tools/le/.acme-challenges\">"; | ||
$lines[] = " Require all granted"; | ||
$lines[] = " </Directory>"; | ||
$lines[] = "\n"; | ||
|
||
return implode("\n", $lines); | ||
} | ||
|
||
return ''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
// This file is necessary for the drush file to be detected. | ||
|
||
/** | ||
* Register a hosting feature with Aegir. | ||
* | ||
* This will be used to generate the 'admin/hosting' page. | ||
* | ||
* @return array | ||
* associative array indexed by feature key. | ||
*/ | ||
function hosting_le_vhost_hosting_feature() { | ||
$features['hosting_le_vhost'] = array( | ||
'title' => t('Hosting LE Vhost'), | ||
'description' => t("Extends vhosts with ACME challenge paths for Let's Encrypt."), | ||
'status' => HOSTING_FEATURE_DISABLED, | ||
'module' => 'hosting_le_vhost', | ||
'group' => 'experimental', | ||
); | ||
return $features; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
name = Hosting LE Vhost | ||
description = Extends vhosts with ACME challenge paths for Let's Encrypt | ||
package = Hosting | ||
dependencies[] = hosting_ssl | ||
dependencies[] = hosting_le | ||
core = 7.x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
|