Merge branch 'master' of ssh://hsh04-source@hsh04.hostsharing.net/home/doms/source.hostsharing.net/source/hsadmin.git/
This commit is contained in:
commit
bb23e27f6e
@ -0,0 +1,80 @@
|
|||||||
|
-- Migrate database from version 2.1 to version 2.2
|
||||||
|
--
|
||||||
|
-- domain options
|
||||||
|
--
|
||||||
|
CREATE SEQUENCE domain_option_id_seq
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MAXVALUE
|
||||||
|
NO MINVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
CREATE TABLE domain_option (
|
||||||
|
domain_option_id integer DEFAULT nextval(('"domain_option_id_seq"'::text)::regclass) NOT NULL,
|
||||||
|
domain_option_name character varying(50) NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY domain_option
|
||||||
|
ADD CONSTRAINT pk_domain_option PRIMARY KEY (domain_option_id);
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX domain_option_name_idx ON domain_option USING btree ( domain_option_name );
|
||||||
|
|
||||||
|
CREATE TABLE domain__domain_option (
|
||||||
|
domain_option_id integer NOT NULL,
|
||||||
|
domain_id integer NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY domain__domain_option
|
||||||
|
ADD CONSTRAINT pk_domain__domain_option PRIMARY KEY (domain_option_id, domain_id);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY domain__domain_option
|
||||||
|
ADD CONSTRAINT domain_option_id_fkey FOREIGN KEY (domain_option_id)
|
||||||
|
REFERENCES domain_option(domain_option_id) DEFERRABLE;
|
||||||
|
|
||||||
|
ALTER TABLE ONLY domain__domain_option
|
||||||
|
ADD CONSTRAINT domain_id_fkey FOREIGN KEY (domain_id)
|
||||||
|
REFERENCES domain(domain_id) DEFERRABLE;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- table: domain_option
|
||||||
|
--
|
||||||
|
INSERT INTO domain_option (domain_option_name)
|
||||||
|
VALUES ('backupmxforexternalmx');
|
||||||
|
INSERT INTO domain_option (domain_option_name)
|
||||||
|
VALUES ('greylisting');
|
||||||
|
INSERT INTO domain_option (domain_option_name)
|
||||||
|
VALUES ('htdocsfallback');
|
||||||
|
INSERT INTO domain_option (domain_option_name)
|
||||||
|
VALUES ('includes');
|
||||||
|
INSERT INTO domain_option (domain_option_name)
|
||||||
|
VALUES ('indexes');
|
||||||
|
INSERT INTO domain_option (domain_option_name)
|
||||||
|
VALUES ('multiviews');
|
||||||
|
--
|
||||||
|
-- new domain options settings
|
||||||
|
--
|
||||||
|
-- existing default = ON
|
||||||
|
--
|
||||||
|
INSERT INTO domain__domain_option SELECT domain_option_id, domain_id
|
||||||
|
FROM domain, domain_option
|
||||||
|
WHERE domain_option.domain_option_name = 'greylisting' ;
|
||||||
|
INSERT INTO domain__domain_option SELECT domain_option_id, domain_id
|
||||||
|
FROM domain, domain_option
|
||||||
|
WHERE domain_option.domain_option_name = 'htdocsfalback' ;
|
||||||
|
INSERT INTO domain__domain_option SELECT domain_option_id, domain_id
|
||||||
|
FROM domain, domain_option
|
||||||
|
WHERE domain_option.domain_option_name = 'includes' ;
|
||||||
|
INSERT INTO domain__domain_option SELECT domain_option_id, domain_id
|
||||||
|
FROM domain, domain_option
|
||||||
|
WHERE domain_option.domain_option_name = 'indexes' ;
|
||||||
|
INSERT INTO domain__domain_option SELECT domain_option_id, domain_id
|
||||||
|
FROM domain, domain_option
|
||||||
|
WHERE domain_option.domain_option_name = 'multiviews' ;
|
||||||
|
--
|
||||||
|
-- existing default = OFF
|
||||||
|
--
|
||||||
|
DELETE FROM domain__domain_option USING domain_option
|
||||||
|
WHERE domain__domain_option.domain_option_id = domain_option.domain_option_id
|
||||||
|
AND domain_option.domain_option_name = 'backupmxforexternalmx' ;
|
||||||
|
--
|
||||||
|
-- End of migratino to version 2.2
|
||||||
|
--
|
@ -900,6 +900,10 @@ ALTER TABLE ONLY component
|
|||||||
ALTER TABLE ONLY queue_task
|
ALTER TABLE ONLY queue_task
|
||||||
ADD CONSTRAINT queue_task_user_id_fkey FOREIGN KEY (user_id) REFERENCES unixuser(unixuser_id) ON DELETE SET NULL;
|
ADD CONSTRAINT queue_task_user_id_fkey FOREIGN KEY (user_id) REFERENCES unixuser(unixuser_id) ON DELETE SET NULL;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- domain options
|
||||||
|
--
|
||||||
|
|
||||||
CREATE SEQUENCE domain_option_id_seq
|
CREATE SEQUENCE domain_option_id_seq
|
||||||
INCREMENT BY 1
|
INCREMENT BY 1
|
||||||
NO MAXVALUE
|
NO MAXVALUE
|
||||||
|
@ -11,6 +11,7 @@ import javax.persistence.Query;
|
|||||||
import de.hsadmin.core.model.AbstractEntity;
|
import de.hsadmin.core.model.AbstractEntity;
|
||||||
import de.hsadmin.core.model.AbstractModuleImpl;
|
import de.hsadmin.core.model.AbstractModuleImpl;
|
||||||
import de.hsadmin.core.model.AuthorisationException;
|
import de.hsadmin.core.model.AuthorisationException;
|
||||||
|
import de.hsadmin.core.model.GenericModuleImpl;
|
||||||
import de.hsadmin.core.model.HSAdminException;
|
import de.hsadmin.core.model.HSAdminException;
|
||||||
import de.hsadmin.mods.email.EMailAddress;
|
import de.hsadmin.mods.email.EMailAddress;
|
||||||
import de.hsadmin.mods.pac.Pac;
|
import de.hsadmin.mods.pac.Pac;
|
||||||
@ -177,9 +178,9 @@ public class DomainModuleImpl extends AbstractModuleImpl {
|
|||||||
Query query = em.createQuery("SELECT adr FROM " + EMailAddress.class.getAnnotation(javax.persistence.Entity.class).name()
|
Query query = em.createQuery("SELECT adr FROM " + EMailAddress.class.getAnnotation(javax.persistence.Entity.class).name()
|
||||||
+ " adr WHERE adr.domain.name='" + dom.getName() + "'");
|
+ " adr WHERE adr.domain.name='" + dom.getName() + "'");
|
||||||
List<?> resultList = query.getResultList();
|
List<?> resultList = query.getResultList();
|
||||||
|
GenericModuleImpl helperModule = new GenericModuleImpl(getTransaction());
|
||||||
for (Object obj : resultList) {
|
for (Object obj : resultList) {
|
||||||
EMailAddress eMailAddress = (EMailAddress) obj;
|
helperModule.delete((EMailAddress) obj);
|
||||||
em.remove(eMailAddress);
|
|
||||||
}
|
}
|
||||||
super.delete(existingEntity);
|
super.delete(existingEntity);
|
||||||
}
|
}
|
||||||
|
@ -105,11 +105,8 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
|||||||
public <T extends AbstractEntity> Processor createDeleteProcessor(EntityManager em, T entity) throws ProcessorException {
|
public <T extends AbstractEntity> Processor createDeleteProcessor(EntityManager em, T entity) throws ProcessorException {
|
||||||
Domain dom = (Domain) entity;
|
Domain dom = (Domain) entity;
|
||||||
String domName = dom.getName();
|
String domName = dom.getName();
|
||||||
WaitingTasksProcessor mainProcessor = new WaitingTasksProcessor(
|
WaitingTasksProcessor mainProcessor = new WaitingTasksProcessor(
|
||||||
new CompoundProcessor(
|
createHiveDNSRemoveProcessor(domName)
|
||||||
createHiveEMailRemoveProcessor(domName),
|
|
||||||
createHiveDNSRemoveProcessor(domName)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
Config config = Config.getInstance();
|
Config config = Config.getInstance();
|
||||||
for (String queueName : config.getProperty("queues.dns").split(",")) {
|
for (String queueName : config.getProperty("queues.dns").split(",")) {
|
||||||
@ -130,6 +127,7 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
|||||||
new TemplateProcessor("/de/hsadmin/mods/dom/zonefile.jtpl", templateVars, zonefileTargetPath, false);
|
new TemplateProcessor("/de/hsadmin/mods/dom/zonefile.jtpl", templateVars, zonefileTargetPath, false);
|
||||||
Processor zonefileACLProcessor =
|
Processor zonefileACLProcessor =
|
||||||
new ShellProcessor("chown root:bind " + zonefileTargetPath + " && chmod 644 " + zonefileTargetPath);
|
new ShellProcessor("chown root:bind " + zonefileTargetPath + " && chmod 644 " + zonefileTargetPath);
|
||||||
|
// TODO Use templates and regenerate the file.
|
||||||
Processor prizonesFileProcessor =
|
Processor prizonesFileProcessor =
|
||||||
new ShellProcessor("echo 'zone \"" + domName + "\" { type master; file \"pri." + domName + "\"; };' >>/etc/bind/named.pri-zones" +
|
new ShellProcessor("echo 'zone \"" + domName + "\" { type master; file \"pri." + domName + "\"; };' >>/etc/bind/named.pri-zones" +
|
||||||
" && sort /etc/bind/named.pri-zones | uniq >/etc/bind/named.pri-zones.tmp" +
|
" && sort /etc/bind/named.pri-zones | uniq >/etc/bind/named.pri-zones.tmp" +
|
||||||
@ -162,14 +160,6 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
|||||||
return emailAdrProcessor;
|
return emailAdrProcessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ShellProcessor createHiveEMailRemoveProcessor(String domName) {
|
|
||||||
return new ShellProcessor(
|
|
||||||
"postmap -d '" + domName + "' /etc/postfix-mailin/virtual && " +
|
|
||||||
"for KEY in $(postmap -s /etc/postfix-mailin/virtual|grep '@" + domName + "\\s'|cut -f1); " +
|
|
||||||
"do postmap -d $KEY /etc/postfix-mailin/virtual; done"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Processor createDNSServerSetupProcessor(String domName, String pacInetAddr) {
|
private Processor createDNSServerSetupProcessor(String domName, String pacInetAddr) {
|
||||||
Processor seczonesFileProcessor;
|
Processor seczonesFileProcessor;
|
||||||
seczonesFileProcessor =
|
seczonesFileProcessor =
|
||||||
@ -181,8 +171,8 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Processor createDNSServerRemoveProcessor(String domName) {
|
private Processor createDNSServerRemoveProcessor(String domName) {
|
||||||
|
// TODO Use templates and regenerate the file.
|
||||||
return new ShellProcessor("grep -v '\"sec." + domName + "\"' /etc/bind/named-hsh.conf >/etc/bind/named-hsh.conf.tmp" +
|
return new ShellProcessor("grep -v '\"sec." + domName + "\"' /etc/bind/named-hsh.conf >/etc/bind/named-hsh.conf.tmp" +
|
||||||
// TODO sed -e'/sec.abc.example.com/d' -i /etc/bind/named-hsh.conf
|
|
||||||
" && mv /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf" +
|
" && mv /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf" +
|
||||||
" && rm /var/cache/bind/sec." + domName +
|
" && rm /var/cache/bind/sec." + domName +
|
||||||
" && invoke-rc.d bind9 reload");
|
" && invoke-rc.d bind9 reload");
|
||||||
@ -307,18 +297,53 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
|||||||
String linkPrefix = Integer.toString(100 - level);
|
String linkPrefix = Integer.toString(100 - level);
|
||||||
String pac = dom.getUser().getPac().getName();
|
String pac = dom.getUser().getPac().getName();
|
||||||
Query query = em.createQuery("SELECT d FROM Domains d WHERE d.domainoptions.name = :option AND d.name = :domname");
|
Query query = em.createQuery("SELECT d FROM Domains d WHERE d.domainoptions.name = :option AND d.name = :domname");
|
||||||
query.setParameter("option", "nohtdocsfallback");
|
|
||||||
query.setParameter("domname", dom.getName());
|
query.setParameter("domname", dom.getName());
|
||||||
List<?> result = query.getResultList();
|
// TODO: This code should be cleaned up after switching to the velocity template engine.
|
||||||
List<Map<String, String>> iterateMaps = new ArrayList<Map<String, String>>();
|
query.setParameter("option", "indexes");
|
||||||
if (!result.isEmpty()) {
|
if (query.getResultList().isEmpty()) {
|
||||||
iterateMaps.add(new HashMap<String, String>());
|
templateVars.put("INDEXES", "+Indexes");
|
||||||
|
} else {
|
||||||
|
templateVars.put("INDEXES", "-Indexes");
|
||||||
}
|
}
|
||||||
|
// TODO: This code should be cleaned up after switching to the velocity template engine.
|
||||||
|
query.setParameter("option", "includes");
|
||||||
|
if (query.getResultList().isEmpty()) {
|
||||||
|
templateVars.put("INCLUDES", "+IncludesNoExec");
|
||||||
|
} else {
|
||||||
|
templateVars.put("INCLUDES", "-Includes");
|
||||||
|
}
|
||||||
|
// TODO: This code should be cleaned up after switching to the velocity template engine.
|
||||||
|
query.setParameter("option", "multiviews");
|
||||||
|
if (query.getResultList().isEmpty()) {
|
||||||
|
templateVars.put("MULTIVIEWS", "+MultiViews");
|
||||||
|
} else {
|
||||||
|
templateVars.put("MULTIVIEWS", "-MultiViews");
|
||||||
|
}
|
||||||
|
// TODO: This code should be cleaned up after switching to the velocity template engine.
|
||||||
|
query.setParameter("option", "htdocsfallback");
|
||||||
|
if (query.getResultList().isEmpty()) {
|
||||||
|
templateVars.put("HTDOCSFALLBACKHTTP",
|
||||||
|
" RewriteCond %{REQUEST_URI} !^/cgi-bin/\n" +
|
||||||
|
" RewriteCond %{REQUEST_URI} !^/fastcgi-bin/\n" +
|
||||||
|
" RewriteCond %{HTTP_HOST} ^(.+)\\.{DOM_HOSTNAME}\\.?(:80)?$ [novary]\n" +
|
||||||
|
" RewriteCond /home/doms/{DOM_HOSTNAME}/subs/${tolower:%1} !-d\n" +
|
||||||
|
" RewriteRule ^(.*) - [redirect=404,last]");
|
||||||
|
templateVars.put("HTDOCSFALLBACKHTTPS",
|
||||||
|
" RewriteCond %{REQUEST_URI} !^/cgi-bin/\n" +
|
||||||
|
" RewriteCond %{REQUEST_URI} !^/fastcgi-bin/\n" +
|
||||||
|
" RewriteCond %{HTTP_HOST} ^(.+)\\.{DOM_HOSTNAME}\\.?(:443)?$ [novary]\n" +
|
||||||
|
" RewriteCond /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1} !-d\n" +
|
||||||
|
" RewriteRule ^(.*) - [redirect=404,last]");
|
||||||
|
} else {
|
||||||
|
templateVars.put("HTDOCSFALLBACKHTTP", "\n");
|
||||||
|
templateVars.put("HTDOCSFALLBACKHTTPS", "\n");
|
||||||
|
}
|
||||||
|
|
||||||
Processor domSetupProcessor = new CompoundProcessor(
|
Processor domSetupProcessor = new CompoundProcessor(
|
||||||
createDomainDirectoriesProcessor(dom, templateVars),
|
createDomainDirectoriesProcessor(dom, templateVars),
|
||||||
new CreateFileProcessor(selectVHostTemplate(dom), templateVars, iterateMaps.iterator(), "/etc/apache2/sites-available/" + domName + ".tmp", "root", "root", "644", true),
|
new CreateFileProcessor(selectVHostTemplate(dom), templateVars, "/etc/apache2/sites-available/" + domName + ".tmp", "root", "root", "644", true),
|
||||||
new ShellProcessor("ls /etc/apache2/pems/" + pac + ".pem >/dev/null 2>&1 " +
|
new ShellProcessor("ls /etc/apache2/pems/" + pac + ".pem >/dev/null 2>&1" +
|
||||||
"&& sed -i '/SSLCertificate.*default/d' " + "/etc/apache2/sites-available/" + domName + ".tmp" +
|
" && sed -i '/SSLCertificate.*default/d' " + "/etc/apache2/sites-available/" + domName + ".tmp" +
|
||||||
" && (ls /etc/apache2/pems/" + pac + ".chain.pem >/dev/null 2>&1 || sed -i '/SSLCertificateChain.*" + pac + "/d' " + "/etc/apache2/sites-available/" + domName + ".tmp )" +
|
" && (ls /etc/apache2/pems/" + pac + ".chain.pem >/dev/null 2>&1 || sed -i '/SSLCertificateChain.*" + pac + "/d' " + "/etc/apache2/sites-available/" + domName + ".tmp )" +
|
||||||
" || sed -i '/SSLCertificate.*" + pac + "/d' " + "/etc/apache2/sites-available/" + domName + ".tmp"),
|
" || sed -i '/SSLCertificate.*" + pac + "/d' " + "/etc/apache2/sites-available/" + domName + ".tmp"),
|
||||||
new ShellProcessor(
|
new ShellProcessor(
|
||||||
|
@ -17,40 +17,34 @@
|
|||||||
Alias /fastcgi-bin/ /home/doms/{DOM_HOSTNAME}/fastcgi/
|
Alias /fastcgi-bin/ /home/doms/{DOM_HOSTNAME}/fastcgi/
|
||||||
|
|
||||||
<Directory />
|
<Directory />
|
||||||
Options -ExecCGI +IncludesNOEXEC +Indexes +MultiViews +SymLinksIfOwnerMatch
|
Options -ExecCGI {INCLUDES} {INDEXES} {MULTIVIEWS} +SymLinksIfOwnerMatch
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
<Directory /home/doms/{DOM_HOSTNAME}/>
|
<Directory /home/doms/{DOM_HOSTNAME}/>
|
||||||
AllowOverride AuthConfig FileInfo Indexes Limit
|
AllowOverride AuthConfig FileInfo Indexes Limit
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
<Directory /home/doms/{DOM_HOSTNAME}/cgi-bin/>
|
<Location /cgi-bin/>
|
||||||
SetHandler cgi-script
|
SetHandler cgi-script
|
||||||
Options +ExecCGI -Indexes -MultiViews
|
Options +ExecCGI {INCLUDES} -Indexes -MultiViews +SymLinksIfOwnerMatch
|
||||||
</Directory>
|
</Location>
|
||||||
|
|
||||||
<Directory /home/doms/{DOM_HOSTNAME}/fastcgi-bin/>
|
<Location /fastcgi-bin/>
|
||||||
SetHandler fcgid-script
|
SetHandler fcgid-script
|
||||||
Options +ExecCGI -Indexes -MultiViews
|
Options +ExecCGI {INCLUDES} -Indexes -MultiViews +SymLinksIfOwnerMatch
|
||||||
</Directory>
|
</Location>
|
||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteOptions Inherit
|
RewriteOptions Inherit
|
||||||
|
|
||||||
RewriteCond %{REQUEST_URI} !^/cgi-bin/
|
RewriteCond %{REQUEST_URI} !^/cgi-bin/
|
||||||
RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
|
RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
|
||||||
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:80)?$ [novary]
|
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:[0-9]+)?$ [novary]
|
||||||
RewriteCond /home/doms/{DOM_HOSTNAME}/subs/${tolower:%1} -d
|
RewriteCond /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1} -d
|
||||||
RewriteRule ^(.*) /home/doms/{DOM_HOSTNAME}/subs/${tolower:%1}$1 [last]
|
RewriteRule ^(.*) /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1}$1 [last]
|
||||||
|
|
||||||
<!-- BEGIN: iterate -->
|
{HTDOCSFALLBACKHTTP}
|
||||||
RewriteCond %{REQUEST_URI} !^/cgi-bin/
|
|
||||||
RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
|
|
||||||
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:80)?$ [novary]
|
|
||||||
RewriteCond /home/doms/{DOM_HOSTNAME}/subs/${tolower:%1} !-d
|
|
||||||
RewriteRule ^(.*) - [redirect=404,last]
|
|
||||||
|
|
||||||
<!-- END: iterate -->
|
|
||||||
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
|
||||||
|
|
||||||
@ -77,7 +71,7 @@
|
|||||||
|
|
||||||
<Directory />
|
<Directory />
|
||||||
SSLRequireSSL On
|
SSLRequireSSL On
|
||||||
Options -ExecCGI +IncludesNOEXEC +Indexes +MultiViews +SymLinksIfOwnerMatch
|
Options -ExecCGI {INCLUDES} {INDEXES} {MULTIVIEWS} +SymLinksIfOwnerMatch
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
<Directory /home/doms/{DOM_HOSTNAME}/>
|
<Directory /home/doms/{DOM_HOSTNAME}/>
|
||||||
@ -86,31 +80,25 @@
|
|||||||
|
|
||||||
<Location /cgi-bin/>
|
<Location /cgi-bin/>
|
||||||
SetHandler cgi-script
|
SetHandler cgi-script
|
||||||
Options +ExecCGI -Indexes -MultiViews
|
Options +ExecCGI {INCLUDES} -Indexes -MultiViews +SymLinksIfOwnerMatch
|
||||||
</Location>
|
</Location>
|
||||||
|
|
||||||
<Location /fastcgi-bin/>
|
<Location /fastcgi-bin/>
|
||||||
SetHandler fcgid-script
|
SetHandler fcgid-script
|
||||||
Options +ExecCGI -Indexes -MultiViews
|
Options +ExecCGI {INCLUDES} -Indexes -MultiViews +SymLinksIfOwnerMatch
|
||||||
</Location>
|
</Location>
|
||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteOptions Inherit
|
RewriteOptions Inherit
|
||||||
|
|
||||||
RewriteCond %{REQUEST_URI} !^/cgi-bin/
|
RewriteCond %{REQUEST_URI} !^/cgi-bin/
|
||||||
RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
|
RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
|
||||||
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:443)?$ [novary]
|
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:[0-9]+)?$ [novary]
|
||||||
RewriteCond /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1} -d
|
RewriteCond /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1} -d
|
||||||
RewriteRule ^(.*) /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1}$1 [last]
|
RewriteRule ^(.*) /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1}$1 [last]
|
||||||
|
|
||||||
<!-- BEGIN: nosubdomainfallbackforhttps -->
|
{HTDOCSFALLBACKHTTPS}
|
||||||
RewriteCond %{REQUEST_URI} !^/cgi-bin/
|
|
||||||
RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
|
|
||||||
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:443)?$ [novary]
|
|
||||||
RewriteCond /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1} !-d
|
|
||||||
RewriteRule ^(.*) - [redirect=404,last]
|
|
||||||
|
|
||||||
<!-- END: nosubdomainfallbackforhttps -->
|
|
||||||
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
|
||||||
|
|
||||||
|
@ -14,33 +14,32 @@
|
|||||||
DocumentRoot /home/doms/{DOM_HOSTNAME}/htdocs
|
DocumentRoot /home/doms/{DOM_HOSTNAME}/htdocs
|
||||||
|
|
||||||
<Directory />
|
<Directory />
|
||||||
Options -ExecCGI +IncludesNOEXEC +Indexes +MultiViews +SymLinksIfOwnerMatch
|
Options -ExecCGI {INCLUDES} {INDEXES} {MULTIVIEWS} +SymLinksIfOwnerMatch
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
<Directory /home/doms/{DOM_HOSTNAME}/>
|
<Directory /home/doms/{DOM_HOSTNAME}/>
|
||||||
AllowOverride AuthConfig FileInfo Indexes Limit
|
AllowOverride AuthConfig FileInfo Indexes Limit
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
<Directory /home/doms/{DOM_HOSTNAME}/cgi-bin/>
|
<Location /cgi-bin/>
|
||||||
Redirect 501 /
|
Redirect 501 /
|
||||||
</Directory>
|
</Location>
|
||||||
|
|
||||||
<Directory /home/doms/{DOM_HOSTNAME}/fastcgi-bin/>
|
<Location /fastcgi-bin/>
|
||||||
Redirect 501 /
|
Redirect 501 /
|
||||||
</Directory>
|
</Location>
|
||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteOptions Inherit
|
RewriteOptions Inherit
|
||||||
|
|
||||||
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:80)?$ [novary]
|
RewriteCond %{REQUEST_URI} !^/cgi-bin/
|
||||||
RewriteCond /home/doms/{DOM_HOSTNAME}/subs/${tolower:%1} -d
|
RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
|
||||||
RewriteRule ^(.*) /home/doms/{DOM_HOSTNAME}/subs/${tolower:%1}$1 [last]
|
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:[0-9]+)?$ [novary]
|
||||||
|
RewriteCond /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1} -d
|
||||||
|
RewriteRule ^(.*) /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1}$1 [last]
|
||||||
|
|
||||||
<!-- BEGIN: iterate --> RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:80)?$ [novary]
|
{HTDOCSFALLBACKHTTP}
|
||||||
RewriteCond /home/doms/{DOM_HOSTNAME}/subs/${tolower:%1} !-d
|
|
||||||
RewriteRule ^(.*) - [redirect=404,last]
|
|
||||||
|
|
||||||
<!-- END: iterate -->
|
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
||||||
<VirtualHost {DOM_IPNUMBER}:443 {DOM_IPNUMBEREX}:443>
|
<VirtualHost {DOM_IPNUMBER}:443 {DOM_IPNUMBEREX}:443>
|
||||||
@ -61,7 +60,7 @@
|
|||||||
|
|
||||||
<Directory />
|
<Directory />
|
||||||
SSLRequireSSL On
|
SSLRequireSSL On
|
||||||
Options -ExecCGI +IncludesNOEXEC +Indexes +MultiViews +SymLinksIfOwnerMatch
|
Options -ExecCGI {INCLUDES} {INDEXES} {MULTIVIEWS} +SymLinksIfOwnerMatch
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
<Directory /home/doms/{DOM_HOSTNAME}/>
|
<Directory /home/doms/{DOM_HOSTNAME}/>
|
||||||
@ -74,19 +73,18 @@
|
|||||||
|
|
||||||
<Location /fastcgi-bin/>
|
<Location /fastcgi-bin/>
|
||||||
Redirect 501 /
|
Redirect 501 /
|
||||||
</Location>
|
</Location>
|
||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteOptions Inherit
|
RewriteOptions Inherit
|
||||||
|
|
||||||
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:443)?$ [novary]
|
RewriteCond %{REQUEST_URI} !^/cgi-bin/
|
||||||
|
RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
|
||||||
|
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:[0-9]+)?$ [novary]
|
||||||
RewriteCond /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1} -d
|
RewriteCond /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1} -d
|
||||||
RewriteRule ^(.*) /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1}$1 [last]
|
RewriteRule ^(.*) /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1}$1 [last]
|
||||||
|
|
||||||
<!-- BEGIN: nosubdomainfallbackforhttps --> RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:443)?$ [novary]
|
|
||||||
RewriteCond /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1} !-d
|
|
||||||
RewriteRule ^(.*) - [redirect=404,last]
|
|
||||||
|
|
||||||
<!-- END: nosubdomainfallbackforhttps -->
|
{HTDOCSFALLBACKHTTPS}
|
||||||
|
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
<!-- END: main -->
|
<!-- END: main -->
|
@ -220,6 +220,13 @@ public class DomainTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Test
|
||||||
|
public void testBackupMxForExternamlMx() throws UnknownHostException, IOException {
|
||||||
|
testBackupMxForExternamlMxOnOff(true, "zuerst an");
|
||||||
|
testBackupMxForExternamlMxOnOff(false, "als zweites aus");
|
||||||
|
testBackupMxForExternamlMxOnOff(true, "zuletzt wieder an");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGreylisting() throws UnknownHostException, IOException {
|
public void testGreylisting() throws UnknownHostException, IOException {
|
||||||
testGreylistingOnOff(true, "zuerst an");
|
testGreylistingOnOff(true, "zuerst an");
|
||||||
@ -233,31 +240,70 @@ public class DomainTest {
|
|||||||
testHtdocsfallbackOnOff(true, "als zweites an");
|
testHtdocsfallbackOnOff(true, "als zweites an");
|
||||||
testHtdocsfallbackOnOff(false, "zuletzt wieder aus");
|
testHtdocsfallbackOnOff(false, "zuletzt wieder aus");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Test
|
||||||
|
public void testIncludes() throws UnknownHostException, IOException {
|
||||||
|
testIncludesOnOff(false, "zuerst aus");
|
||||||
|
testIncludesOnOff(true, "als zweites an");
|
||||||
|
testIncludesOnOff(false, "zuletzt wieder aus");
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Test
|
||||||
|
public void testIndexes() throws UnknownHostException, IOException {
|
||||||
|
testIndexesOnOff(false, "zuerst aus");
|
||||||
|
testIndexesOnOff(true, "als zweites an");
|
||||||
|
testIndexesOnOff(false, "zuletzt wieder aus");
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Test
|
||||||
|
public void testMultiviews() throws UnknownHostException, IOException {
|
||||||
|
testMultiviewsOnOff(true, "zuerst an");
|
||||||
|
testMultiviewsOnOff(false, "als zweites aus");
|
||||||
|
testMultiviewsOnOff(true, "zuletzt wieder an");
|
||||||
|
}
|
||||||
|
|
||||||
private void testGreylistingOnOff(boolean onoff, String message)
|
private void testBackupMxForExternamlMxOnOff(boolean onoff, String message)
|
||||||
throws UnknownHostException, IOException {
|
throws UnknownHostException, IOException {
|
||||||
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOptionName() {
|
public String getOptionName() {
|
||||||
return "greylisting";
|
return "backupmxforexternalmx";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOptionConfigured(String domain)
|
public boolean isOptionConfigured(String domain)
|
||||||
throws UnknownHostException, IOException {
|
throws UnknownHostException, IOException {
|
||||||
String host = "test-h99.hostsharing.net";
|
String host = "test-h99.hostsharing.net";
|
||||||
String answer = socketQuery( host, 25,
|
return host == ""; // noch kein sinnvoller test
|
||||||
"HELO " + domain + "\n" +
|
}
|
||||||
"MAIl FROM: hsadmin-testing@" + domain + "\n" +
|
});
|
||||||
"RCPT TO: postmaster@" + domain + "\n" +
|
}
|
||||||
"DATA\n" +
|
|
||||||
".\n") ;
|
private void testGreylistingOnOff(boolean onoff, String message)
|
||||||
|
throws UnknownHostException, IOException {
|
||||||
|
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOptionName() {
|
||||||
|
return "greylisting";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOptionConfigured(String domain)
|
||||||
|
throws UnknownHostException, IOException {
|
||||||
|
String host = "test-h99.hostsharing.net";
|
||||||
|
String answer = socketQuery( host, 25,
|
||||||
|
"HELO " + domain + "\n" +
|
||||||
|
"MAIl FROM: hsadmin-testing@" + domain + "\n" +
|
||||||
|
"RCPT TO: postmaster@" + domain + "\n" +
|
||||||
|
"DATA\n" +
|
||||||
|
".\n") ;
|
||||||
return answer.contains("450") && answer.contains("reylisting");
|
return answer.contains("450") && answer.contains("reylisting");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testHtdocsfallbackOnOff(boolean onoff, String message)
|
private void testHtdocsfallbackOnOff(boolean onoff, String message)
|
||||||
throws UnknownHostException, IOException {
|
throws UnknownHostException, IOException {
|
||||||
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
||||||
@ -272,8 +318,81 @@ public class DomainTest {
|
|||||||
throws UnknownHostException, IOException {
|
throws UnknownHostException, IOException {
|
||||||
String host = "test-h99.hostsharing.net";
|
String host = "test-h99.hostsharing.net";
|
||||||
String answer = socketQuery(host, 80, "GET / HTTP/1.1\n"
|
String answer = socketQuery(host, 80, "GET / HTTP/1.1\n"
|
||||||
+ "Host: x.y.z." + domain
|
+ "Host: x.y.z." + domain
|
||||||
+ "User-Agent: hsAdmin Test\n" + "Connection: close\n");
|
+ "User-Agent: hsAdmin Test\n"
|
||||||
|
+ "Connection: close\n");
|
||||||
|
answer = answer.substring(0, answer.indexOf("\n"));
|
||||||
|
return answer.contains("404");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testIncludesOnOff(boolean onoff, String message)
|
||||||
|
throws UnknownHostException, IOException {
|
||||||
|
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOptionName() {
|
||||||
|
return "includes";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOptionConfigured(String domain)
|
||||||
|
throws UnknownHostException, IOException {
|
||||||
|
String host = "test-h99.hostsharing.net";
|
||||||
|
// TODO dieser Test ist Humbug
|
||||||
|
String answer = socketQuery(host, 80, "GET / HTTP/1.1\n"
|
||||||
|
+ "Host: " + domain
|
||||||
|
+ "User-Agent: hsAdmin Test\n"
|
||||||
|
+ "Connection: close\n");
|
||||||
|
answer = answer.substring(0, answer.indexOf("\n"));
|
||||||
|
return answer.contains("404");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testIndexesOnOff(boolean onoff, String message)
|
||||||
|
throws UnknownHostException, IOException {
|
||||||
|
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOptionName() {
|
||||||
|
return "indexes";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOptionConfigured(String domain)
|
||||||
|
throws UnknownHostException, IOException {
|
||||||
|
String host = "test-h99.hostsharing.net";
|
||||||
|
// TODO dieser Test ist Humbug
|
||||||
|
String answer = socketQuery(host, 80, "GET / HTTP/1.1\n"
|
||||||
|
+ "Host: " + domain
|
||||||
|
+ "User-Agent: hsAdmin Test\n"
|
||||||
|
+ "Connection: close\n");
|
||||||
|
answer = answer.substring(0, answer.indexOf("\n"));
|
||||||
|
return answer.contains("404");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testMultiviewsOnOff(boolean onoff, String message)
|
||||||
|
throws UnknownHostException, IOException {
|
||||||
|
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOptionName() {
|
||||||
|
return "multiviews";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOptionConfigured(String domain)
|
||||||
|
throws UnknownHostException, IOException {
|
||||||
|
String host = "test-h99.hostsharing.net";
|
||||||
|
// TODO dieser Test ist Humbug
|
||||||
|
String answer = socketQuery(host, 80, "GET / HTTP/1.1\n"
|
||||||
|
+ "Host: " + domain
|
||||||
|
+ "User-Agent: hsAdmin Test\n"
|
||||||
|
+ "Connection: close\n");
|
||||||
answer = answer.substring(0, answer.indexOf("\n"));
|
answer = answer.substring(0, answer.indexOf("\n"));
|
||||||
return answer.contains("404");
|
return answer.contains("404");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user