Skip to content

Commit

Permalink
Move vhost add-ons for LE ACME challenges path to submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
omega8cc committed May 24, 2016
1 parent 2659dc0 commit dbb3c01
Show file tree
Hide file tree
Showing 8 changed files with 198 additions and 95 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -41,7 +41,7 @@ You could switch it back and forth to demo/live mode by adding and deleting the

This module will create all required directories it needs to operate on the first attempt to run site Verify task with SSL option enabled, but you may want to create at least `[aegir_root]/tools/le/.ctrl/` before running it for the first time, so the demo mode will be active on the first attempt.

Read the task log lines which start with `[provision_hosting_le]` prefix for more information.
Read the task log lines which start with `[hosting_le]` prefix for more information.

Exceptions
==========
Expand Down
140 changes: 69 additions & 71 deletions drush/provision_hosting_le.drush.inc

Large diffs are not rendered by default.

23 changes: 0 additions & 23 deletions hosting_le.drush.inc

This file was deleted.

10 changes: 10 additions & 0 deletions hosting_le_vhost/drush/Provision/Service/Le.php
@@ -0,0 +1,10 @@
<?php

/**
* @file
* Does some of the things.
*/

class Provision_Service_Le extends Provision_Service {
public $service = 'Le';
}
88 changes: 88 additions & 0 deletions hosting_le_vhost/drush/hosting_le_vhost.drush.inc
@@ -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 '';
}
22 changes: 22 additions & 0 deletions hosting_le_vhost/hosting.feature.le_vhost.inc
@@ -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;
}
6 changes: 6 additions & 0 deletions hosting_le_vhost/hosting_le_vhost.info
@@ -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
2 changes: 2 additions & 0 deletions hosting_le_vhost/hosting_le_vhost.module
@@ -0,0 +1,2 @@
<?php

0 comments on commit dbb3c01

Please sign in to comment.