From d24c19f30ac7347eb5c1b4034a6de2254ad45968 Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Wed, 21 Jun 2017 11:18:54 +0200 Subject: [PATCH] domain option letsencrypt --- hsarback/database/data.sql | 4 +- hsarback/database/database_update.sql | 4 +- hsarback/src/de/hsadmin/mods/dom/Domain.java | 9 ----- .../de/hsadmin/mods/dom/DomainModuleImpl.java | 26 ++++++++++--- .../hsadmin/mods/dom/DomainOptionValues.java | 2 +- .../mods/dom/DomainProcessorFactory.java | 1 - .../src/de/hsadmin/mods/dom/apache-vhost.vm | 37 ++----------------- 7 files changed, 30 insertions(+), 53 deletions(-) diff --git a/hsarback/database/data.sql b/hsarback/database/data.sql index 84ad030..6465a49 100644 --- a/hsarback/database/data.sql +++ b/hsarback/database/data.sql @@ -193,8 +193,8 @@ INSERT INTO domain_option (domain_option_name) VALUES ('indexes'); INSERT INTO domain_option (domain_option_name) VALUES ('multiviews'); -INSERT INTO domain_option (domain_option_name) - VALUES ('php'); +INSERT INTO domain_option (domain_option_name) + VALUES ('letsencrypt'); -- -- table: price_list diff --git a/hsarback/database/database_update.sql b/hsarback/database/database_update.sql index 2a8bc78..97e18d5 100644 --- a/hsarback/database/database_update.sql +++ b/hsarback/database/database_update.sql @@ -1,4 +1,6 @@ - +INSERT INTO domain_option (domain_option_name) + VALUES ('greylisting'); + INSERT INTO contactrole_ref (contact_id, role) ( SELECT contact_id, 'voting-right' FROM contact ); diff --git a/hsarback/src/de/hsadmin/mods/dom/Domain.java b/hsarback/src/de/hsadmin/mods/dom/Domain.java index 13c49a7..d2b360a 100644 --- a/hsarback/src/de/hsadmin/mods/dom/Domain.java +++ b/hsarback/src/de/hsadmin/mods/dom/Domain.java @@ -180,13 +180,4 @@ public class Domain extends AbstractEntity { this.domainoptions = domainOptions; } - public boolean isDynamic() { - String basepacName = getUser().getPac().getBasepac().getName(); - return isPacDomain() || basepacName.equals(BasePacType.PAC_DW) || basepacName.equals(BasePacType.PAC_WEB); - } - - public boolean isStatic() { - return !isDynamic(); - } - } diff --git a/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java b/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java index 6598982..2bd5b08 100644 --- a/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java +++ b/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java @@ -21,16 +21,32 @@ import de.hsadmin.mods.user.UnixUser; public class DomainModuleImpl extends AbstractModuleImpl { public static final String DOMOPT_GREYLISTING = "greylisting"; - public static final String DOMMULTIVIEWS = "multiviews"; + public static final String DOMOPT_MULTIVIEWS = "multiviews"; public static final String DOMOPT_INDEXES = "indexes"; public static final String DOMOPT_HTDOCSFALLBACK = "htdocsfallback"; public static final String DOMOPT_INCLUDES = "includes"; public static final String DOMOPT_BACKUPFOREXTERNALMX = "backupmxforexternalmx"; + public static final String DOMOPT_LETSENCRYPT = "letsencrypt"; - public static final String[] ALL_DOMOPTS = new String[] { DOMOPT_GREYLISTING, DOMMULTIVIEWS, - DOMOPT_INDEXES, DOMOPT_HTDOCSFALLBACK, DOMOPT_INCLUDES, DOMOPT_BACKUPFOREXTERNALMX }; - public static final String[] DEFAULT_DOMOPTS = new String[] { DOMOPT_GREYLISTING, DOMMULTIVIEWS, - DOMOPT_INDEXES, DOMOPT_HTDOCSFALLBACK, DOMOPT_INCLUDES }; + public static final String[] ALL_DOMOPTS = + new String[] { + DOMOPT_GREYLISTING, + DOMOPT_MULTIVIEWS, + DOMOPT_INDEXES, + DOMOPT_HTDOCSFALLBACK, + DOMOPT_INCLUDES, + DOMOPT_BACKUPFOREXTERNALMX, + DOMOPT_LETSENCRYPT + }; + public static final String[] DEFAULT_DOMOPTS = + new String[] { + DOMOPT_GREYLISTING, + DOMOPT_MULTIVIEWS, + DOMOPT_INDEXES, + DOMOPT_HTDOCSFALLBACK, + DOMOPT_INCLUDES, + DOMOPT_LETSENCRYPT + }; @Override public AbstractEntity initialize(AbstractEntity newEntity) throws AuthorisationException { diff --git a/hsarback/src/de/hsadmin/mods/dom/DomainOptionValues.java b/hsarback/src/de/hsadmin/mods/dom/DomainOptionValues.java index 3018fe3..2813438 100644 --- a/hsarback/src/de/hsadmin/mods/dom/DomainOptionValues.java +++ b/hsarback/src/de/hsadmin/mods/dom/DomainOptionValues.java @@ -24,7 +24,7 @@ public class DomainOptionValues extends DefaultSelectableValues { list.add(new BooleanListValue("includes")); list.add(new BooleanListValue("indexes")); list.add(new BooleanListValue("multiviews")); -// list.add(new BooleanListValue("php")); + list.add(new BooleanListValue("letsencrypt")); return list; } diff --git a/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java b/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java index 4a49aee..82bc63b 100644 --- a/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java +++ b/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java @@ -258,7 +258,6 @@ public class DomainProcessorFactory implements EntityProcessorFactory { private Processor createApacheVHostSetupProcessor(final EntityManager em, final Domain dom) throws ProcessorException { final Map templateVars = new HashMap(); - templateVars.put("dynamicWeb", new Boolean(dom.isDynamic())); final String domName = dom.getName(); int level = domName.split("\\.").length; final String linkPrefix = Integer.toString(100 - level); diff --git a/hsarback/src/de/hsadmin/mods/dom/apache-vhost.vm b/hsarback/src/de/hsadmin/mods/dom/apache-vhost.vm index 1c37db1..a90e852 100644 --- a/hsarback/src/de/hsadmin/mods/dom/apache-vhost.vm +++ b/hsarback/src/de/hsadmin/mods/dom/apache-vhost.vm @@ -10,12 +10,10 @@ SuexecUserGroup ${dom.user.name} ${pac.name} -#if( ${dynamicWeb} ) PassengerEnabled on PassengerUser ${dom.user.name} PassengerGroup ${pac.name} PassengerAppRoot /home/doms/${dom.name}/app/ -#end DocumentRoot /home/doms/${dom.name}/htdocs @@ -30,27 +28,15 @@ AllowOverride AuthConfig FileInfo Indexes Limit Options=Includes,Indexes,MultiViews,PassengerNodejs,PassengerPython,PassengerRuby,PassengerAppEnv -#if( ${dynamicWeb} ) SetHandler cgi-script Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch -#else - - Redirect 501 / - -#end -#if( ${dynamicWeb} ) SetHandler fcgid-script Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch -#else - - Redirect 501 / - -#end RewriteEngine On RewriteOptions Inherit @@ -67,12 +53,10 @@ RewriteCond %{HTTP_HOST} ^(.+)\.${dom.name}\.?(:80)?$ [novary] RewriteCond /home/doms/${dom.name}/subs/#[[${tolower:%1} ]]# !-d RewriteRule ^(.*) - [redirect=404,last] - -#end -#if( ${dynamicWeb} ) + #end + AddType application/x-httpd-php .php .php5 .php4 .php3 Action application/x-httpd-php /fastcgi-bin/phpstub -#end @@ -82,12 +66,10 @@ SuexecUserGroup ${dom.user.name} ${pac.name} -#if( ${dynamicWeb} ) PassengerEnabled on PassengerUser ${dom.user.name} PassengerGroup ${pac.name} PassengerAppRoot /home/doms/${dom.name}/app-ssl/ -#end SSLEngine On SSLCertificateFile /etc/apache2/pems-enabled/${dom.name}.crt @@ -108,27 +90,15 @@ AllowOverride AuthConfig FileInfo Indexes Limit Options=Includes,Indexes,MultiViews,PassengerNodejs,PassengerPython,PassengerRuby,PassengerAppEnv -#if( ${dynamicWeb} ) SetHandler cgi-script Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch -#else - - Redirect 501 / - -#end -#if( ${dynamicWeb} ) SetHandler fcgid-script Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch -#else - - Redirect 501 / - -#end RewriteEngine On RewriteOptions Inherit @@ -147,8 +117,7 @@ RewriteRule ^(.*) - [redirect=404,last] #end -#if( ${dynamicWeb} ) AddType application/x-httpd-php .php .php5 .php4 .php3 Action application/x-httpd-php /fastcgi-bin/phpstub -#end +