HSAdmin Backend Domains, E-Mail, Datenbanken
656b5dba43db8b4bd7a76ed5716f9574684aebe5..69c0882228aef7aaaeb311bccf20c2ba91f31e60
2020-02-19 Peter Hormanns
no autoconfig subdomain
69c088 diff | tree
2020-02-19 Peter Hormanns
adjust vhost template
5fa888 diff | tree
2020-02-19 Peter Hormanns
adjust autoconfig vhost template
28ca6a diff | tree
3 files modified
69 ■■■■■ changed files
hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java 6 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java 24 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/dom/apache-vhost.vm 39 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java
@@ -28,7 +28,7 @@
    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 DOMOPT_PHP5 = "php5";
    public static final String DOMOPT_AUTOCONFIG = "autoconfig";
    
    public static final String[] ALL_DOMOPTS = 
            new String[] { 
@@ -38,8 +38,8 @@
                    DOMOPT_HTDOCSFALLBACK, 
                    DOMOPT_INCLUDES, 
                    DOMOPT_BACKUPFOREXTERNALMX,
                    DOMOPT_LETSENCRYPT
//                    , DOMOPT_PHP5
                    DOMOPT_LETSENCRYPT,
                    DOMOPT_AUTOCONFIG
            };
    public static final String[] DEFAULT_DOMOPTS = 
            new String[] { 
hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java
@@ -410,29 +410,7 @@
        final Map<String, Object> templateVars = new HashMap<String, Object>();
        query.setParameter("hivename", hiveName);
        query.setParameter("option", "letsencrypt");        
        final List<?> domainsResultList = query.getResultList();
        for (Object domObj : domainsResultList) {
            if (domObj instanceof Domain) {
                final Domain d = (Domain) domObj;
                boolean autoconfig = false;
                final Set<DomainOption> domainoptions = d.getDomainoptions();
                for (DomainOption opt : domainoptions) {
                    if ("autoconfig".equals(opt.getName())) {
                        autoconfig = true;
                    }
                }
                final String validSubdomains = d.getValidsubdomainnames();
                if (autoconfig && !validSubdomains.contains("autoconfig")) {
                    if (validSubdomains.length() > 0) {
                        d.setValidsubdomainnames(validSubdomains + ",autoconfig");
                    }
                    else {
                        d.setValidsubdomainnames("autoconfig");
                    }
                }
            }
        }
        templateVars.put("domains", domainsResultList);
        templateVars.put("domains", query.getResultList());
        return new CompoundProcessor(
                new CreateFileProcessor("/de/hsadmin/mods/dom/acmebot-domain.properties.vm", templateVars, dom,
                        "/etc/hostsharing/acmebot/domain.properties.tmp", "acmebot", "acmebot", "640", true),
hsarback/src/de/hsadmin/mods/dom/apache-vhost.vm
@@ -6,9 +6,6 @@
<VirtualHost ${pac.curINetAddr.inet4Addr}:80 ${pac.oldINetAddr.inet4Addr}:80 [${pac.curINetAddr.inet6Addr}]:80 [${pac.oldINetAddr.inet6Addr}]:80>
    ServerName ${dom.name}
    ServerAlias ${dom.serveraliases}
#if( ${autoconfig} )
    ServerAlias autoconfig.${dom.name}
#end
    ServerAdmin webmaster@${dom.name}
    SuexecUserGroup ${dom.user.name} ${pac.name}
@@ -48,12 +45,20 @@
        Options +ExecCGI +IncludesNoExec -Indexes -MultiViews +SymLinksIfOwnerMatch
    </Location>
#if( ${autoconfig} )
    <Location /autodiscover/autodiscover.xml>
        ProxyPreserveHost Off
        ProxyPass https://config.hostsharing.net/hsar/config-v1.1.xml
    </Location>
    <Location /.well-known/autoconfig/mail/config-v1.1.xml>
        ProxyPreserveHost Off
        ProxyPass https://config.hostsharing.net/hsar/config-v1.1.xml
    </Location>
#end
    RewriteEngine On
    RewriteOptions Inherit
#if( ${autoconfig} )
    RewriteRule ^/mail/config-v1.1.xml$ ajp://config.hostsharing.net:8009/hsar/config-v1.1.xml [proxy,last]
#end
    RewriteCond %{REQUEST_URI} !^/cgi-bin/
    RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
@@ -82,9 +87,6 @@
<VirtualHost ${pac.curINetAddr.inet4Addr}:443 ${pac.oldINetAddr.inet4Addr}:443 [${pac.curINetAddr.inet6Addr}]:443 [${pac.oldINetAddr.inet6Addr}]:443>
    ServerName ${dom.name}
    ServerAlias ${dom.serveraliases}
#if( ${autoconfig} )
    ServerAlias autoconfig.${dom.name}
#end
    ServerAdmin webmaster@${dom.name}
    SuexecUserGroup ${dom.user.name} ${pac.name}
@@ -130,13 +132,20 @@
        Options +ExecCGI +IncludesNoExec -Indexes -MultiViews +SymLinksIfOwnerMatch
    </Location>
#if( ${autoconfig} )
    <Location /autodiscover/autodiscover.xml>
        ProxyPreserveHost Off
        ProxyPass https://config.hostsharing.net/hsar/config-v1.1.xml
    </Location>
    <Location /.well-known/autoconfig/mail/config-v1.1.xml>
        ProxyPreserveHost Off
        ProxyPass https://config.hostsharing.net/hsar/config-v1.1.xml
    </Location>
#end
    RewriteEngine On
    RewriteOptions Inherit
#if( ${autoconfig} )
    RewriteRule ^/mail/config-v1.1.xml$ ajp://config.hostsharing.net:8009/hsar/config-v1.1.xml [proxy,last]
    RewriteRule ^/autodiscover/autodiscover.xml$ ajp://config.hostsharing.net:8009/hsar/config-v1.1.xml [proxy,last]
#end
    RewriteCond %{REQUEST_URI} !^/cgi-bin/
    RewriteCond %{REQUEST_URI} !^/fastcgi-bin/