domain option letsencrypt

This commit is contained in:
Peter Hormanns 2017-06-21 11:18:54 +02:00
parent d7e8d6825f
commit d24c19f30a
7 changed files with 30 additions and 53 deletions

View File

@ -194,7 +194,7 @@ INSERT INTO domain_option (domain_option_name)
INSERT INTO domain_option (domain_option_name) INSERT INTO domain_option (domain_option_name)
VALUES ('multiviews'); VALUES ('multiviews');
INSERT INTO domain_option (domain_option_name) INSERT INTO domain_option (domain_option_name)
VALUES ('php'); VALUES ('letsencrypt');
-- --
-- table: price_list -- table: price_list

View File

@ -1,3 +1,5 @@
INSERT INTO domain_option (domain_option_name)
VALUES ('greylisting');
INSERT INTO contactrole_ref (contact_id, role) INSERT INTO contactrole_ref (contact_id, role)
( SELECT contact_id, 'voting-right' FROM contact ); ( SELECT contact_id, 'voting-right' FROM contact );

View File

@ -180,13 +180,4 @@ public class Domain extends AbstractEntity {
this.domainoptions = domainOptions; 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();
}
} }

View File

@ -21,16 +21,32 @@ import de.hsadmin.mods.user.UnixUser;
public class DomainModuleImpl extends AbstractModuleImpl { public class DomainModuleImpl extends AbstractModuleImpl {
public static final String DOMOPT_GREYLISTING = "greylisting"; 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_INDEXES = "indexes";
public static final String DOMOPT_HTDOCSFALLBACK = "htdocsfallback"; public static final String DOMOPT_HTDOCSFALLBACK = "htdocsfallback";
public static final String DOMOPT_INCLUDES = "includes"; public static final String DOMOPT_INCLUDES = "includes";
public static final String DOMOPT_BACKUPFOREXTERNALMX = "backupmxforexternalmx"; 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, public static final String[] ALL_DOMOPTS =
DOMOPT_INDEXES, DOMOPT_HTDOCSFALLBACK, DOMOPT_INCLUDES, DOMOPT_BACKUPFOREXTERNALMX }; new String[] {
public static final String[] DEFAULT_DOMOPTS = new String[] { DOMOPT_GREYLISTING, DOMMULTIVIEWS, DOMOPT_GREYLISTING,
DOMOPT_INDEXES, DOMOPT_HTDOCSFALLBACK, DOMOPT_INCLUDES }; 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 @Override
public AbstractEntity initialize(AbstractEntity newEntity) throws AuthorisationException { public AbstractEntity initialize(AbstractEntity newEntity) throws AuthorisationException {

View File

@ -24,7 +24,7 @@ public class DomainOptionValues extends DefaultSelectableValues {
list.add(new BooleanListValue("includes")); list.add(new BooleanListValue("includes"));
list.add(new BooleanListValue("indexes")); list.add(new BooleanListValue("indexes"));
list.add(new BooleanListValue("multiviews")); list.add(new BooleanListValue("multiviews"));
// list.add(new BooleanListValue("php")); list.add(new BooleanListValue("letsencrypt"));
return list; return list;
} }

View File

@ -258,7 +258,6 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
private Processor createApacheVHostSetupProcessor(final EntityManager em, final Domain dom) throws ProcessorException { private Processor createApacheVHostSetupProcessor(final EntityManager em, final Domain dom) throws ProcessorException {
final Map<String, Object> templateVars = new HashMap<String, Object>(); final Map<String, Object> templateVars = new HashMap<String, Object>();
templateVars.put("dynamicWeb", new Boolean(dom.isDynamic()));
final String domName = dom.getName(); final String domName = dom.getName();
int level = domName.split("\\.").length; int level = domName.split("\\.").length;
final String linkPrefix = Integer.toString(100 - level); final String linkPrefix = Integer.toString(100 - level);

View File

@ -10,12 +10,10 @@
SuexecUserGroup ${dom.user.name} ${pac.name} SuexecUserGroup ${dom.user.name} ${pac.name}
#if( ${dynamicWeb} )
PassengerEnabled on PassengerEnabled on
PassengerUser ${dom.user.name} PassengerUser ${dom.user.name}
PassengerGroup ${pac.name} PassengerGroup ${pac.name}
PassengerAppRoot /home/doms/${dom.name}/app/ PassengerAppRoot /home/doms/${dom.name}/app/
#end
DocumentRoot /home/doms/${dom.name}/htdocs DocumentRoot /home/doms/${dom.name}/htdocs
@ -30,27 +28,15 @@
AllowOverride AuthConfig FileInfo Indexes Limit Options=Includes,Indexes,MultiViews,PassengerNodejs,PassengerPython,PassengerRuby,PassengerAppEnv AllowOverride AuthConfig FileInfo Indexes Limit Options=Includes,Indexes,MultiViews,PassengerNodejs,PassengerPython,PassengerRuby,PassengerAppEnv
</Directory> </Directory>
#if( ${dynamicWeb} )
<Location /cgi-bin/> <Location /cgi-bin/>
SetHandler cgi-script SetHandler cgi-script
Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch
</Location> </Location>
#else
<Location /cgi-bin/>
Redirect 501 /
</Location>
#end
#if( ${dynamicWeb} )
<Location /fastcgi-bin/> <Location /fastcgi-bin/>
SetHandler fcgid-script SetHandler fcgid-script
Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch
</Location> </Location>
#else
<Location /fastcgi-bin/>
Redirect 501 /
</Location>
#end
RewriteEngine On RewriteEngine On
RewriteOptions Inherit RewriteOptions Inherit
@ -67,12 +53,10 @@
RewriteCond %{HTTP_HOST} ^(.+)\.${dom.name}\.?(:80)?$ [novary] RewriteCond %{HTTP_HOST} ^(.+)\.${dom.name}\.?(:80)?$ [novary]
RewriteCond /home/doms/${dom.name}/subs/#[[${tolower:%1} ]]# !-d RewriteCond /home/doms/${dom.name}/subs/#[[${tolower:%1} ]]# !-d
RewriteRule ^(.*) - [redirect=404,last] RewriteRule ^(.*) - [redirect=404,last]
#end
#end
#if( ${dynamicWeb} )
AddType application/x-httpd-php .php .php5 .php4 .php3 AddType application/x-httpd-php .php .php5 .php4 .php3
Action application/x-httpd-php /fastcgi-bin/phpstub Action application/x-httpd-php /fastcgi-bin/phpstub
#end
</VirtualHost> </VirtualHost>
<VirtualHost ${pac.curINetAddr.inetAddr}:443 ${pac.oldINetAddr.inetAddr}:443> <VirtualHost ${pac.curINetAddr.inetAddr}:443 ${pac.oldINetAddr.inetAddr}:443>
@ -82,12 +66,10 @@
SuexecUserGroup ${dom.user.name} ${pac.name} SuexecUserGroup ${dom.user.name} ${pac.name}
#if( ${dynamicWeb} )
PassengerEnabled on PassengerEnabled on
PassengerUser ${dom.user.name} PassengerUser ${dom.user.name}
PassengerGroup ${pac.name} PassengerGroup ${pac.name}
PassengerAppRoot /home/doms/${dom.name}/app-ssl/ PassengerAppRoot /home/doms/${dom.name}/app-ssl/
#end
SSLEngine On SSLEngine On
SSLCertificateFile /etc/apache2/pems-enabled/${dom.name}.crt 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 AllowOverride AuthConfig FileInfo Indexes Limit Options=Includes,Indexes,MultiViews,PassengerNodejs,PassengerPython,PassengerRuby,PassengerAppEnv
</Directory> </Directory>
#if( ${dynamicWeb} )
<Location /cgi-bin/> <Location /cgi-bin/>
SetHandler cgi-script SetHandler cgi-script
Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch
</Location> </Location>
#else
<Location /cgi-bin/>
Redirect 501 /
</Location>
#end
#if( ${dynamicWeb} )
<Location /fastcgi-bin/> <Location /fastcgi-bin/>
SetHandler fcgid-script SetHandler fcgid-script
Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch
</Location> </Location>
#else
<Location /fastcgi-bin/>
Redirect 501 /
</Location>
#end
RewriteEngine On RewriteEngine On
RewriteOptions Inherit RewriteOptions Inherit
@ -147,8 +117,7 @@
RewriteRule ^(.*) - [redirect=404,last] RewriteRule ^(.*) - [redirect=404,last]
#end #end
#if( ${dynamicWeb} )
AddType application/x-httpd-php .php .php5 .php4 .php3 AddType application/x-httpd-php .php .php5 .php4 .php3
Action application/x-httpd-php /fastcgi-bin/phpstub Action application/x-httpd-php /fastcgi-bin/phpstub
#end
</VirtualHost> </VirtualHost>